Skip to content

Added color correction using LUT texture to CameraFrame postprocessing #7720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented May 27, 2025

Fixes #4315

Added color lookup to CameraFrame postprocessing. Live preview: https://engine-pso3eqdcf-playcanvas.vercel.app/#/graphics/hdr

New API

    cameraFrame.colorLUT.texture = texture;
    cameraFrame.colorLUT.intensity = 1.0;

Texture is a common .cube format stored in a horizontal strip
lut-blue

There are multiple free online tools to convert to this format. I used https://www.color.io/free-online-lut-converter - loaded a cube file, and exported to Cube Strip 2D.

This is also exposed in the CameraFrame.mjs script, but at the moment does not parse correctly. @marklundin is investigating.

lut.mov

@willeastcott
Copy link
Contributor

Isn't this just a new tonemap type? Like, maybe, TONEMAP_LUT or TONEMAP_TEXTURE?

@mvaligursky
Copy link
Contributor Author

Isn't this just a new tonemap type? Like, maybe, TONEMAP_LUT or TONEMAP_TEXTURE?

Tone map converts HDR -> LDR. The look up works on LDR, so it cannot be used instead of tonemap, but along with it.

@mvaligursky mvaligursky self-assigned this May 27, 2025
@mvaligursky mvaligursky added area: graphics Graphics related issue enhancement labels May 27, 2025
@mvaligursky mvaligursky requested a review from a team May 27, 2025 12:53
@Maksims
Copy link
Collaborator

Maksims commented May 27, 2025

In the example, should the LUT texture filtering be set to "nearest"?

@mvaligursky
Copy link
Contributor Author

In the example, should the LUT texture filtering be set to "nearest"?

It needs to be linear, which it is. Otherwise you get banding due to relatively low resolution (32 pixels)

@mvaligursky
Copy link
Contributor Author

Script works now as well:

Screenshot 2025-05-27 at 15 09 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement color correction
4 participants