Browse Source

Shaders: remove incorrect light direction normalization in Phong.vert.

Adapted slight changes in existing tests, the new ground truth now
passes.
pull/470/head
Eric Undersander 6 years ago committed by Vladimír Vondruš
parent
commit
8b8b9c456b
  1. 3
      doc/changelog.dox
  2. BIN
      src/Magnum/MeshTools/Test/CompileTestFiles/phong-flat.tga
  3. BIN
      src/Magnum/MeshTools/Test/CompileTestFiles/phong-smooth.tga
  4. BIN
      src/Magnum/MeshTools/Test/CompileTestFiles/phong.tga
  5. 2
      src/Magnum/Shaders/Phong.vert
  6. BIN
      src/Magnum/Shaders/Test/PhongTestFiles/defaults.tga
  7. BIN
      src/Magnum/Shaders/Test/PhongTestFiles/textured-normal.tga

3
doc/changelog.dox

@ -145,6 +145,9 @@ See also:
- For meshes with multiple sets of vertex attributes (such as texture - For meshes with multiple sets of vertex attributes (such as texture
coordinates), @ref MeshTools::compile() should be using only the first set coordinates), @ref MeshTools::compile() should be using only the first set
but it wasn't. 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 @subsection changelog-latest-deprecated Deprecated APIs

BIN
src/Magnum/MeshTools/Test/CompileTestFiles/phong-flat.tga

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/Magnum/MeshTools/Test/CompileTestFiles/phong-smooth.tga

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/Magnum/MeshTools/Test/CompileTestFiles/phong.tga

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

2
src/Magnum/Shaders/Phong.vert

@ -180,7 +180,7 @@ void main() {
/* Direction to the light */ /* Direction to the light */
for(int i = 0; i < LIGHT_COUNT; ++i) for(int i = 0; i < LIGHT_COUNT; ++i)
lightDirections[i] = normalize(lightPositions[i] - transformedPosition); lightDirections[i] = lightPositions[i] - transformedPosition;
/* Direction to the camera */ /* Direction to the camera */
cameraDirection = -transformedPosition; cameraDirection = -transformedPosition;

BIN
src/Magnum/Shaders/Test/PhongTestFiles/defaults.tga

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 15 KiB

BIN
src/Magnum/Shaders/Test/PhongTestFiles/textured-normal.tga

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Loading…
Cancel
Save