views:

19

answers:

1

Hi, In my program, the meshes were being displayed properly, but when I change the device.transform.view and the device.transform.projection matrices from the left handed to the right handed system, the meshes are not displayed properly anymore, i.e the back faces are being illuminated and the front faces are transparent! Does anyone have an idea what more needs to be changed to have a proper display

Original matrices:

device.Transform.View = Matrix.LookAtLH(vFrom, vAt, vUp);
device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, fAspect, 0f, 100f);

modification:

device.Transform.View = Matrix.LookAtRH(vFrom, vAt, vUp);
device.Transform.Projection = Matrix.PerspectiveFovRH((float)Math.PI / 4, fAspect, 0f, 100f);
+1  A: 

Well I'd expect both of those matrices to fail terribly on the basis that you set the near plane to 0. It really ought to be some small epsilon like 0.0001f.

The other thing to bear in mind is that by swapping the handedness of the system you are most likely inverting the winding order of the tris.

You need to set the culling render state to clockwise instead of anti/counter-clockwise.

ie

dxDevice.SetRenderState( RenderState.CullMode, Cull.Clockwise );
Goz
Thanks alot, that solves the problem...