# Darkening an image in Real-Time.

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

## Recommended Posts

I'm having difficulties with my Day/Night rendering. Currently I simply subtract a multiple of 50 from Red,Green, and Blue to make the scene darker, however, this isn't working to well. [rolleyes] Given an RGB structure, whats the best (easy + good looking) way to darken it?

##### Share on other sites
Normally that'd be done with modulation (multiply everything by 0.5) rather than subtraction. For really good results, you'd probably do gamma correction, but modulation will work fine for most purposes.

##### Share on other sites
Quote:
 Original post by SneftelNormally that'd be done with modulation (multiply everything by 0.5) rather than subtraction. For really good results, you'd probably do gamma correction, but modulation will work fine for most purposes.

[embarrass]

Thanks~
ratings++;

##### Share on other sites
Also, for a night effect have the blue factor slightly higher than red and green.

##### Share on other sites
And don't fall for the for some reason sometimes made assumption that *.75 is undone by doing *1.25 later on. Just saying.

##### Share on other sites
Quote:
 Original post by TriencoAnd don't fall for the for some reason sometimes made assumption that *.75 is undone by doing *1.25 later on. Just saying.

Multiplying by 0.75 is undone by doing exactly the inverse, dividing by 0.75.
If you want to use multiplies instead of divides to get the original value, then it is done by multipliying by (1.0 / 0.75 ) which is 1.33333

##### Share on other sites
just pointing out the obvious, but you should probably keep two images if you're going to be doing a lot of multiplication on them, otherwise the image would deteriate over time by repeated multiplies. make sure you have one image that retains it's original values, and always use that to do the transformations on.

Tim

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 11
• 28
• 15
• 39
• ### Forum Statistics

• Total Topics
634837
• Total Posts
3019545
×