PDA

View Full Version : texture atlas offset



ugluk
11-28-2010, 08:09 PM
Say we load up our favorite modeling program and texture some model and export it. But crafty as we are we combine the textures of the model into a texture atlas. The model's texture coordinates hence do not hold anymore. The only ways I see to fix them are:

a) fix the texture coordinates as the model is loaded, adding to model loading time,
b) translate the texture with a texture matrix.

Solution b) means a separate texture matrix needs to be uploaded either to the GL (fixed pipeline), or the shader, wasting some precious time. What is the preferred way to get around this texture coordinate problem? Which solution did you decide on in your code?

ugluk
11-28-2010, 08:19 PM
I see there is another solution:

c) write a tool that fixes the texture coordinates in the model, so neither runtime nor render time is consumed.

Ah well...

aqnuep
11-29-2010, 01:56 AM
I would stick to option a) if you want to keep your texture handling transparent. Of course, the most efficient would be option c) but then you cannot really reuse your model in another context.
It is up to you. Still, I would not go with plan b) because of its runtime overhead.