Fix perspective correction issue for uv coordinates

This commit is contained in:
2024-07-05 09:06:17 +02:00
parent 3e73672538
commit eb96d7d674
5 changed files with 41 additions and 41 deletions

View File

@@ -21,11 +21,11 @@ layout(set = 1, binding = 0) uniform CameraData {
void main()
{
vec3 light = normalize(vec3(1));
vec3 light = normalize(vec3(10));
vec4 worldPos = node.world * vec4(position, 1.0);
vec3 worldNormal = normalize(transpose(inverse(mat3(node.world))) * normal);
float brightness = max(0.0, dot(worldNormal, light));
outColor = vec4(clamp(color.rgb * (0.5 + brightness / 2), 0, 1), 1);
gl_Position = normalize(cam.viewProjection * worldPos);
gl_Position = cam.viewProjection * worldPos;
fragTextureCoordinates = textureCoordinates.xy;
}