[.net] My models are depth perception handicapped!
For my own learning experience, I'm writing my own Managed DirectX 9 game engine. Things are going pretty well, the only problem is all the models I render are "inverted" or look like cut-out models.
Any ideas on why this would be? The models I'm seeing as inverted are both external .x files, as well as DirectX primitives, such as Mesh.Sphere(...).
I'd appreciate any insight on this!
[Edited by - Swamii on September 4, 2005 10:35:03 PM]
I didn't change the cull mode. Do I need to?
My gut reaction was that the normals of the models were wrong, but how could they be wrong when the models are created via Managed DirectX's own methods (the Mesh.Box, Mesh.Cylinder, etc.)?
Is there something with my camera/viewport settings I need to do? Currently, when I go to "render" the camera, I do the following
If it'd help, I can post screenshots or post my actual project.
My gut reaction was that the normals of the models were wrong, but how could they be wrong when the models are created via Managed DirectX's own methods (the Mesh.Box, Mesh.Cylinder, etc.)?
Is there something with my camera/viewport settings I need to do? Currently, when I go to "render" the camera, I do the following
device.Transform.Projection = Matrix.PerspectiveFovLH(fieldOfView, device.Viewport.Width / device.Viewport.Height, frontClipping, backClipping);device.Transform.View = Matrix.LookAtLH(camPosition, camOrientation, camOrientationUp);
If it'd help, I can post screenshots or post my actual project.
Ok, after more investigation (after playing with the cull mode), I've realized that what I'm seeing is not inverted models. So ignore the post title. :-)
Instead, what I'm seeing is depth problems: Model A is in front of Model B. Yet when rendered, I see model B rendered as though it is in front of the other model.
Here is a screenshot of what I'm seeing:
Instead, what I'm seeing is depth problems: Model A is in front of Model B. Yet when rendered, I see model B rendered as though it is in front of the other model.
Here is a screenshot of what I'm seeing:
ya gots no depth buffering, my friend. I bets that model A is render in order after model B.
Can you explain that a bit further? What do I need to do to get depth buffering working correctly? Currently, I just draw all models in the scene, not in any particular order...
for depth buffering all you need is the following in your PresentParameters before you create your device. That should take care of it.
presentParams.AutoDepthStencilFormat = DepthFormat.D16;presentParams.EnableAutoDepthFormatStencil = true;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement