@@ -117,9 +117,12 @@ class Bump2NormalTextureInstance final : public Texture::Instance {
117
117
118
118
luisa::unique_ptr<Texture::Instance> Bump2NormalTexture::build (
119
119
Pipeline &pipeline, CommandBuffer &command_buffer) const noexcept {
120
+
121
+ Clock clk;
122
+
120
123
auto bump_texture = pipeline.build_texture (command_buffer, _bump_texture);
121
124
auto resolution = bump_texture->node ()->resolution ();
122
- auto resolution_scaled = make_uint2 (resolution.x * _scale, resolution.y );
125
+ auto resolution_scaled = make_uint2 (resolution.x * _scale, resolution.y * _scale );
123
126
auto strength = std::min (resolution.x , resolution.y ) * _scale;
124
127
125
128
auto bump_scaled = pipeline.create <Image<float >>(PixelStorage::FLOAT1, resolution_scaled, 1u );
@@ -134,11 +137,8 @@ luisa::unique_ptr<Texture::Instance> Bump2NormalTexture::build(
134
137
auto uv = make_float2 (
135
138
dispatch_id.x / Float (resolution.x ),
136
139
dispatch_id.y / Float (resolution.y ));
137
- auto value = bump_texture->evaluate (Interaction (uv), 0 .f ).x ;
138
- auto value_mapped = pow (value, 2 .2f );
139
- auto value_float4 = def (make_float4 (0 .f ));
140
- value_float4.x = value_mapped;
141
- target->write (dispatch_id, value_float4);
140
+ auto value = bump_texture->evaluate (Interaction (uv), 0 .f );
141
+ target->write (dispatch_id, value);
142
142
};
143
143
auto scale_shader = pipeline.device ().compile <2 >(scale_kernel);
144
144
command_buffer << scale_shader (*bump_scaled).dispatch (resolution_scaled) << commit ();
@@ -221,6 +221,7 @@ luisa::unique_ptr<Texture::Instance> Bump2NormalTexture::build(
221
221
<< synchronize ();
222
222
auto normal_map_tex_id = pipeline.register_bindless (*normal, sampler);
223
223
224
+ LUISA_INFO_WITH_LOCATION (" Bump2NormalTextureInstance build time: {} ms" , clk.toc ());
224
225
return luisa::make_unique<Bump2NormalTextureInstance>(pipeline, this , normal_map_tex_id);
225
226
}
226
227
0 commit comments