Point sprites + lighting = Good idea?
I'm developing a particle engine and I was wondering what kind of performance I would get if I lit particles using DirectX lighting. Is it even possible to light point sprites? How would you do the normals for them? If it would bring my framerate to a crawl, what could I do to get the particles to blend in with the environment? I mean if I shoot someone in the dark, his blood shouldn't be a bright red.
Another question. How should I handle particles that emit light, such as sparks? Should I make the base of the particle emitter be a positional light?
I would say.. If its a dark scene then make the blood dark using Color lerp (between red and black) and disable lighting for particles.. I always just use position colored for my point sprite particles.
For a particle that emits light, I would just fake it and use a texture with an alpha blended 'halo' around a bright center point.
For a particle that emits light, I would just fake it and use a texture with an alpha blended 'halo' around a bright center point.
Quote:Original post by MikeyO
I would say.. If its a dark scene then make the blood dark using Color lerp (between red and black) and disable lighting for particles.. I always just use position colored for my point sprite particles.
...
Difficult to get the lerp factor though because you'd be doing the calculations rather than D3D.
You could use Vector3.Subtract(lightPos, spritePosition).Length(), so the longer the vector, the darker it is, and visa versa.
Quote:Original post by MikeyO
You could use Vector3.Subtract(lightPos, spritePosition).Length(), so the longer the vector, the darker it is, and visa versa.
That would simulate a point light with linear falloff, yes.
The DirectX documentation gives (or certainly used to give) the lighting equations for spotlights etc and how they work in great detail.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement