Jump to content
  • Advertisement
Sign in to follow this  
GameFissure

Sprite Brightning

This topic is 3621 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiya guys the names Fissure and well this is my first thread post :), I'm here to ask a little about how to brighten sprites up in certain areas... or atleast I think that's what I want. Anyways here's the story, I was playing a game called BEUNet and realised that when bullets hit the walls the walls and the area would go bright for a short while and back to normal. I suppose its possible that the author/programmer uses another sprite but I just can't be sure. Other random quesitons related to sprites which will help me and people looking for some general answers: - Does anyone here know of any program that's able to create tiles of bitmaps for your sprite animations? For example if you want to have a rolling ball(sprite), that would require something like 10 pictures of a ball at different rotations, it would be better to have them all on one bitmap file rather than 10 just because it saves memory and generally is more efficient. Some details about my computer/setup which may be of interest: - OS = Windows XP(Service Pack 3) - Programming language = C++ - Game programming API = DirectX 9 - IDE = Microsoft Visual Studio 2008 Only for my first post - Some habits I have that you might want to note(doubt it :)): - On every thread that I post I will usually ask you guys general questions so that people that want some quick answers can quickly search over the forum and hopefully find, most of the time they will probably help me to, haha, so if you have the time please try to answer those to. Thanks a lot, Fissure.

Share this post


Link to post
Share on other sites
Advertisement
You'll definitely want to pack as many things onto a texture page as you can. Each draw call has lots of overhead, and having to change textures means having to separate things into their own draw calls.

A couple ways to brighten:

When drawing a sprite, mixing with a color > 128, and use COLOROP MODULATE2X, or a pixel shader that multiplies by a color > 1.0f. This will brighten the whole sprite, so isn't likely what you want. Still a good thing to know.

Additive: Draw a small gradient sphere texture going from black to a dark grey. Draw this with additive blending (ALPHABLENDENABLE=TRUE, SRCBLEND=ONE, DESTBLEND=ONE, BLENDOP=ADD).

Multiply: (usually better) Draw a small gradient sphere texture going from a background of 128 to a grey value somewhere above 128 (the larger the brighter). Draw this with blending that mimics modulate2x (ALPHABLENDENABLE=TRUE, SRCBLEND=DESTCOLOR, DESTBLEND=SRCCOLOR, BLENDOP=ADD).

Additive will just add. Blacks will become brighter.
Multiply will multiply by a value, keeping blacks black.

Share this post


Link to post
Share on other sites
a simple way to brighten a sprite if oyu're using the Sprite interface would be to use a color slightly darker than white in a normal Draw() call, then make hte color fully white when it needs to be

Share this post


Link to post
Share on other sites
I think the best way to do it would be to just use another sprite that does precisely what 'godsenddeath' said, but that's mainly just because I don't know how to mix colours or use pixel shaders with sprites.

Although I've been doing programming with DirectX for a couple of years I still don't know to much mainly due to the fact that I'm still in school... its hard to find the time.

I didn't even know that you could use a pixel shader with sprites.

I think I'm too much of a begginer still... I'm going to go online and look for some tutorials that focus on sprites. If you guys have any, please post.

Thanks,
Fissure.

Share this post


Link to post
Share on other sites
Well I've spent so much time programming but still this is the best I could come up with... -> http://rapidshare.com/files/181847831/cube_blade.rar.html

It might work... it might not, but that would be what my 1 and a half years of experience conjured up.

If it works for you please comment.

Thanks again,
Fissure.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!