Page 1 of 1

Brightness/contrast adjustment for sprites

PostPosted: Fri Apr 13, 2007 12:58 am
by d-soldier
Was just designing a level in lightwave and was trying to figure out how to make my character's brightness change as he passes under street lights (not transparency) but the color values... now I'm wondering if this is already featured through rgb values in the coding....

PostPosted: Fri Apr 13, 2007 2:12 am
by Fuzzy
The rgb act as multipliers. they range from 0-255. with r g and b all at 255 the sprite will be full bright. white will be white. if you had a white sprite and r g b were all at 127, the sprite would appear medium grey.

I dont believe that you can go any higher than 255 in them. It would be a nice feature though.

have the actor walk under another actor that looks like a pool of light. make it mostly transparent. That should tint or wash out the colors of the actor.

interesting.... RGB settings

PostPosted: Fri Apr 13, 2007 3:08 am
by d-soldier
... So if my player was (at default) full brightness, and I had areas scripted to lower the rgb values (areas outside the well lit zones) it would appear to make him darker as well? How would I script that regarding the player and regions (wirefram/filled)?

PostPosted: Fri Apr 13, 2007 4:06 am
by Fuzzy
On collision with the area, darken the player.r player.g and player.b

on collision end, set them back to 255.

PostPosted: Fri Apr 13, 2007 4:08 am
by Fuzzy
lovely scenery btw. you could also reduce computational needs by overlaying dark actors over the various dark areas, and making them somewhat tranparent.

in your rendering stage, make two images. in one, use the full lights everywhere. Full ambient light. in the second one, render with the lights. load as layers into photoshop or gimp and subtract the two. use the result as an alpha mask. samples to come.

Pardon the reversed order. its 3 2 1 and it should be 1 2 3.

Now the final image, Sample Negative as Alpha mask.png should be changed into an alpha mask and saved alone in an image. This will cast a shadow of greater or lesser depth over parts of the play area. Fine tune this with the actor tranparency control.

You may have to cut the image up depending on how the scenery lays, like if you need to walk in front or behind something.

if you dont know how to do that, let me know what application you use for modifying pixels, and I will tell you.

If you really want, I will do a demo.

hmmm....

PostPosted: Fri Apr 13, 2007 4:11 am
by d-soldier
Is there a way to make it a smoother tansition, rather then dark to light in a single frame (end of collision)? And thank you, Im much better at graphics then this programming stuff...
**EDIT:**
Fuzzy, you are the man... I've been playing with all this script stuff that I didn't even think of the graphical side of it... A PNG file that makes all the light atreas transparent, and set at a low to mid opactity, with a zdepth higher then everything else (player especially) would do the trick! A nice decent blurr would made the transitions from light to dark nice and smoothe. You are the man, another point to you!