D3D Sprite question

Started by
1 comment, last by jharkey 21 years, 3 months ago
hello, i have recently decided to learn how to do 2d in d3d. i purchased the book by Ernest Pazera "Focus on 2d in Direct3d". i have just completed the book once thru. i usually just read it once, and then go back and STUDY when im done. it all seems rather good and easy. then i was looking at the dx9 docs and found the Sprite class(im using c#). it looks like it is really usefull too. i was wondering what the sprite class cant do that can be done other ways. i saw it can rotate and scale. then i noticed it had an alpha property, which the docs really dont explain. is this for alpha blending, or alpha testing? can you still use alpha blending, z buffering, and other cool stuff like that when using the sprite class? one more question. i dont understand what vertex shaders and pixel shaders are. can somebody give me a quick defintion on them, and maybe a game example that might have used them? im just curious about them. thanks in advance.
Advertisement
cant anyone help me?
The sprite class is fine for using and supports the features you''d expect from 3d hardware(alpha blending/testing, rotation, scaling). You can make one yourself that can outperform it though for your specific purposes. I went from 1.6 ms/frame with sprite class to .8 ms/frame with my own in a situation with several hundred tiles parallax scrolling (the times refer to just the tiles blitting not presenting the scene.. that still is stuck on my refresh rate). The alpha in the sprite class draw function is for blending but you ca set the colourkey for alphatesting when you load the texture.

Vertex and Pixel shaders are just steps in the process that take your 3D vertices and textures and display them 2d on the screen. The vertex shader handles how these vertices are handled and the pixel shader how the textures are rasterised. Usually these are fixed functions that are the default when you apply your transformations and render the scene. However, with DX 8 & 9 you ca write your own to achieve various effects like waves, muscles, and custom light mapping and blending. (I realise for all those lurking in the forums that this is an over simplified explaination).

This topic is closed to new replies.

Advertisement