Jump to content

  • Log In with Google      Sign In   
  • Create Account

Model perspective issue in XNA


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Tim Coolman   Members   -  Reputation: 163

Like
0Likes
Like

Posted 06 March 2013 - 08:23 PM

I have recently been playing around with XNA for the first time. I have some experience with DirectX 10 and 11, and have also gone through some modeling tutorials for Blender. But this is the first time I've tried to import a model created in Blender.

 

In the project I'm experimenting with, I am drawing a jet model provided in a Microsoft example, and a simple house model I created in Blender and exported to a .x file. The problem I'm having is the perspective of the house is opposite as it should be, relative to the camera. If the house model is in the center of the viewing area, it looks fine - all I see is the front surface of the model. As the model moves to the right of the camera (translation only, no rotation applied), I should begin to see some of the side of the model that is closest to the camera. Instead the opposite side becomes visible. The same happens with up and down movement.

 

The jet model behaves correctly, but I'm using the same view and projection matrix for both models.

 

Here are some screenshots to demonstrate what I'm talking about. Hard to tell with the jet, but the issue with the house is pretty clear. Just looking for some tips as to why this might happen? Hard for me to understand how the model could be the problem, but since I'm using the same matrices for both models, I feel like there must be something wrong with the way I exported the model or something. Thanks in advance for any time given to help me out!

 

1.png 2.png 3.png 4.png 5.png 6.png



Sponsor:

#2 /Jeff/   Members   -  Reputation: 649

Like
2Likes
Like

Posted 07 March 2013 - 07:11 AM

My guess is that the vertex windings are backwards, so it's being drawn inside-out. You can test that with the following line.

GraphicsDevice.RasterizerState = RasterizerState.CullClockwise;

 

The default behavior is to cull counter-clockwise.



#3 Tim Coolman   Members   -  Reputation: 163

Like
0Likes
Like

Posted 07 March 2013 - 09:44 AM

My guess is that the vertex windings are backwards

 

You were right! That line appeared to do the trick. Any idea if there is a way to take care of this on the export from Blender so I don't have to modify the cull mode?



#4 /Jeff/   Members   -  Reputation: 649

Like
0Likes
Like

Posted 11 March 2013 - 10:40 AM

Unfortunately I'm not familiar with Blender, so I can't really help you there. You could try flipping all the normals before you export, which isn't great, but it might work.



#5 xchimera   Members   -  Reputation: 129

Like
1Likes
Like

Posted 19 March 2013 - 08:46 AM

It is most likely because the faces are pointing the wrong way in blender, this can be quite hard to spot unless you go into texture mode. Try a google search to find out how to fix it as the only way i know this is because the same thing happened to me.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS