-
-
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
WebGLRenderer.copyTextureToTexture3D() support Texture and CompressedTexture #21942
Conversation
a7cc089
to
00a18e2
Compare
00a18e2
to
1b23d11
Compare
@DavidPeicho Looks good? |
Sounds good to me! |
@DavidPeicho , thanks for your feedback |
I haven't. I use it for medical texture 3D and and most of the texture I use as sources are slices I generated. |
Maybe it should be discussed in another PR, but I find it weird that the UNPACK parameters come from the dstTexture rather than the srcTexture, especially for FLIPY. What do you think ? |
It's a bit of both to be honest. You need to unpack based on the source and dest texture. For the FLIP_Y that's a really good question, I am pretty sure the current version will fail with force instance if source is flipped and dest is flipped as well. |
I was wanting to propose either
(copyTextureToTexture and copyTextureToTexture3D are equally affected btw) |
Maybe let's open another issue for those concerns! I think if we change the current behavior we might break some code for people already expecting it to work in the way it currently is. |
Agreed, let's merge it now and open 2 follow up issues (one for unpacking parameters, notably FLIPY, one for compressed texture support). |
Thanks! |
Description
copyTextureToTexture3D currently assumes that
srcTexture
is aTHREE.DataTexture
.Bug
The bug may be reproduced using the webgl2_materials_texture2darray.html example of this PR against r128 or dev.
It fails because
srcTexture.image
isundefined
.Workaround
Without this PR, a
THREE.Texture
may be passed to copyTextureToTexture3D after the following workaround (so that it mimicks aTHREE.DataTexture
)texture.image.data = texture.image;
Fix
This PR enables passing a
THREE.Texture
or aTHREE.CompressedTexture
as a source to copyTextureToTexture3D using an approach similar to the implementation of copyTextureToTexture .It has not been thoroughly tested on compressed textures though.
Alternative/temporary fix
Change the docs to state that srcTexture should be a DataTexture rather than a Texture.
This contribution is funded by the ALEGORIA ANR project.