I am wondering if there is some way to repeat parts of a texture. For example, let’s say I have a scene with floor and walls, where both use their own repeated texture patterns. Is it possible to combine these two textures into one (meaning just one texture bind) and still repeat individually?
It would be extremely difficult to make it work correctly in a fragment shader, because of the corner cases, when the fragment is between the two edge texels on the opposite side. The problem is that you have no control over subpixel texel sampling at the borders. I mean on the edge, the sampler will sample the next pixel, not the one at the other side of the tile. You would have to switch to nearest filtering, sample the two sides separately, and then interpolate yourself. And then I didn’t even mention handling mipmaps!!
It can be done, but you’ll need the GL_ATI_shader_texture_lod extension if you need it to work with mipmaps. To solve the edge problem you can pad each subtexture with its edge pixels. You’ll still get problems with mipmap selection at edges. For this reason you need to compute the gradients before the frac() function, then use the texture2D_ATI() function to sample the texture with these gradients in the end. That will solve the mipmap selection problem that would otherwise occur when the texture coordinates wrap around.
or u could simply use 2 different sets of texture coordinates
wait i didnt see the word parts, by parts do u mean a subregion of the texture, if so ignore what i said.