Derived Z/Specular Lighting
by Jeremiah Fulbright · in Torque Game Engine Advanced · 11/27/2006 (4:42 pm) · 1 replies
If anybody has done so, can you explain the changes needed to get Specular lighting working properly with the deriving of Z in the shader or via hardware (CxV8U8 format).
I can swizzle bump without any issues and it all works well, but as soon as I attempt to generate the Z within the shader, it messes up the specular and makes it crappy looking.
Thanks!
img294.imageshack.us/img294/4260/nonderivedvh3.jpg
img133.imageshack.us/img133/2417/derivedih8.jpg
Edit: Here is 2 screenshots of the same part of the Orc Base/Building from Demo. The non-derived version is a DXT5 compressed normal map that has been swizzled (RGBA->AGBR) with the spec map coming from the alpha channel of the diffuse texture which is just normal DXT5 compressed.
The derived version is the exact same texture files, but instead of using the Z (Blue channel) from the DDS, it is generated in the Shader so it guarantees proper unit length and gives much much better results to compressed Normal Maps.
As you can see, the derived image looks cleaner overall, but there is no per pixel specular going on. There is some specular along the ridges of areas, like I would expect, but it seems theres some calculation that gets mishandled due to deriving Z.
I can swizzle bump without any issues and it all works well, but as soon as I attempt to generate the Z within the shader, it messes up the specular and makes it crappy looking.
Thanks!
img294.imageshack.us/img294/4260/nonderivedvh3.jpg
img133.imageshack.us/img133/2417/derivedih8.jpg
Edit: Here is 2 screenshots of the same part of the Orc Base/Building from Demo. The non-derived version is a DXT5 compressed normal map that has been swizzled (RGBA->AGBR) with the spec map coming from the alpha channel of the diffuse texture which is just normal DXT5 compressed.
The derived version is the exact same texture files, but instead of using the Z (Blue channel) from the DDS, it is generated in the Shader so it guarantees proper unit length and gives much much better results to compressed Normal Maps.
As you can see, the derived image looks cleaner overall, but there is no per pixel specular going on. There is some specular along the ridges of areas, like I would expect, but it seems theres some calculation that gets mishandled due to deriving Z.
Torque Owner Jeremiah Fulbright