Texture Atlas Indexing with Texture

Started by
-1 comments, last by deftware 10 years, 6 months ago

I'm looking for any tips, pointers, resources, etc. concerning the use of a sort of atlas indexing texture, representing a scene for example, where each texel indicates a particular texture in an atlas texture... and doing this in OpenGL, using GLSL. I'm very familiar with GL itself, and have done a few neat things in GLSL, but consider my experience rather limited.

There are two ways that I see going about this. The index texture could either simply index the atlas one-dimensionally, with only one color component (unsigned byte), minimizing the index texture's size, which is ideal if it needs refreshing for animation or any sort of dynamic features. Translating the texel index byte into UV coordinates would be a simple affair carried out on the GPU. I'm unclear as to the method by which I could even access a texture (via sampler2/3D) as an unsigned integer value, as opposed to a floating point value from 0.0 to 1.0.. Sure I could multiply by 255, but is this necessary?

The other option would be to store the actual UV coordinates to the origin of an indexed texture contained in the atlas, which is (in my mind) a more CPU based approach. More bandwidth would be used transferring the atlas-indexing texture to the GPU for dynamic scene purposes, having more data, etc..

I'm just trying to figure a balance between simplicity and efficiency, and my lacking know-how with GLSL is limiting me to mere trial-and-error, but I figured I may as well try to look for any advice from more experienced GPU programmers on this.

Just a side note, the index texture itself would not be very large, smaller than a single 'tile' in the atlas. I was also wondering about utilizing a buffer texture object (http://www.opengl.org/wiki/Buffer_Texture), which seems to be better suited for what I'd like to accomplish here. The primary goal is minimizing the actual geometry being drawn to, ideally, a simple primitive with the index texture mapped to that the GPU utilizes to plot the various texture tiles from the atlas onto the primitive. So, each index texture texel would be a texture tile from the atlas.

Any advice, pointers, tips, links, etc.. are much appreciated. It may seem like I have it all figured out, but I really just have the jist of it down and would like some more detailed technical information about doing this sort of thing. Thanks.

This topic is closed to new replies.

Advertisement