How to get detailed textures on terrain

Started by
10 comments, last by nPawn 21 years, 2 months ago
No, it doesn’t let you set weights. That edge occurs because I laid out textures in such a way that it needed to blend three at once and couldn’t do that in a single pass. So it couldn’t blend.

As near as I can deduce from experimenting, it works like this. Assume you have tiles that are 4x4 vertices in size. Also assume you have 4 such tiles like this:

------
|A|A|
------
|A|B|
------

A and B are different textures applied to the tiles. When the tile with texture B is rendered, it is influence by (blended with) the textures on the left, top-left, and top sides. In this case, that is texture A on all three sides. What happens is that the upper and left sides of the B tile get blended with A, and as you move to the lower right corner you get closer and closer to having 100% of texture B, since that corner is farthest away.

You can also have a different combinations of the same two textures:

------
|B|A|
------
|A|B|
------

In this case, the upper left corner of that B tile will have more B texture blended into it because it is being influenced by the tile in the upper left that also has a B texture assigned to it.


What you cannot have is this:

------
|C|A|
------
|A|B|
------

This won’t work because when you render the tile with the B texture, you would need to also load textures A and C. That’s three textures and is too many.

However, you could have texture C to the right or below the B tile because the B tile is not influenced by textures on those sides.

Thing only thing I don’t know exactly is how the blending would actually be set up if you wanted to implement it. I assume you’d have to generate an alpha channel and then add that to the textures. But the alpha channel would have to vary depending whether the texture you are rendering is the main texture or one of the textures being blended into the main texture. And you don’t want to have to go swapping alpha layers of textures while rendering.

Perhaps it would be nice if there is a way to specify alpha percentages for each texture within the vertices and have that be interpolated, but I don’t think there is any way to do that in DirectX.

[edited by - JimH on February 12, 2003 7:46:47 PM]
Advertisement
im pretty sure directx has something like that. in opengl im using
GL_COMBINE_ARB, GL_INTERPOLATE_ARB
GL_PREVIOUS_ARB, GL_SRC_COLOR
GL_TEXTURE, GL_SRC_COLOR
GL_PRIMARY_COLOR_ARB, GL_SRC_ALPHA

that would interpolate between the previous and the current texture stage, using the alpha value of the vertex as weight. you can do the same with the vertex color. but it will only let you blend three textures. i guess a pixelshader would give you more freedom, even its just because the new versions let you access each channel of the color.

though i guess 3 textures should be enough anyway for now. you could have 3 "detail" textures and one combined color,light,shadow-texture.

f@dzhttp://festini.device-zero.de

This topic is closed to new replies.

Advertisement