I cant see polygons from the back!

Started by
8 comments, last by darkawakenings 20 years, 8 months ago
I was just wondering if this is normal behavior, because being halfway through chapter 6 in ''programming role playing games with directX'', i can draw some funky shapes and throw textures on them. But I decided just to have some fun so I wrote a little code so that the mouse moving over the client area spins the camera around my objects. To my surprise, when I got behind some of my polygons, it was as if they werent even there. Now I can see right through them. When i move the cam back around to the front, they are there, texture and all. I was just wondering if this is normal, and if it is how I stop it. I do not want these half textures!
Advertisement
Ya its normal, its called Culling i think. It just saves Processing time. What it does, is it only draws one side, so that when you create 3D objects, your only going to see the drawn side, and it doesnt have to draw the inside...
if you want it to stop doing this, i would suggest turning the D3DCULL_CW or D3DCULL_CCW to D3DCULL_NONE... that is if your using D3D

Quantum
Quantum
You need to set the render state.
YourDirect3DDevicePointerHere->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

Now if only somebody would help me with my error in the "two quick questions" thread... :/
Thx all, (so thats what culling is! ) Now I was just wondering how to set which side to be ''culled out''. Because In one of my examples the culling showed the wrong side face. Someone earlier told me that the culling switches every polygon or something, but it didnt make sense at the time.


Huh? A polygon isn''t displayed if the average of the vertices are facing away from the camera. So...just spin them around.

God, I hate being a damn anonymous user lo, but I can''t register because apparently I''m already registered, but I''m not... >.<
I dont understand what you mean by the average of the vertices, or by them facing anywhere. I thought a vertex was just a point until it was connected with other vertexs, and how does the computer decide if a square with no depth placed perpindicular to your view is facing away from you or towards you?


The order in which the vertices are ''made'' decides the render direction. Clock wise points away from you, counterclockwise points towards you.
thx, that answers it!


What happens if you make a polygon perfectly side on, AND in this order...
1------------3
|------------|
|------------|
4------------2
But it''s side-on so it''d be like...
1/3
|
|
4/2
the polygon won''t be drawn as the dot product will evaluate to 0. To be able to get perfectly side on though would be a bit of a task, and pretty unlikely.
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!

This topic is closed to new replies.

Advertisement