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

DataUtils: Add toRGB9E5() and fromRGB9E5(). #28012

Merged
merged 2 commits into from Mar 28, 2024
Merged

DataUtils: Add toRGB9E5() and fromRGB9E5(). #28012

merged 2 commits into from Mar 28, 2024

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Mar 27, 2024

Related issue: #27992

Description

This PR adds two helper methods to DataUtils for packing/unpacking floating point values in context of RGB9E5. The code is based on the C implementation of https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_shared_exponent.txt.

I have tested the change with a modified version of RGBELoader and webgl_loader_texture_hdr. I did not add these changes to this PR since RGBELoader might not be the best spot for using RGB9E5. That's because RGB9E5 is not a color renderable format so we can't convert a RGB9E5 equirectangular environment map to a RGB9E5 cube map. This is required though since we don't support equirectangular textures in the shaders. If we switch to half float in the conversion process, it would not make sense to use RGB9E5 in the first place. The same issue exists with PMREM as well.

As pointed out in #27971, WEBGL_render_shared_exponent is required to make RGB9E5 color renderable but browser/device support for that isn't great right now.

Copy link

github-actions bot commented Mar 27, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
671.2 kB (166.4 kB) 671.7 kB (166.7 kB) +507 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
451.1 kB (109 kB) 451.1 kB (109 kB) +0 B

@Mugen87 Mugen87 added this to the r163 milestone Mar 28, 2024
@Mugen87 Mugen87 merged commit a03a74a into mrdoob:dev Mar 28, 2024
12 checks passed
mrdoob added a commit that referenced this pull request Mar 29, 2024
mrdoob added a commit that referenced this pull request Mar 29, 2024
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.

None yet

2 participants