# "clip" high intensities?

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

## 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 on other sites
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 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.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
15
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013645
×