PDA

View Full Version : Subtexture Tiling: Possible?



Melekor
05-28-2005, 03:46 PM
I made a packed texture system that packs tons of small (usually non power of two) textures into one large texture. Up till now, this has worked fine because I haven't needed tiling textures. Now that I do though, I can't figure out how to make it work without subdividing my polygons, which would be more trouble than it's worth.

So basically, what I'm looking for is something that will let me GL_REPEAT texture coordinates within a subrectangle of the whole texture. I know there's no standard mechanism for this(or if there is, then I'm blind), but is it possible at all through some kind of clever trick?

I've got my fingers crossed that one of you gurus out there knows a solution :)

Cheers,
Melekor

dorbie
05-28-2005, 07:01 PM
AFAIK you can't do this, you need a texture to be the only texture on any axis you need to tile on.

ZbuffeR
05-28-2005, 10:46 PM
Or a pixel shader so that you can wrap coordinates yourself ?

dorbie
05-29-2005, 01:04 AM
Good luck with the filtering on that :-)

You'd need to pad with a repeat border inside your tile and MIPmaps would make it impossible as resolution got low.

Melekor
05-29-2005, 10:51 AM
Thanks for the replies guys. I don't need MIP mapping, so ZbuffeR's idea sounds like it could work for me. Of course, I would prefer a non pixel shaders solution, but if there isn't one then it will have to do. I still believe that it would be a great advantage to use the packed texture system.

ZbuffeR, can you explain a bit how your idea works? (or simply point me in the right direction) I have zero experience with pixel shaders right now. I'll finally be getting a card with pixel shaders in about 2 weeks if everything goes according to plan.