Jump to content
  • Advertisement
Sign in to follow this  
MTclip

D3DXSPRITE lighting and shadows

This topic is 4883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

just wondering if anyone has or knows how to get lighting (say pointlight) to work with the D3DSPRITE.... ;P ????

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!