diff options
Diffstat (limited to 'assets/final/shaders/renderer_3d.wgsl')
| -rw-r--r-- | assets/final/shaders/renderer_3d.wgsl | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/assets/final/shaders/renderer_3d.wgsl b/assets/final/shaders/renderer_3d.wgsl index 3ce078d..7be8d4e 100644 --- a/assets/final/shaders/renderer_3d.wgsl +++ b/assets/final/shaders/renderer_3d.wgsl @@ -121,10 +121,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { let bounds = ray_box_intersection(ro_local, rd_local, extent); - if (!bounds.hit) { - let uv_sky = vec2<f32>(atan2(rd_world.x, rd_world.z) / 6.28318 + 0.5, acos(clamp(rd_world.y, -1.0, 1.0)) / 3.14159); - return vec4<f32>(textureSample(sky_tex, noise_sampler, uv_sky).rgb, 1.0); - } + if (!bounds.hit) { discard; } var t = bounds.t_entry; var hit = false; @@ -135,10 +132,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { t = t + d_local; if (t > bounds.t_exit) { break; } } - if (!hit) { - let uv_sky = vec2<f32>(atan2(rd_world.x, rd_world.z) / 6.28318 + 0.5, acos(clamp(rd_world.y, -1.0, 1.0)) / 3.14159); - return vec4<f32>(textureSample(sky_tex, noise_sampler, uv_sky).rgb, 1.0); - } + if (!hit) { discard; } let q_hit = ro_local + rd_local * t; p = (obj.model * vec4<f32>(q_hit, 1.0)).xyz; // Correct world position |
