It is in a range from 0.2 to 0.5, how can I remap it properly to range from 0 to 1 in Shader’s code in a case when I don’t know min and max values of original texture?
I’ve already tried Smoothstep and other nodes, but still can’t find a solution.
Output
-EndValue as
(StartValue - (EndLow-StartLow))*(EndHeigh/(StartHeigh - (EndLow-StartLow)))
If you don’t know the low and high ranges of your texture, you should do a min-max loop over all the pixels. Just make sure you do it once during texture load or something, not every tick.
my solution is to just define the min/max grayscale values as material properties and then convert that range to 0-1 using this forumla:
.
texCol = (texCol - MinGrayScaleValue) / (MaxGrayScaleValue - MinGrayScaleValue);
I don’t think they have that kind of remap, but they do have lerp which is a 0 to 1 remap. So theoreticaly you can use two lerps, one for remapping original to 0to1 and another to remap it to your new range