Darker DirectX point sprites(C++)

Started by
6 comments, last by ryan mccabe 13 years ago
So, as per the usual issue with sprites, mine has to do with alpha. My particles blend fine, just as they should be doing. My problem is though, I want to make them darker. As is, the particles blend to whatever is behind them, but this often times gives them a very light color, and in my situation this is not exactly favorable. It's not to do with blend modes either, as I've tried all 225 possible source/dest blend mode combinations available. When multiple particles of the same color are drawn over themselves and blends to itself the resulting blend is then a darker color, which is favorable, but I want this effect on individual sprites, not have to draw 4 as one, just to get the result I want.

I guess I could set up a pixel shader and tweak the values as I see fit with a passed in float, but before i ventured on that endeavor I wanted to know if there was a simpler method that I've yet to find or may have over looked.

Any Ideas?
Advertisement
Couldn't just have a darker sprite asset instead of trying to photoshop your current one in game, since you want the effect on individual sprites? Conditionally switch to it when needed. Maybe I'm misunderstanding what you want though.
Well, the darker the color of the sprite, the less of the diffuse color it uses, the whiter the color, the more of the diffuse color it uses, I'll get a screenshot for an example.
bm4Eq.png
This is my particle editor environment, and as you can see the particles blend to the gray background.

zxC9H.png

Now this is my particle editor, with a black clear color, and you can see when the particles blend down to the black, they're darker (for obvious reasons)


Edit: This is all done with this image:
nS29H.png

What I want is for me to be able to get that darker particle color w/o worrying about the color that's directly behind the particle. I do want the back color to be blended to, but i want a way to make the particle color darker.
Let me know if I'm not making any sense
I don't know the specifics of point lights, however when your point blends its taking the diffuse and using it as its own saturation value (the 50% grey shot has sprites with 50% saturation and the black has 100% saturation sprites). To maintain full saturation you cannot blend in a way that acts as a transparency, or this will happen. What I'm thinking though is that what you want is to have them not blend at all or to have them only blend in hues. If so, try setting . The most important thing to see is the they aren't darker, but they are more saturated in the second picture.

After a bit more poking into point sprites: turn alpha blending off, or if possible leave it on but set it up to not function as an additive blend. Additive blending will move the colour to a less saturated value until it is white as it blends with other values, as you have seen in the first shot.

Edit: point sprites are no longer supported in dx10 & 11. This link talks about using indexed triangles. It mean reworking your system but it would give you more control I would think
You can't, by chance, point me in the direction of a good tutorial to disable additive blending?
It looks like you're using additive blending, which tends to give things a luminous, insubstantial look. If you make a white texture with the fuzzy blob as the alpha channel, you can get more consistent results by drawing it with conventional alpha-blending (SRCALPHA / INVSRCALPHA).
msdn has some guides, but they look like they are for XNA. Anyway the msdn site in the link shows you how to set up addative blending, however, if you poke around in the varibles that make it addative, you should be able to switch it to something else. source and destination blend types here. and there is another important feature here which shows you what you can do with your renderstate. Sorry its not a guide but its all the info you could need :)

This topic is closed to new replies.

Advertisement