So im using the DrawMaterialToRenderTarget function within the KismetRenderingLibrary and i’m going to be writing a constant negative value (-0.1f) to my RT
and i would like it to never drop below 0.
The reason i can’t just use the Clamp node within the material editor is because that acts as a “post process” (it’s a filter) and i need it to be “real” and actually edit the
RT itself so that each Texel is never below 0.
You can’t do that, but since textures can’t store negative values anyway (unless HDR (float), and even then I think they’re abs values only) it probably doesn’t matter. Why not just put a clamp node after the texture sample when you read from it? You can use ClampMin Only if you don’t know what the max value will be.
Also, although you’re writing -0.1f to it - that’s just going to draw -0.1f directly, it won’t subtract anything from the existing value if that’s what you want to do?
I’m looking into finding another solution to my problem by utilising “SetScalarParameterValue” which may end up being cheaper on performance but if anyone would like to post a solution
to my original question in case i or anyone needs to come back to it that would be great.
Setting a param (if you can do that) is definitely cheaper than using a render target. I may have misunderstood some parts of the question, what is it you’re trying to do exactly?
I’ve just tried to use scalar param and it worked but started to give me weird results which wasn’t good enough, I’m trying to draw to a render target and having the trail fade over time from oldest drawn to newest.
I did think of an alternative solution but it depended on the SetTextureParameterValue function which doesn’t seem to work? could be a bug or doesn’t work the way i think it does.
I’ve drawn a picture to hopefully better explain what i mean.