Download

How to clamp result of additive material to be between 0 - 1

I’m painting a black and white image into a render target. Later when I sample the render target I noticed the values where I paint a lot of white eventually add up into a value > 1, so it seems as I render, it eventually oversaturates to some value like 100.

Normally when sampling the render target I can clamp the value, but I was wondering if there’s a way to avoid writing values > 1 in the first place.

This also makes me think, so am I losing tons of color precision? I always assumed the texture was storing a value between 0-1 for each channel, using however many bits it has per channel, but if it’s actually going over 1, then the color info where it’s storing between 0-1 must be very imprecise.

Oh, wow I figured out my issue. My render target was set to RGBA16f by default. Using RGBA8 gives the behavior I expected of using 8 bits per channel to store between 0-1.