Sphear Masked LUT

Hey. I was testing an idea I had where you switch LUT only in the area the sphere mask is while keeping the rest of the world/level without the LUT applied.

I’m still trying to find a way to do it. Would appreciate any help. I’m using a 1d LUT btw.

This is made in UE5 btw.

1 Like

The effect should basically look like this except the B&W area should have normal colors without the LUT.

The problem I am facing is that I can’t find a way to connect the SceneTexture:PostProcessInput0 node to a LUT texture and get the correct result.


This is the material for the image here

I add the LUT to the Color Grading LUT property

I tried this

But ofc it doesn’t work as the Scene has 3 color channels and the UV only takes in 2.

And what append if you make the scene texture a float2 ? If it doesn’t work you can still try using a lerp and using the scene texture as alpha but you will have less control and possibility.

If you make it a float2 you lose the color information from the excluded channel. For example, if we make it RG everything that is blue in the scene would be excluded from the LUT and looks weird.
Also, I can’t use the scene texture as alpha without getting some bugs as the scene texture is an RGBA texture, and I can use the lerp alpha with only one of the R, G, and B values from the scene texture, effectively losing data again.

I don’t now if this will help you or not, but I think this will be the only way to do what you want.



here is a forum about LUT in post process material. Access/Modify LUT in Post-Process Material? - #5 by grmtr - Rendering - Epic Developer Community Forums

1 Like

I managed to do color lerping. That one wasn’t an issue. But I wanted full controller over the color like with a LUT.

My current iteration looks like this and it’s ok for now. But it still lacks the full controller.
I know there are also some issues with LUT as they don’t work the same on HDR-enabled screens so maybe this current iteration will do fine as it shouldn’t have any issues with HDR.

I would still like to know if there is a way to get the LUT method working thou :smiley:

Hey, what do you think about doing something like that :

Masking 2 channels after desaturation should not isolate any of the colors since they all become identical during desaturation if that makes sense.

Here is the result I get:

Desaturate outside + Postprocess0 Inside

Desaturate outside + Postprocess0 → Desaturated → go into LUT

I think the variation we can see on the spheres is due to a difference in value, not color, otherwise one side would be clearly isolated like this:

I hope this helps :sweat_smile:

1 Like

I did try a similar approach. Instead of just using desaturate I divided the RGB by 3 to get grayscale values and then I added the channels together to get 1 grayscale value, but it didn’t work as the values weren’t correct.

I think the final result you got on the test still isn’t correct. You still exclude the information from the blue channel.

If my reasoning is correct then the red channel is a grayscale channel in itself that represents all the red color information of my scene, the same is true for the green and blue channels. So by excluding the blue channel I remove the blue information from the world as it’s stored as grayscale values in the texture in the first place. It’s the same thing when you look at such a texture in photoshop

Thank you for the effort. I appreciate it very much!

“I think the final result you got on the test still isn’t correct. You still exclude the information from the blue channel.”

The blue channel isn’t excluded, the blue cyan sphere become yellow with the LUT

Here is what the LUT looks like for a better understanding

image

Dividing by 3 and adding all the channels is close to what Desaturation node do but won’t be accurate since the node use Luminance Factors.

More specifically, the Desaturation node calculates the grayscale value of each pixel using the following formula: Grayscale Value = 0.3 * Red + 0.59 * Green + 0.11 * Blue .

image

3 Likes

Oh wow. I apologize. I didn’t notice that the blue ones still looked ok.
TBH I’m a bit confused now as to what the individual channels hold. How come the blue channel was preserved even with just the RG masked?

This is possible because we mask the blue channel only after the desaturation.
The desaturation convert the Red Green and Blue into grey.
Now all of the channels (Red Green and Blue) contain the same value.
In our case this is a float(3) so we mask one of the channel to obtain a float(2) to be used in UVs (could be any of them because once again, they are the same)

2 Likes

Thanks a lot. That has been very insightful. I wasn’t aware that desaturation works in that way.

re: desaturation converting all the channels into the same grey scale value, I also didn’t know this, great information in this thread, thanks @Borniol

1 Like