2D Sprite Effects

Started by
4 comments, last by ValMan 16 years, 4 months ago
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!
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.
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.
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
: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?)
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.

This topic is closed to new replies.

Advertisement