Three.js: 3D Texture?

Created on 26 Jul 2012  路  7Comments  路  Source: mrdoob/three.js

Does Three.js support GL 3D textures? As in, something that somehow maps to the following in GL:

glGenTextures(1, &texname);
glBindTexture(GL_TEXTURE_3D, texname);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB8, WIDTH, HEIGHT, DEPTH, 0, GL_RGB, 
             GL_UNSIGNED_BYTE, texels);
Question

Most helpful comment

3D textures as well as the unsigned short type would be a great feature which is probably not difficult to implement. I absolutely vote for it! :)

All 7 comments

As far as I know, WebGL doesn't support 3D textures.

As of WebGL version 2, WebGL has 3D textures. Is three.js expanding to support new features in WebGL 2?

3D textures as well as the unsigned short type would be a great feature which is probably not difficult to implement. I absolutely vote for it! :)

Any news on this?

I can't help but notice that

https://github.com/mrdoob/three.js/blob/dev/examples/webgl2_materials_texture3d.html

exists but is undocumented. Is this because it is not ready to go and the API hasn't stabilized and shouldn't be used in production-ish code? Or because it just hasn't been documented?

r97 landed THREE.DataTexture3D which handles 3D Textures in systems that support WebGL2.

I prefer to wait a bit before documenting new classes to denote that they're not very mature yet.

Cool. It's working great for me, so I'm a happy camper.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fuzihaofzh picture fuzihaofzh  路  3Comments

konijn picture konijn  路  3Comments

jack-jun picture jack-jun  路  3Comments

yqrashawn picture yqrashawn  路  3Comments

scrubs picture scrubs  路  3Comments