• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Waaayoff

Chunked LOD + texture splatting?

10 posts in this topic

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?
0

Share this post


Link to post
Share on other sites
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.
0

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
0

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
0

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
0

Share this post


Link to post
Share on other sites
[quote name='Waaayoff' timestamp='1348320396' post='4982650']
So basically just add more alpha maps/weight channels?
[/quote]

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.
0

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?
0

Share this post


Link to post
Share on other sites
[quote name='Waaayoff' timestamp='1348321046' post='4982652']
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?
[/quote]
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
0

Share this post


Link to post
Share on other sites
I'll stick to texture splatting then.

One last question. I'm not sure what the colour mask is used for?
0

Share this post


Link to post
Share on other sites
[quote name='Waaayoff' timestamp='1348323051' post='4982661']
I'll stick to texture splatting then.

One last question. I'm not sure what the colour mask is used for?
[/quote]

If you have a splatting shader that has 4 texture slots for 4 texture materials but any given chunk can have any 4 textures from a set of 8 that you bind dynamically, you need a means of ensuring that the correct colour channel is sampled for an arbitrary material texture.

E.g. let's say that you have a blend weight texture array of 2 elements containing the first 4 and second 4 splat weightings for the 8 materials. If grass resides in the green channel of the second element texture then you'd pass the elemend index and colour mask for that material as a uniform for your splatting shader. Eg:

[code]

Vector4 maskGrass(0.0, 0.0, 1.0, 0.0); // Mask out the red, blue and alpha colour channels, leaving only the green channel
UInt idxGrass = 1; // 2nd element of weight array texture

SomeAPI.SetShaderUniforms(rgbaMask = maskGrass, texElement = idxGrass);

// shader code

vec3 uvCoords = vec3(FragCoords, texElement);

vec4 w= sampler2DArray(Weights, uvCoords) * rgbaMask; // Will leave us with the vector [0, 0, green, 0]

float weight = w.x + w.y + w.z + w.w; // Will leave us with just the green channel

lerp(a, b, weight); // splat our textures using the calculated blend weight for this material

[/code]

That way you can send only the materials you need to the shader (which, of course, could be submitted in any order).

If you're hard coding your texture splatting, i.e. it will splat 8 textures regardless of how many are needed, then you do not need to do this. Edited by GeneralQuery
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0