Jump to content
  • Advertisement
Sign in to follow this  
Swamii

[.net] My models are depth perception handicapped!

This topic is 4695 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Sounds like a problem with normals to me.

Share this post


Link to post
Share on other sites
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


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.

Share this post


Link to post
Share on other sites
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:

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!