How Can I Clamp Render Target Values

I’m trying to make a painting tool in a similar way that the Render Target examples has a height map tool. Everything is working fine until I try to erase. I pass a negative value into the power and clamp the output before adding it to my material. This allows me to have 0-1 values and the paint is essentially masked. The problem is that the texture still has larger and smaller values so you can erase a spot multiple times and essentially prevents painting until you get it above that 0 value again. Likewise, painting the same place causes values greater than 1 (making erasing have no effect until reduced bellow 1).

To solve this, I need to take my additive material and add it to the render target then clamp those values after that. I was hoping someone could point me in the direction of where I could do this. If it requires some C++ that’s fine as well.

I came to the same conclusion (with your helpt actually) but even setting it to RTF_R8 didn’t work.

Correct way would be using appropriate render target format, designed to store values in 0-1 range.

1 Like