Jump to content
  • Advertisement
Sign in to follow this  
Raeldor

Texture Splatting... Different Textures on Each Tile

This topic is 4818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

It is common place in a texture splatting solution to have different textures on each tile. For example, let's say my maximum numbers of textures to blend per tile is 4. Is it common to have a different (or overlapping) set of 4 textures on one tile, than it's neighbour. The idea being that say half a terrain may have texures for desert, and the next half for some kind of dry grassy plane. Just curious as I am thinking of adding this functionality to my terrain editor and wondered how commonplace it was or if there are other solutions. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Raeldor,

This is very common behavior. I have implemented it myself many times. Often what is done is there will be a single collection of textures(IDirect3DTexture9*'s for example), say a set of 64. Then each tile has an array of texture indices, say from 0 to 3. (4 indices).

When each tile is rendered the device is set with the textures and sampler stages of the 4 textures to be drawn on the current tile. This of course is done by using the indices on the tile as a lookup into the larger array of texture pointers.

Share this post


Link to post
Share on other sites
Quote:
Original post by jwalsh
Raeldor,

This is very common behavior. I have implemented it myself many times. Often what is done is there will be a single collection of textures(IDirect3DTexture9*'s for example), say a set of 64. Then each tile has an array of texture indices, say from 0 to 3. (4 indices).

When each tile is rendered the device is set with the textures and sampler stages of the 4 textures to be drawn on the current tile. This of course is done by using the indices on the tile as a lookup into the larger array of texture pointers.


Great, thanks for your reply. Then I am on the right track. If you were using a pixel shader to get the 4 textures in on one pass, would you first sort the tiles by the sets of textures they use to minimize texture loading?

Share this post


Link to post
Share on other sites
I actually set each vertex to use just one groundtype. This means each trianlge can support up to 3 ground types blended across it, without having to store lists of texture indices and amounts of each ground type for every vertex. I find it perfectaly acceptable and a lot simpler.

Share this post


Link to post
Share on other sites
Quote:
Great, thanks for your reply. Then I am on the right track. If you were using a pixel shader to get the 4 textures in on one pass, would you first sort the tiles by the sets of textures they use to minimize texture loading?


You're right on, man. To minimize texture swapping on the device (a time consuming process), try as best you can to sort the tiles by which 4, 6, 8, etc... textures that they use.

Cheers, and keep up the good work!

Share this post


Link to post
Share on other sites
Not sure if you're a little beyond this, or if you've already read it, but GameDev posted an article on the subject not too long ago: HERE.

Matt Hughson

Share this post


Link to post
Share on other sites
Quote:
Original post by jwalsh
Quote:
Great, thanks for your reply. Then I am on the right track. If you were using a pixel shader to get the 4 textures in on one pass, would you first sort the tiles by the sets of textures they use to minimize texture loading?


You're right on, man. To minimize texture swapping on the device (a time consuming process), try as best you can to sort the tiles by which 4, 6, 8, etc... textures that they use.

Cheers, and keep up the good work!


Interesting addendum question to this then is, do you force the indexes into the textures to be sorted? Ie, let's say one tile has the four indexes

4,1,2,3

and another tile has the indexes

1,2,3,4

Technically they are using the same set of textures, but you cannot render them in the same pass because the first pass is always opaque, so the result would be different. Would you force the user when selecting which indexes to use for a tile to have them sorted by index number? It seems if that is the case then, that the land types that cover most of the land would have to reside in the first part of the big list of textures.

Is that overkill? Would it be better just to render these in two seperate passes?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!