Sign in to follow this  
MTclip

D3DXSPRITE lighting and shadows

Recommended Posts

Guest Anonymous Poster
Well, since sprites are 2D images, you need to draw the lights and shadows in images. You could modulate a color parameter to get better results.

Share this post


Link to post
Share on other sites
As the AP indicated, D3DXSPRITE is just a wrapper for some 2D geometry - specifically the type of geometry that skips the Transform & Lighting stage of the graphics pipeline. As a consequence, any Direct3D-defined lights will be ignored.

If you want lighting/shadows, you'll have to manually calculate it yourself; it's not too difficult but it does require a fair bit of code on your part.

hth
Jack

Share this post


Link to post
Share on other sites
awesome that was the answer i was looking for......
so if i were to switch to quads.. would that allow me to do lighting

also.. do you know where i could find an explination of what i would have to do to calculate lighting... ive alread started my own light object just want to see how others implement it..


...;P

Share this post


Link to post
Share on other sites
Quote:
Original post by MTclip
awesome that was the answer i was looking for......
so if i were to switch to quads.. would that allow me to do lighting

Without having access to the D3DXSPRITE source code, I'd work on the assumption it is just a wrapper around some TL Quad's.

The bottom line is, any vertex data rendered with the D3DFVF_XYZRHW component in it's FVF will not get any lighting/transforms applied to it.

If you really wanted to use D3D/hardware lighting, you could set up an orthogonal projection matrix and use regular D3DFVF_XYZ geometry created on a given plane..

Quote:
Original post by MTclip
also.. do you know where i could find an explination of what i would have to do to calculate lighting... ive alread started my own light object just want to see how others implement it..

I can't think of any particularly good examples. The DXSDK help files have the lighting equations in the documentation somewhere, so you could copy those - all you need to do is process it for each/every vertex that you render. I did write an article on this for VB6 almost 5 years ago - you can read it here, but it's probably not the best resource you'll ever find [wink]

hth
Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this