PolygonOffsetFactor doesn't seem to work with DirectX
Posted: Tue Sep 23, 2014 1:19 am
I'm seeing the same problem described in this bug report: http://sourceforge.net/p/irrlicht/bugs/414/#7c89
Looking at the source, notice that SMaterial::PolygonOffsetFactor is a 3-bit value with values of 0 to 7. It is used in the CD3D9Driver::setBasicRenderStates() method like so:
The values passed to DirectX for D3DRS_DEPTHBIAS are going to be 0 through 7. 0 disables polygon offset, so the minimum value we can specify is 1. But isn't that the entire range of the values in the Z buffer? In other words, don't the DirectX Z buffer values range from -1.0 to +1.0? This is essentially moving the faces entirely outside the range of the z buffer if I understand this correctly. It seems to be appropriate for OpenGL which probably uses integers for the Z buffer, but not DirectX.
If you reference the MS docs here: http://msdn.microsoft.com/en-us/library ... s.85).aspx note that they say suitable values range from -1.0 to +1.0 which also seems to imply that these should be very small floating point values.
Looking at the source, notice that SMaterial::PolygonOffsetFactor is a 3-bit value with values of 0 to 7. It is used in the CD3D9Driver::setBasicRenderStates() method like so:
Code: Select all
pID3DDevice->SetRenderState(D3DRS_DEPTHBIAS, F2DW((FLOAT)material.PolygonOffsetFactor));
If you reference the MS docs here: http://msdn.microsoft.com/en-us/library ... s.85).aspx note that they say suitable values range from -1.0 to +1.0 which also seems to imply that these should be very small floating point values.