Chunked LOD + texture splatting?
#1 Members - Reputation: 362
Posted 22 September 2012 - 05:34 AM
Any ideas on how to approach this?
#2 Members - Reputation: 1113
Posted 22 September 2012 - 06:47 AM
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.
#3 Crossbones+ - Reputation: 5344
Posted 22 September 2012 - 06:59 AM
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
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums
#4 Members - Reputation: 362
Posted 22 September 2012 - 07:00 AM
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, 22 September 2012 - 07:03 AM.
#5 Members - Reputation: 1113
Posted 22 September 2012 - 07:11 AM
Edited by GeneralQuery, 22 September 2012 - 07:15 AM.
#6 Members - Reputation: 362
Posted 22 September 2012 - 07:26 AM
#7 Members - Reputation: 1113
Posted 22 September 2012 - 07:31 AM
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.
#8 Members - Reputation: 362
Posted 22 September 2012 - 07:37 AM
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?
#9 Members - Reputation: 1113
Posted 22 September 2012 - 07:44 AM
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!).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?
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, 22 September 2012 - 07:46 AM.
#10 Members - Reputation: 362
Posted 22 September 2012 - 08:10 AM
One last question. I'm not sure what the colour mask is used for?
#11 Members - Reputation: 1113
Posted 22 September 2012 - 08:36 AM
I'll stick to texture splatting then.
One last question. I'm not sure what the colour mask is used for?
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:
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
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, 22 September 2012 - 08:39 AM.






