-
-
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
Add support for compressed versions of DataTexture2DArray and DataTexture3D. #19676
Comments
@Mugen87 any suggestions how to start on this? |
I'm afraid I've never worked with this use case so far so I'm not sure about this. But probably providing texture data for testing is a good start. However, I'm not sure how such a provision would look like. Do existing texture compression formats support array of textures? Is it the task of a loader to provide an array of compressed textures? Or is this something the app has to compose? |
the idea is to use compressed Textures for a Terrain splat map discussed with @gkjohnson in gkjohnson/threejs-sandbox#9 |
using .basis texture compression with js Array on app Level |
How would it look like to compose multiple basis textures into a single |
Here's a demonstration of loading an existing texture as a texture2darray in the webgl2 samples repo: link. You can see that the jpg they load in is already composed of the three separate images that would correspond to each texture layer. In the example they write the image to a canvas and read the pixels back as uint8 array before uploading it but according to the docs for texImage3D it should work with a canvas or image element, as well, so it's not clear why they didn't upload the image directly. I would think a |
this is how it works now with uncompressed raw image data
_GetImageData i data is the raw image from a canvas |
Right so you can generate the uint8 buffer on the fly using the read pixels approach and use a |
lets see what @Mugen87 suggest. |
The KTX2 ( |
Hi everyone, any news here? As far as I understood, right now there's no way to initialize a DataTexture2DArray and add compressed textures in it on the fly, right? |
There is a I posted an example of how I used the capability here: https://twitter.com/garrettkjohnson/status/1458886350824894477 The |
@gkjohnson thanks for sharing your solution, it worked for me :) Unfortunately, this method looses compression in GPU, but I don't see any other solutions. At least I have an ability to load CompressedTextures to GPU quickly. |
|
@Mugen87 How to render I want to know if it's possible to access the decompressed textures by indices. |
@CITIZENDOT the built-in three.js materials do not use array textures. You would need to either use ShaderMaterial, or modify a shader with custom GLSL, when using an array texture. This example might be a helpful example of how to modify a material's shader (although it does not use array textures specifically). |
What's missing to close this issue? A Compressed3DTexture class? Somewhat related: |
AFAICT, yes. Compressed 3D textures can't be used yet since |
Would be nice to have a way for compressed 3D Textures and TextureArray for custom shaders.
Request is done after:
https://discourse.threejs.org/t/is-it-possible-to-have-a-texture-array-of-compressed-textures/16213
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: