Download

Issue with getting exact RGB from Texture.

Hello everyone, I have been attempting to segment specific values using custom stencil depth via Post Processing. Everything seems to be working great until we hit a huge roadbump of the colors being slightly off by 1 or 2 in the RGB values OR being exact but to the wrong value… (yes i know that sounds weird but let me explain)

Current attempts:

  1. My first attempts was with replacing the tonemapper and using Linear colors and plugging it directly, but failed as it appeared darker than the true color.

Attempt to solve : I attempted to solve this by doing pow(col, 1/2.2) but doing this did not solve the issue as it was off by some small values in RGB

  1. My next attempt was to just have it set to as sRGB instead and try to get the value, but it ended up being exactly like the previous attempt where the color was off and needed adjustment but again was off by some small value.

( image of the material setup is called Seg-Mat-BP.PNG )

NOW HERE!! is where it gets INTERESTING…

  1. When i import a non-HDR texture ( B8G8R8A8 format ) PNG file and set it as HDR it will add like a saturation to the color of the texture, seeing this made me want to not even bother but i did it anyways… when i directly input it into the material, and i test it, it gives me the wrong RGB of the true original color BUT… it gives the exact same value as the HDR image (after saturation) which confused me but I saw some potential here.

Attempt to solve: So a lightbulb lit over my head, if it works with a PNG file converted into HDR but causes it to have saturation, why not make a HDR image with the true colors already set, that way there will be no saturation included. Well… After doing that and setting it with the same exact settings as the previous image… it gives me wrong values by 1 or 2. After looking into any difference between the HDR and the PNG file, the only differance I can think of is the file format. So thats quite confusing for me as why does Unreal show perfectly the values of a PNG file converted into a HDR… but not a HDR file that was imported and used, unless it is reading/writing HDR files differently?

I have attached images for reference and below is a link to a basic project with the base segmentation setup.

Any help is appreciated.

https://drive.google.com/file/d/1LLKj0HwrwH2r-XavVYNsUlr_r3NVvqU1/view?usp=sharing