-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
GLTFExporter: export rendertarget #28653
base: dev
Are you sure you want to change the base?
GLTFExporter: export rendertarget #28653
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
const cube = new THREE.Mesh( new THREE.BoxGeometry( 200, 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xffffff, map: renderTexture.texture } ) ); | ||
scene1.add( cube ); | ||
|
||
}, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just some hacky test code of course.
const cube = new THREE.Mesh( new THREE.BoxGeometry( 200, 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xffffff, map: renderTexture.texture } ) ); | ||
scene1.add( cube ); | ||
|
||
}, 10) |
Check notice
Code scanning / CodeQL
Semicolon insertion Note
the enclosing function
|
||
const width = map.image.width; | ||
const height = map.image.height; | ||
const buffer = new Uint8Array(width * height * 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always assuming RGBA8
is not safe, see #28652 (comment).
Related issue: #28652
Description
Currently exporting a scene that has a WebGLRendertarget Texture on any object breaks export altogether.
This PR adds a reference to the original WebGLRenderTarget to the underlying textures - not sure if this coupling is something you'd consider keeping.
Perhaps the same could be done by a writer plugin - but I'm not sure how how to 1) either get a reference to the WebGLRenderTarget to be able to readback the pixels or 2) if there's a different preferred solution (e.g. blitting the render target to a new texture like with compressed textures)
This contribution is funded by Needle