I’m attempting to get a detail map onto my terrain. To do this, I have added an extra texture called DetailMap, and then I mix it with the DiffuseMap, to give the illusion of extra texture detail.
Then the texture is just pure green, and then all the rocks and other details are from a separate texture.
So, now I have extra detail, I would like to tile this to have even more detail. So, I did this: #ifdef DIFFUSEMAP vec2 detTex = texCoord * vec2(40, 40); //Tile by 40. If I set both of them to "1", without tiling, this works fine. vec4 diffuseColor = texture2D(m_DiffuseMap, newTexCoord); vec4 detailColor = texture2D(m_DetailMap, detTex); diffuseColor = mix(diffuseColor, detailColor, 0.2);
From my old days of using java and LWJGL, I thought this would work: I thought that this would cause the texture to tile multiple times over the surface.
However, it hasn’t worked. It has created a sort-of uniform stretched texture kind of thing.
It’s tough for us to understand what the texture coordinates are on the terrain itself but the math looks right.
I presume that the texture is setup to repeat. I think that’s default in later 3.1 versions anyway.
Maybe as a test set a main texture that is just a green border and a detail texture that is just a red border and post that screen shot. It will show us what the relationship to newTexCoord and detTex is with respect to the mesh.
It doesn’t look like the issue, though. I’d still be interested to see the single-pixel green border and single-pixel red border example I mentioned. Would tell us more than your pictures as it’s hard to interpret what the detail texture is actually doing.
Note: I have a test pattern texture also but if you use it, only use it for the detail texture or the main texture but not both… else it will confuse the issue: