Sign in to follow this  
NightCabbage

2D Sprite Effects

Recommended Posts

NightCabbage    100
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
MJP    19753
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
NightCabbage    100
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
ValMan    466
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
ValMan    466
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

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