So I want to apply color grading to my game and was thinking about performance implications for mobile. I basically have 2 questions -
A 3D LUT isn’t compatible with mobile right gles2.0 so i was thinking of using a 2D or 2.5D LUT. But I read that post processing is heavy on mobile especially because the tile based rendering. So I thought that shouldn’t I just add the LUT to every shader? would that be more performant than using a post processing effect LUT instead?
If I’m willing to trade the 3D ie 2/2.5D LUT for a 1D LUT which would give better performance obviously, but would it also give better performance as a post processing effect LUT or just adding it to every shader? (basically same as question 1 but using 1D LUT)
2D LUT isn’t that slow. I can run our color correction on an iPad 2 and Samsung Galaxy S6 (potentially even older devices, but I don’t have any that are still working to check out) with ease.
okay so technically there’s no 2D LUT. There’s 1D and 3D. However 3D LUT doesn’t work with mobile platforms so are you talking about 1D LUTs?
Also if you are indeed talking about 1D then I know it doesn’t use that kuch resources but I would still like to know if it’s better to add it to each shader or use as a seperate post effect?
By “2D LUT” usually that means a 3D LUT packed into a 2D texture, like you might see when you export or import a custom user LUT.
Like this:
Then you use a function that samples that 2D texture twice to emulate a filtered 3D texture sample. This function from Unity’s HDRP/URP post processing is a nice example implementation of that.
If you’re doing other post effects, doing LUT color correction in the final pass of your post effects is fast.
If color correction is the only post effect and by doing it in shader you have zero post fx then, maybe it’s worth it? I don’t think there are easy answers, you probably have to try it and see what happens on a low end device.
But as I said, it’s a non issue, since doing it in post is pretty fast anyway.
The most performant way to do it is as part of your object shader rather than as a post process. Just be mindful that it may not look as you expect on transparent objects as the color correction obviously is happening before blend.
On mobile VR this is basically the only option as any post processing is too expensive to do and still keep framerate (at least on the original Quest and earlier HMDs).
For a normal mobile game where you don’t need to be running at full resolution or extremely high frame rate, it’s totally fine to keep it as a post process.
The thing that’s expensive is running a second pass over the entire screen. Transparency is expensive on mobile, and post processing is equivalent to a full screen transparent surface. It can be significantly faster to run the same post processing code in the per object shader ok the final output color. Also avoids some precision issues.