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

EXRExporter: initial version #23541

Merged
merged 4 commits into from
Feb 22, 2022
Merged

EXRExporter: initial version #23541

merged 4 commits into from
Feb 22, 2022

Conversation

sciecode
Copy link
Contributor

@sciecode sciecode commented Feb 20, 2022

Rebase of #19764

Initial PR with basic functionalities adjusted & proper support for HalfFloatType and FloatType renderTargets.

Removed encoding workarounds, as only LinearEncoding is expected.


Usage Example

import { EXRExporter } from './jsm/exporters/EXRExporter.js';

function downloadEXR( buffer ) {
   const blob = new Blob([buffer.buffer], {type: "image/x-exr"}),
   const url = window.URL.createObjectURL(blob);
   const a = document.createElement("a");
   a.href = url;
   a.style = "display: none";
   a.download = 'render.exr';
   document.body.appendChild(a);
   a.click();
   window.URL.revokeObjectURL(url);
};

...

const exporter = new EXRExporter();
downloadEXR( exporter.parse( renderer, renderTarget ) ); //sync - because readPixels async not yet available.

if there isn't any API changes suggested, should be ready to merge.

Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>
Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>
Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>
Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>
@WestLangley
Copy link
Collaborator

Great! I Successfully used this to export a computed PMREM to .exr format, and then reload the exported PMREM as a CubeUV environment map.

Thing is, I would have expected an EXR exporter to take as an argument a data texture -- not a render target. 🤔

@WestLangley WestLangley added this to the r138 milestone Feb 21, 2022
@sciecode
Copy link
Contributor Author

Great! I Successfully used this to export a computed PMREM to .exr format, and then reload the exported PMREM as a CubeUV environment map.

Thing is, I would have expected an EXR exporter to take as an argument a data texture -- not a render target. 🤔

I'm sure we can do both 😄

Will implement method for dealing with DataTexture API on future PR. Users will just need to be careful about supplying HalfFloat pixel as Uint16Array. But the same would be needed for WebGL side, so no big surprise there.

@mrdoob mrdoob merged commit 5d351ce into mrdoob:dev Feb 22, 2022
@mrdoob
Copy link
Owner

mrdoob commented Feb 22, 2022

Thanks!

@sciecode sciecode deleted the dev-exrexporter branch February 23, 2022 00:12
@joshuaellis joshuaellis mentioned this pull request Mar 1, 2022
16 tasks
donmccurdy pushed a commit to donmccurdy/three.js that referenced this pull request Mar 10, 2022
* EXRExporter: initial version

Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>

* clean up

Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>

* EXRExporter: code style

Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>

* EXRExporter: minor fixes

Signed-off-by: Guilherme Avila <guilhermebav@gmail.com>
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

4 participants