Question

I need help with CG fragment shaders. I have one big texture which holds all the tiles. I really don't know where to start with this one.

Now when quad/sprite goes over certain size i would need to repeat texture as it was one single texture.

Was it helpful?

Solution

0Matthias Wloka wrote a white paper on this topic when he was at NVIDIA:

https://developer.nvidia.com/sites/default/files/akamai/tools/files/Texture_Atlas_Whitepaper.pdf

It describes retrieval methods and contains some useful cautionary info about filtering/mip-levels

At its simplest, imagine that you have two textures side-by-side in an atlas.

Instead of reading tex2D(sampler,UV) for the first texture, you would do something like tex2D(sampler,float2(frac(2.0*UV.x),UV.y))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top