-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2014-11-14 22:40, schrieb Joachim Priesner:
Take the absolute value of vertex.z as fog coordinate instead of just the z coordinate. This fixes e.g. fog for applications that use right-handed projection matrices.
Also test the clamp behavior of the oFog vertex shader output.
Fwiw, the start / end tests look good to me, and the results match what I expected. However I think Henri still disagrees with this patch.
Henri, I'd appreciate if you would say what you want. Without that I can offer Joachim only guesswork.
My guess is that the test is too complex. There are some parts that are technically not required to demonstrate the correctness of the abs(), but I see some value in the additional checks:
*) The "interrupted" quad with extra vertices at z = 0. It shows that the fully fogged other quad is not a result of the interpolation failing entirely and producing INF or NaN.
*) The foggy shader test: It shows how negative values coming from vertex shaders are treated. It's just logical to test this considering the behavior of the fixed function pipeline.
*) The manual fog coord / unfogged shader tests: Those could be removed I guess, although at least the manual fog coord test shows that there isn't some unexpected interference with negative depth values.
Joachim, I can offer you that I try to simplify those tests. If you're still motivated to work on this I'm happy to leave this up to you though.
Some ideas for simplifying the test, but I don't know yet if they'll work:
*) Split the shader and fixed function tests into separate tests.
*) Remove the interpolation tests from the fixed function tests. fog_interpolation_test shows that the fog equation is evaluated in the vertex pipeline in the affected cases, and the fogstart = -1, fogend = 0 test shows that the abs() happens before the fog equation. So I think removing this part of the test for the fixed function part is safe.