-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Allow for updating specific regions of a canvas texture instead of the entire texture #26190
Comments
See #26183 for texture performance |
Is that what you are looking for: https://threejs.org/examples/webgl_materials_texture_partialupdate |
Looks like it, I'll try and see if that resolves my issue |
For some reason I am having the hardest time getting I have verified that the destination texture, which I have loaded as an object URL pointing to a PNG blob, is drawing on the mesh. I am passing the Uint8ClampedArray fetched from a getImageData().data call on a canvas. I have verified that the extracted ImageData object is drawing correctly to a 2d canvas. Is there some weird scenario I'm missing that can cause
|
It does not look right to create a texture in the You probably want to ask for help at the forum first (https://discourse.threejs.org/). If it turns out to be a problem with the engine, we can reopen the issue. |
Description
If I add a CanvasTexture to an object in a scene, then set
needsUpdate
totrue
every frame, the render can crawl to a halt if the canvas texture is sufficiently large (say 6000 x 6000).I am trying to create a drawing brush and already have the necessary logic implemented for it to only update small square chunks of the canvas that the brush actually touched.
Solution
Provide a way to blit to a small portion of an existing canvas texture, so that it is much more performant than updating the entire texture.
Alternatives
For my specific use case, I can limit the CanvasTexture resolution to what texels are practically visible on-screen to create a "drawing preview" while the user is drawing. But when they lift up the brush, I'll still need to be able to update a full resolution version of the image which can take a long time. It's not ideal, especially when there are multiple brush strokes in quick succession.
Additional context
No response
The text was updated successfully, but these errors were encountered: