diff options
Diffstat (limited to 'assets/final/shaders/renderer_3d.wgsl')
| -rw-r--r-- | assets/final/shaders/renderer_3d.wgsl | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/assets/final/shaders/renderer_3d.wgsl b/assets/final/shaders/renderer_3d.wgsl index 2f4f79c..c290df8 100644 --- a/assets/final/shaders/renderer_3d.wgsl +++ b/assets/final/shaders/renderer_3d.wgsl @@ -65,21 +65,10 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, out.color = obj.color; out.instance_index = instance_index; out.world_pos = world_pos.xyz; - - // Correct normal transformation for meshes: transpose of inverse of model matrix - // For non-uniform scaling, this is necessary. For other primitives, we use their analytical normals. - if (obj_type == 5.0) { - // Calculate inverse transpose of the model matrix (upper 3x3 part) - let model_matrix = mat3x3<f32>(obj.model[0].xyz, obj.model[1].xyz, obj.model[2].xyz); - let normal_matrix = transpose(inverse(model_matrix)); - out.transformed_normal = normalize(normal_matrix * in.normal); - } else { - // For SDF primitives, we don't use vertex normals directly here; they are computed in the fragment shader. - // However, we still need to output a normal for the fragment shader to use if it were a rasterized primitive. - // The transformed_normal is not used by the SDF fragment shader, but for correctness, we'll pass it. - // If this were a rasterized mesh, it would be used. - out.transformed_normal = normalize(vec3<f32>(0.0, 1.0, 0.0)); // Placeholder for non-mesh types - } + + // For SDF primitives, we don't use vertex normals - they are computed analytically in the fragment shader. + // This field is only used by the mesh pipeline (mesh_render.wgsl), not this SDF pipeline. + out.transformed_normal = normalize(vec3<f32>(0.0, 1.0, 0.0)); // Placeholder return out; } |
