DX10... 3dMax Drawing..ZBuffer?

Started by
6 comments, last by AquaMacker 11 years, 2 months ago

[attachment=13364:?? ??.png]

Hi...

Please look PIC...

I use 3dMax, maxscript and DX10.

I guess Zbuffer problem...

But zbuffer setting value is default value( == ON ).

pDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );

cullmode = d3d10_cull_front;

Indexing is fullvertexmodel... like this...


for ( int i = 0; i < nFaceNum; i++ )
{    
   pstIndices[i].A = j++;
   pstIndices[i].B = j++;
   pstIndices[i].C = j++;
}
 

Is related to cullmode, zbuffer or Indexing method ?

I have no idea. Really... @.@

How to solve the problem ?

Please understanding my bad english...

Advertisement

I found this problem...

I insert code pFont->DrawText()... -> This is PROBLEM !!!


Clear~~~~

ObjectDraw() -> Cull_Front
pFont-DrawText()

Present( 0, 0 );
 

Object draw with Cull_Front ... ONLY !!!

but font->draw() after object seems like to draw Cull_BACK !

I guess DrawText() function is Only Cull_BACK Draw...

Is DrawText() function Bug ?

DrawText sets some device state in order to do its job, and it's not resetting the state for you. You should explicitly set all the states upon drawing your objects.

Niko Suni

Thanks
I'll try.

hmm...
I decided to use DX10.1. Direct2D...

DrawText is hard to use...

Regardless of the API you end up using, my advice is still valid.

Niko Suni

end up using ?
pDevice->RSSetState( NULL ) ?

I don't understand what your saying...

Just before you draw your objects (at each frame), set all the states that affect the rendering of said objects. These include input assembler settings, rasterizer state, blend state, output merger state, shaders, views, textures, samplers, buffers, input layout (and some others). Rendering text usually sets some of these states, and in your case the font object isn't apparently resetting some of the states after drawing; this is why you need to do it.

For a small list of objects this may seem like overkill, but if you have many similar objects you can sort their rendering by the states they use (commonly known as "batching"). This potentially saves a lot of user->kernel transitions (driver calls) - those can eat your cpu cycles fast.

---

Note that if you use ID3DX10Font (this is not apparent in your code), you can use a sprite object that you previously allocated in order to store the font's render states. The sprite object uses a Begin/End pair; the Begin method lets you specify that upon calling End the device state is restored to pre-Begin state. So if you surround the font drawing with the Begin/End of its sprite, you can control whether or not it resets the state for you.

All that said, you can potentially save performance if you still do the state sets manually only when you actually do need to set them. You see, resetting takes the same time or more as setting.

Niko Suni

Thank you Sooooooooooooooooo much !!!
I DO Remember your advice.

SO thank you ^^;;;

This topic is closed to new replies.

Advertisement