-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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 RGBM texture example #16432
Added RGBM texture example #16432
Conversation
Yeah, that'd help. I have yet to understand how to do it though. |
According to @bhouston #10652 (comment):
I also have yet to understand how that works though. As far as I can see RGBE -> RGBM16 is the most important of these conversions. Perhaps we could add an example showing how to do that? |
One can set the encoding on a texture, and then set it to one of a select map inputs on material: map, envMap, mapCap, emissive. During shader creation it will check for the encoding of that texture map and auto-decode from its encoding to linear: three.js/src/renderers/webgl/WebGLPrograms.js Line 142 in f186b20
There is also the concept of the output texture. Normally it is just a simplfed gammaOutput, but if you are writing to a render target texture, it will read the encoding of that texture and use that to encode the linear result into the output encoding. three.js/src/renderers/webgl/WebGLPrograms.js Line 140 in f186b20
Thus all transcoding of texture formats is done automatically by the program compiler via code injection. The injectors are here: three.js/src/renderers/webgl/WebGLProgram.js Lines 509 to 514 in 1bb851f
|
I was referring to converting the file memorial.hdr to a PNG-formatted file with RGBM encoding. |
@bhouston Sweet! It works perfectly. Thanks! |
@bhouston Since that image is so transparent as a PNG, What utility did you use to convert that file? |
Unfortunately some closed source code in clara.io. But given that Three.JS has an exr and an hdr loader and the ability to save the render buffer as an image writing a generic conversion tool that can import these and save to any of our supported encodings isn't a lot of work -- it could be a new three.js example. |
Thanks! |
Yes, that's what I was suggesting here. It's great to have the ability to use RGBM16 textures, but I have yet to find any DCC tools that can create them. On the other hand, there's loads of free .HDR textures available, and they are relatively easy to create. If we had an example where users can drag and drop .HDR textures and get RGBM16 pngs out, that would make this feature useful to a lot more people. |
@mrdoob Since this PR replaces |
Perhaps you could modify this IBL converter (MIT) https://github.com/oframe/ibl-converter It has quite a nice drag and drop interface: https://oframe.github.io/ibl-converter/ |
As suggested in #16420 (comment).
Maybe we can convert
memorial.hdr
to RGBM16... EDIT: Done! Thanks @bhouston