Rendering to texture2Darrays/texture3Ds

Hi everybody,

I’m back with a new question :
How would one render to a given slice in a texture2Darray / texture3D ? I see how it works for TextureCubes, but I can’t find the equivalent on these other “3d” texture types.

Any idea?

Also, what would be faster : a single huge Texture2D containing “quads” in it + an uniform “float2 offset” to determine where to fetch, or a texture2DArray/Texture3D with an uniform “sliceNumber” ? I guess that Texture2Ds might be better optimized, but I might be wrong. Plus huge Texture2Ds might not be supported everywhere…

Thanks in advance :slight_smile:

Oh, and another one :
Is there a trick in panda to handle simultaneous read/write access from a texture in a shader ?
So far, my solution was to copy the part of the texture I need into an other texture. It’s ok because I don’t use it often, but if there is a cleaner way, I’d love to know.

(The objective here is to create an atlas of textures inside a single big texture - Some of those textures may depend on the content from other textures of the atlas).


Hi Vash,

You are operating on the bleeding edge! Unfortunately, I have little direct experience with the texture array system, so I cannot answer your questions without research and experimentation, which you might be more prepared to do at the moment than I.

Let us know what you find!


Ok, I’ll look into it more deeply as soon as I have some time !

I’ve checked a bit for the opengl side of panda, and it seems that only TextureCube and Texture2D are handled for writing right now (in glGraphicsBuffer_src.cxx). But it seems that the only missing calls are the special cases for other texture types, which could be handled just like TextureCubes, via glFramebufferTexture3D.

I don’t know how many types of textures direct3d & opengl have, and how many of these are in common… I’ve seen a lot, some of which have a lot in common (texture2DArrays + Texture3Ds, Texture1DArrays + Texture2Ds, TextureCubeArrays, TextureRectangles, Texture2DMultisampleArrays, etc… x_x).
Most of them would not be used very much in an engine like panda though, and it could be a lot of (ungrateful) work to integrate them. The only one I see that’s really important and which covers a few missing functionalities for panda is the Texture3D, but I’m sure other people would need other types :stuck_out_tongue:

As soon as I have some time, I’ll try to add the texture3D to my build, and try it (adding the slice to write to in Texture.h and the call to glframebuffertexture3D should not take too long, hopefully).

As for my other issue (read/write concurrent access), it may not be possible for simple texture2Ds, but it might work for texture3Ds & arrays, since they’re not binded on the same place.