• Advertisement
Sign in to follow this  

DirectX Graphics Tutorial 4

This topic is 4722 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

Hi there! I'm pretty new to DirectX (9) programming and I already have a huge problem with tutorial 4 (introducing lights, should show rotating cylinder). Actually everything work fine, except one little problem. When i run my program I get this: http://studhome.rrze.uni-erlangen.de/~spserett/cylinder.png (rotating) On the right part of the cylinder the backside of the shape gets painted. Once it rotated 180°, the left backside is shown. I'm pretty stuck there, as I already had a look at the sample code that came with DirectX and I can't find a real difference! Can anyone help? Thanks zz123zz

Share this post


Link to post
Share on other sites
Advertisement
At first glance I would say you need to change your culling mode. Show us some code or let us know which tutorials you are using and you will probably get more help.

Share this post


Link to post
Share on other sites
In addition to what Neil said, make sure your normals are pointing ourwards on your cylinder. It is possible the light is shining on the inside surface of the cylinder (the yellow part) which is a front-facing polygon and wouldn't be culled which would be the case if the normals were inverted.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stenky
In addition to what Neil said, make sure your normals are pointing ourwards on your cylinder. It is possible the light is shining on the inside surface of the cylinder (the yellow part) which is a front-facing polygon and wouldn't be culled which would be the case if the normals were inverted.


Yep. Incorrect normals (0 length, point the wrong way etc) could definitely cause bad lighting as in that screenshot.

Something I should point out: vertex normals are not used for backface culling in Direct3D. Backface culling is determined by the screen/camera space winding order of the vertex positions after transformation (i.e. graphics hardware effectively performs a partial cross product of two edges and a sign check).

Share this post


Link to post
Share on other sites
I released that I was in the wrong culling mode. Had no culling activated. Changed that, now it works!

Thanks

Share this post


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

  • Advertisement