Jump to content
  • Advertisement
Sign in to follow this  
mlt

"clip" high intensities?

This topic is 3543 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

In a fragment program I blend the light with a texture: color.rgb = surface*light; But I would like to avoid getting white spots. Is there someway to make the highest intensities less intensive without make the darker even darker?

Share this post


Link to post
Share on other sites
Advertisement
this is probably the easiest way, it's not pretty but easy
color.rgb = surface*light;
color.rgb =min(color.rgb,0.7)+(max(0,color.rgb-0.7)/2);

the correct way is to use a curve to transform the color just like in photoshop.

Share this post


Link to post
Share on other sites
any way you want it, can be done of course.
avoid white spots = avoid color = {1,1,1,(1)}, so simply put in max(,,)/clamp(,,) like overlord suggests.

But if you're talking light intensity and such, you need to define more precise what you want to be doing.
if 'light' in your calculation is single valued, it could be/is an intensity value, scaling the product of surface and fragment color.
This way, white is only reached when both color and surface-color product to 1 or more in each component.
if it is a vector, a light color, white is reached only when the light color is white.
surface can also be seen as single valued, some scalar for the light intensity/color, and in this view, white spots can only occur when this surface scalar allows it.
so you see, even this 'simple' formula can be interpreted many ways and needs to be way more precise in order to simply 'avoid whitespots'.
simply maxing away color={1,1,1,1} does do what you ask, but I doubt that it is what you want.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!