diff --git a/doc/changelog.dox b/doc/changelog.dox index 0c543693c..39eef6aa9 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -145,6 +145,9 @@ See also: - For meshes with multiple sets of vertex attributes (such as texture coordinates), @ref MeshTools::compile() should be using only the first set but it wasn't. +- @ref Shaders::Phong was normalizing light direction in vertex shader, + causing the fragment-interpolated direction being incorrect with visible + artifacts on long polygons under low light angle @subsection changelog-latest-deprecated Deprecated APIs diff --git a/src/Magnum/MeshTools/Test/CompileTestFiles/phong-flat.tga b/src/Magnum/MeshTools/Test/CompileTestFiles/phong-flat.tga index 3b9e47aba..4947cdb13 100644 Binary files a/src/Magnum/MeshTools/Test/CompileTestFiles/phong-flat.tga and b/src/Magnum/MeshTools/Test/CompileTestFiles/phong-flat.tga differ diff --git a/src/Magnum/MeshTools/Test/CompileTestFiles/phong-smooth.tga b/src/Magnum/MeshTools/Test/CompileTestFiles/phong-smooth.tga index ddc81ed34..07f653f90 100644 Binary files a/src/Magnum/MeshTools/Test/CompileTestFiles/phong-smooth.tga and b/src/Magnum/MeshTools/Test/CompileTestFiles/phong-smooth.tga differ diff --git a/src/Magnum/MeshTools/Test/CompileTestFiles/phong.tga b/src/Magnum/MeshTools/Test/CompileTestFiles/phong.tga index 89dd5beec..c952c51a2 100644 Binary files a/src/Magnum/MeshTools/Test/CompileTestFiles/phong.tga and b/src/Magnum/MeshTools/Test/CompileTestFiles/phong.tga differ diff --git a/src/Magnum/Shaders/Phong.vert b/src/Magnum/Shaders/Phong.vert index 3a76a6766..c89ee394a 100644 --- a/src/Magnum/Shaders/Phong.vert +++ b/src/Magnum/Shaders/Phong.vert @@ -180,7 +180,7 @@ void main() { /* Direction to the light */ for(int i = 0; i < LIGHT_COUNT; ++i) - lightDirections[i] = normalize(lightPositions[i] - transformedPosition); + lightDirections[i] = lightPositions[i] - transformedPosition; /* Direction to the camera */ cameraDirection = -transformedPosition; diff --git a/src/Magnum/Shaders/Test/PhongTestFiles/defaults.tga b/src/Magnum/Shaders/Test/PhongTestFiles/defaults.tga index f9a499b35..83e4a1818 100644 Binary files a/src/Magnum/Shaders/Test/PhongTestFiles/defaults.tga and b/src/Magnum/Shaders/Test/PhongTestFiles/defaults.tga differ diff --git a/src/Magnum/Shaders/Test/PhongTestFiles/textured-normal.tga b/src/Magnum/Shaders/Test/PhongTestFiles/textured-normal.tga index 679a3b3ce..87b5d7ea6 100644 Binary files a/src/Magnum/Shaders/Test/PhongTestFiles/textured-normal.tga and b/src/Magnum/Shaders/Test/PhongTestFiles/textured-normal.tga differ