I am attempting to use 3D textures to texture my randomly generated terrain. I want to be able to have many different terrain textures that blend between different areas. I can't seem to figure out what part of the texture the R coordinate will pick up. If I set it to 0.0 then it gives a blend of the texture from before 1.0 and after 0.0. It seems to have a few points where it is not blending at all. How does the R coordinate(float) work with the depth of the 3D texture? (IE. depth divided by something multiplied by something etc.)
An example of what I need to figure this out for: I have a 3D texture that is a 128x512 image. The first 128x256 is the grass texture. The 2nd half is the dirt texture. I am treating the texture as if it is 4 128x128 tiles, so the depth is 4. What math do I do to find out the float R coordinate for a solid grass texture? What math do I do to find the start/end float R coordinates for blending from dirt to grass?
Any help is appreciated!