Sign in to follow this  
Lloyd040690

Darker DirectX point sprites(C++)

Recommended Posts

Lloyd040690    105
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?

Share this post


Link to post
Share on other sites
ryan mccabe    161
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.

Share this post


Link to post
Share on other sites
Lloyd040690    105
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.

Share this post


Link to post
Share on other sites
Lloyd040690    105
[img]http://i.imgur.com/bm4Eq.png[/img]
This is my particle editor environment, and as you can see the particles blend to the gray background.

[img]http://i.imgur.com/zxC9H.png[/img]

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:
[img]http://i.imgur.com/nS29H.png[/img]

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

Share this post


Link to post
Share on other sites
ryan mccabe    161
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 [url="http://documentation.apple.com/en/motion/usermanual/Art/S09/S0944_AddBlendPre.png"]additive blend[/url]. 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 [url="http://blogs.msdn.com/b/shawnhar/archive/2010/03/22/point-sprites-in-xna-game-studio-4-0.aspx#10115629"]link[/url] talks about using indexed triangles. It mean reworking your system but it would give you more control I would think

Share this post


Link to post
Share on other sites
kdmiller3    178
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).

Share this post


Link to post
Share on other sites
ryan mccabe    161
msdn has some [url="http://msdn.microsoft.com/en-us/library/bb313867(v=xnagamestudio.10).aspx"]guides[/url], 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 [url="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.blend(v=xnagamestudio.10).aspx"]here[/url]. and there is another important feature [url="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.renderstate_members(v=xnagamestudio.10).aspx"]here[/url] which shows you what you can do with your renderstate. Sorry its not a guide but its all the info you could need :)

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