Jump to content
  • Advertisement
Sign in to follow this  
NightCabbage

2D Sprite Effects

This topic is 3890 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

Ok, I'd like your advice. I'm working with 2d sprites. But I need to do normal mapping, etc. with them (bump mapping). Like this: http://www.ziggyware.com/readarticle.php?article_id=137 That tutorial is done in XNA, and it uses effects. I'm using C++, and unmanaged DX9. Can this be done using ID3DXSprite? Or is it better done using quads? eg. I'm going to be doing lighting effects - but not actual lighting like in a 3d game... lighting as in bump mapping to simulate real lighting :) Also, how can it be done without using effects? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
AFAIK the situation for ID3DXSprite is the same as it as for the SpriteBatch class in XNA: the sprites used pre-transformed vertices, so you can't use a vertex shader.

If you want to use specialized effects with 2D sprites, you're probably better off creating your own sprite-drawing mechanism that's designed to be used with shaders.

Share this post


Link to post
Share on other sites
Hmmmm...

That link I posted uses XNA and SpriteBatch - and still does the effects.

(there's another one here - same sorta thing, cats included :)

http://creators.xna.com/Headlines/developmentaspx/archive/2007/01/01/Sprite-Effects-Sample.aspx

Apparently it just uses the pixel shader, but not the vertex shader.

But then I have no real idea yet.

Share this post


Link to post
Share on other sites
You should be able to do normal mapping with D3DXSprite, because shaders work just fine. Download a sample project if you want (D3D9, C++): http://www.hitman2d.com/downloads/misc/shader.zip

Share this post


Link to post
Share on other sites
:O

That demo uses the same kind of fx file as in XNA!

I thought that was a special XNA thing?

LOL

So will any effect file from XNA work with DX9?

(and it's just a file with some HLSL in it?)

Share this post


Link to post
Share on other sites
You need to add some Research & Development to your development schedule :)

FX file is handled largely by the D3DX library, a part of (or, rather, an add-on to) Direct3D. It provides an easy and efficient way to use vertex and pixel shaders, written in HLSL and compiled for shader model 2.0. You can't use vertex shaders with D3DXSprite, but pixel shaders are fine.

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!