https://bugs.winehq.org/show_bug.cgi?id=37838
--- Comment #9 from Matteo Bruni matteo.mystral@gmail.com --- (In reply to Henri Verbeet from comment #8)
(In reply to Matteo Bruni from comment #7)
The viewer is in the (0.0, 0.0, -1.0) direction in the D3D coordinate system.
It's been a while since I went through the math for this, and the lighting code in general, but does that imply it's wrong for the other light types as well? Fortunately we have about 0 tests for D3DRS_LOCALVIEWER in any D3D version.
Yes, the others are probably wrong too. I can try to write a test for specular + D3DRS_LOCALVIEWER although I'm a bit worried that pow() + older GPUs = terrible numerical accuracy. Hopefully that won't be a showstopper.
/* TODO: In the non-local viewer case the halfvector is constant and
- could be precomputed and stored in a uniform. */
If we're going to redo how light parameters are passed to the shader, we should probably start from the actual D3D parameters. Spot lights in particular are just different between D3D and GL.
I'm still using GL-like parameters in my patches for getting rid of builtin uniforms in GLSL but yeah, ideally we should pass the D3D ones. I had a quick look into that when I was working on those various ddraw lighting fixes and it seems like it would be a lot of churn in old and mostly untested code :/