ID3DXSprite - Z order - HELP!!!

Started by
1 comment, last by stevenmarky 22 years, 2 months ago
I am currently making an engine for a isometric game, using ID3DXSprite. Is there a easy way to specify the order of draw, since it is using 3d hardware is there a way for some sprites to be closer to the screen, and some further away? (Z ordering).Im not a 3D programmer but I know the one of the functions (DrawTransform) of D3DX Sprite takes a matrix as a parameter (and you use matrices to change things in 3d space) - can I use this to control Z ordering? It would save a lot of time. Thanks, Steven R Edited by - stevenmarky on February 1, 2002 6:06:25 PM
Advertisement
Im not a 2D programmer like you are not a 3D programmer , but can''t you implement a virtual Z-Order, hence on render you would render in this specific order? Every object doesnt need a unique z-order.

-------
Happy Coding!
Homepage: www.pcwebvia.f2s.com CVS1.0 will be released soon here.
www.bytamin-c.com
-------Homepage: http://www.pclx.com
You are right, every object doesnt need a specific z order, but the game will be isometric and several layers of tiles will have the same z order, but there are obejcts, special effects chacracters, monsters some in front of the other - the easiest way would be to specify a z value for a object, lukily I have found this on gamasutra:

Finally, for those wishing to go one step further, and maybe even dip your toes into 3D waters, the ID3DXSprite interfaces offer an alternate version of the Draw() function, called DrawTransform(). Instead of taking scaling, rotation, and translation (positioning) information, the DrawTransform() function takes a transformation matrix, which defines the geometrical transformations for every pixel using a 4x4 matrix. Using this you gain access to effects involving the Z-axis, meaning distances closer to or farther from the viewer. A popular effect is perspective, which would give your image the impression of receding into the distance. The use of transformation matrices is far beyond the scope of this article, but for those interested you can start with "About 3-D Transformations" in the DirectX 8 SDK and go from there. Be prepared to dig out your old math textbooks.


Now all I need to work out is how to put things in front out of the other (z-order) so they dont get bigger, or are affected by perspective!!
Has anyone used this method before?

This topic is closed to new replies.

Advertisement