Skip to content
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

Added LogLuvLoader. #22857

Merged
merged 3 commits into from
Nov 23, 2021
Merged

Added LogLuvLoader. #22857

merged 3 commits into from
Nov 23, 2021

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Nov 17, 2021

Related issue: #22757

Description

This PR introduces LogLuvLoader which allows to load HDR images in the LogLuv TIFF format.

The code uses parts of UTIF for parsing TIFF images and a custom toRGBA() method to extract HDR texels in linear RGB color space. The default texture type is half float. Using single precision float is supported.

@mrdoob
Copy link
Owner

mrdoob commented Nov 17, 2021

Nice! Seems like the best way to compare them is to put the slider at 0.02. Logluv seems are nice looking as hdr but a bit more orangy.

@mrdoob mrdoob added this to the r135 milestone Nov 17, 2021
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 17, 2021

BTW: Depending on the feedback in #22757 (comment) I'll change the RGB color conversion matrix which will lead to a slight hue shift.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 17, 2021

Using the matrix from the respective paper for now: http://www.anyhere.com/gward/papers/jgtpap1.pdf

@mrdoob
Copy link
Owner

mrdoob commented Nov 18, 2021

Now it looks kind of pale... Is that normal?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 18, 2021

TBH, I'm not yet 100% sure which color conversion matrix is the correct one. But according to the paper and UTIF.jss implementation it is the CIE RGB matrix. Let's wait with a merge until this detail is clear...

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 18, 2021

Wait, the numbers in the matrix were not correct! Now it looks better and similar to our existing HDR examples:

https://raw.githack.com/Mugen87/three.js/251f8e1748ebbeabdca1ae17e35a286b6a5cc7f2/examples/webgl_loader_texture_logluv.html

@WestLangley
Copy link
Collaborator

WestLangley commented Nov 18, 2021

three.js does not currently handle color space accurately.

But, for the purpose of doing something reasonably-consistent, we can assume we want to convert to linear-sRGB color space -- i.e., the sRGB primaries and the D65 white point, without the gamma correction.

So, I would assume the correct matrix to use is the sRGB matrix.

The three.js working color space is implicitly linear-sRGB.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 18, 2021

I don't think this would be correct. Sticking to the specification of the paper produces the result I have originally expected (meaning a result comparable and consistent to other HDR loaders). Using the sRGB matrix produces a wrong hue shift.

@mrdoob
Copy link
Owner

mrdoob commented Nov 23, 2021

Sounds like this is good enough for now 😊

@mrdoob mrdoob merged commit d471257 into mrdoob:dev Nov 23, 2021
@mrdoob
Copy link
Owner

mrdoob commented Nov 23, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants