How to pass these vertices to Direct3D to avoid back culling?

Started by
12 comments, last by FrEEzE2046 13 years, 6 months ago
Sorry, I still can't visualize and convince myself that those vertices are anti-clockwise, no matter how I imagine. Maybe I need some reading materials, any links would be greatly appreciated.
Thanks
Jack
Advertisement
Quote:Original post by lucky6969b
Sorry, I still can't visualize and convince myself that those vertices are anti-clockwise, no matter how I imagine. Maybe I need some reading materials, any links would be greatly appreciated.
Thanks
Jack


If the camera is at (0, 0, -50), looking at (0, 0, 0), the vertices look like:
      10,10,10 (0)       ___+___    ---       ---   +--------------+5,0,5 (1)      5,0,15 (2)
So the order 0, 2, 1 is a clockwise order - which is what you want, because anti-clockwise triangles are back-facing and culled (by default).
Quote:Original post by Evil Steve
Quote:Original post by lucky6969b
Sorry, I still can't visualize and convince myself that those vertices are anti-clockwise, no matter how I imagine. Maybe I need some reading materials, any links would be greatly appreciated.
Thanks
Jack


If the camera is at (0, 0, -50), looking at (0, 0, 0), the vertices look like:
      10,10,10 (0)       ___+___    ---       ---   +--------------+5,0,5 (1)      5,0,15 (2)
So the order 0, 2, 1 is a clockwise order - which is what you want, because anti-clockwise triangles are back-facing and culled (by default).


Oh, I was thinking clockwise triangles get culled. Okay, I get it now.
Thanks, its really great help!
Jack
Quote:Original post by Evil SteveIn D3D9, you can change that with SetRenderState(D3DRS_CULLMODE, mode).


The same possibility exists with DirectX 10 too.

typedef struct D3D10_RASTERIZER_DESC {
D3D10_FILL_MODE FillMode;
D3D10_CULL_MODE CullMode;
BOOL FrontCounterClockwise;
INT DepthBias;
FLOAT DepthBiasClamp;
FLOAT SlopeScaledDepthBias;
BOOL DepthClipEnable;
BOOL ScissorEnable;
BOOL MultisampleEnable;
BOOL AntialiasedLineEnable;
} D3D10_RASTERIZER_DESC;

HRESULT ID3D10Device::CreateRasterizerState(
const D3D10_RASTERIZER_DESC *pRasterizerDesc,
ID3D10RasterizerState **ppRasterizerState);


This topic is closed to new replies.

Advertisement