Jump to content
  • Advertisement
Sign in to follow this  
Waaayoff

Chunked LOD + texture splatting?

This topic is 2220 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

I want my terrain to have more than four texture splats but i'm not sure how to do it. I know that i can divide my terrain into chunks (already done) and set for each chunk 4 splats so that way different chunks can have different textures. But that doesn't work with far away chunks which can be very large (covering 256km squared, represented by a 64x64 chunk), and so likely to have more than four splats itself.

Any ideas on how to approach this?

Share this post


Link to post
Share on other sites
Advertisement
Could you give some more details about your splat limit of 4 and how you are implementing the blend weights (I'm assuming textures)? At a guess, I'm assuming your 4 splat limit is tied to the colour channels of a weight texture that you bind for a given set of chunks and bind the different material textures to the 4 texture units of your splatting shader to pull their weights from the relevent colour channels. Does this sound about right?

By rigidly sticking to your 4 texture splatting limit you're going to have issues. For example, you could bind the most prominent textures that cover the largest area of a given chunk for LOD but then of course you'll have issues with textures popping into view. One way to rectify this would be to have intermediatory transition bands that mix between the different LOD texture sets based on distance from the viewer but then of course you'd need to splat more than 4 textures. Without knowing your implementation and constraints it's difficult to know what to suggest.

Share this post


Link to post
Share on other sites
How are you “mapping” your splats?
One option is to use a second pass just for the splats, in which case you don’t really need to worry about anything.

Another option is to use a routine that is specific to your terrain shaders, however as long as you keep the splat textures in the same slots for each LOD, I see no reason why the splats would not behave the same, except that they adjust “level of detail” (higher and lower resolutions) per-chunk.


If you are using a system other than these, you will need to explain it, because normally these are the main ways of tackling this obstacle, and both ways results in “acceptable” splats.


L. Spiro

Share this post


Link to post
Share on other sites
Yes that's how i'm doing the splatting. I set 4 splat maps and an alpha map with weights in the RGBA channels for every chunk.

I considered assigning a priority to textures for far chunks but that would cause popping like you said.

Edit: @L. Spiro: I'm not sure how in the first option i wouldn't have to worry about anything? Do you mean use more than one alphamap per chunk? Edited by Waaayoff

Share this post


Link to post
Share on other sites
You could store the weights for each chunk of a given size in an array texture and dynamically loop to splat an arbitrary number of textures. For each chunk, you'd pass the number of textures required (edit: i.e. the number of loop iterations), along with the array texture element and colour mask (a 4D vector with the colour channel to be sampled set to 1 and the rest set to zero) edit: for each texture. Multiply the colour mask by the rgba weight sample and sum the resulting components to get the weight for a given texture. The performance might be sketchy on older hardware, especially if the max number of textures for any given chunk is quite high. Edited by GeneralQuery

Share this post


Link to post
Share on other sites

So basically just add more alpha maps/weight channels?


If you want to splat more than 4 textures for a given point on the terrain mesh then yes, unless you bypass the blend weight textures altogether and algorithmically decide what textures should be splatted onto a given point or compress multiple weights into a given colour channel. The former will restrict direct artistic control, however, unless you use your existing weight textrues for this purpose and use these as the artistic "paintable" blend weights.

Share this post


Link to post
Share on other sites
I'm painting the terrain in my editor so no procedural stuff. I guess i'll just add more channels then.

As a side not, wouldn't it be better performance wise to use splatting only on chunks closer to the camera and some other technique on farther ones?

Share this post


Link to post
Share on other sites

I'm painting the terrain in my editor so no procedural stuff. I guess i'll just add more channels then.

As a side not, wouldn't it be better performance wise to use splatting only on chunks closer to the camera and some other technique on farther ones?

Texture splatting is an insalenly efficient technique on modern hardware, it's basically few texture samples and LERPs per fragment. You could bake a low resolution colour texture based on your splat weights for distance stuff but I'm not convinced it's worth the time, effort and resources for marginal performance gains (if any at all, or even worse perforance!).

Edit: a common technique for texture splatting is to sample low and hi res textures, with the former being used for distant geometry. You then overlay said hi-res texture onto the low res texture for fragments within a set distance from the viewer. You'd need a transition band for this, though, otherwise there'd be a noticble circular band where the low and hi res fragments meet. Edited by GeneralQuery

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!