Home Unity

Terrain splatmaps -- how do they get applied?

grand marshal polycounter
Offline / Send Message
Alex_J grand marshal polycounter
Hello PC, sorry this seems like silly question, but I just can't find an answer!

Are UV's generated for Unity terrain, or is splatmap resolution dependent on vertices? I did some testing in engine to try and figure answer for myself but couldn't reach a conclusion. I have trouble getting something that isn't blurry no matter what. I am using a 2048 * 2048 terrain, heightmap res was set to 2k.

Reason I ask is because I have a pretty high resolution terrain, but my splatmap seams often appear pixelated. So what to do? Increase splatmap size? Increase terrain heightmap resolution?

Also, first place I go is obviously unity documentation... but the thing is written like a step-by-step how to guide covering the bare bones basics, but doesn't tell you any technical specifics. Am I looking at the wrong thing? It just seems like this should be an easy question to find an answer on.

Splatmap textures :

You can see the pixelly edges. Especially on the steep slope. Not worried about the cliffs cause I cover with a mesh, but on the ground we should be able to achieve crisp details, no?

Replies

  • Eric Chadwick
    The splatmap is meant to be used as a mask between your terrain textures, not as a main texture itself.

    If you want sharper transitions though, there are two approaches you could use...

    1. Use more, and smaller  terrains. This will decrease the size of the splatmap pixels, but will increase the memory cost, both more splatmaps to load, and higher vertex count.

    2. Use a custom terrain shader that adds tiled/contrasty detail to the blend. Check out my sketchbook for implementation details. 
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    Thanks Eric I take a look.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    Bingo, @Eric Chadwick , found what I needed in there.

    Problem I been having is I trying to make some third party stuff work for me (vegetation studio, gaia), but it doesn't really want to work for me because it wants pbr materials only. And I'm usign some unlit materials. So I guess the thing I gotta do it learn to write my own shader to intake the splat maps, so I can essentially do the same thing, just wiht my own unlit materials.

    I see shader forge is no longer a thing. You have any opinion on amplify shader editor? I used it to make my unlit materials. documentation is pretty decent. Maybe if it lacks somethign I need shader forge wiki could work anyway. I mean shader language hasn't changed much has it?


    I take a look at mega/micro splat as well. Looks like they got support for non-pbr workflows, so that may help out.
  • Eric Chadwick
    I've heard good things about Amplify. But I've changed jobs since, and not working in Unity anymore.

    Node editors for shaders all seem to support the same kinds of nodes, so it shouldn't be too hard to repurpose info between them. I was able to repro Unity shaders in 3ds Max using Autodesk's Shafer FX node editor.

    Let me know how it goes! 
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
     will do. Lot's to learn but it's slowly starting to make more sense.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    So I read some older threads from around 2010, someone had similar question.

    If I understand correctly, when you use splatmap technique the application of your textures is handled via vertex data. Meaning, the splatmap says which textures in the array go where, and that is associated via vertices. So no need for UV's then. But the resolution of your blends would be tied then to the resolution of your terrain mesh. I dont think that is right because the terrains you built had highly optimized geo. Maybe you did in fact use UV's? Or I am missing something.

    Is that about right @Eric Chadwick ?

    so then I try an exercise to make sure i understand this. I make a mesh terrain, i go ahead and unwrap just cause i wanna paint it in substance painter, but i just gonna use that color map to derive a splatmap from, then i can plug whatever textures back into that splatmap afterwords.

    Main thing is, i just wanna hand paint my terrain with the tools i'm familiar with, so i thihnk this is workflow that makes sense. Just need to make my own color>splatmap generator, and then shader that reads splatmap and applies unlit material and texture array with it.
  • Eric Chadwick
    Terrain does in fact have UVs, it's automatic, top-down planar. In the default terrain shader, you specify tiling amount of the textures. Splatmap never tiles, it always covers entire terrain.

    Its difficult to paint a splatmap with outside tools, I would advise against this. Each pixel must be "summed" which means the RGBA values when  added together equal 1... R .25 + G .25 + B .5 + A 0, etc.

    If any channel gets "greedy" then the textures don't blend properly, you get either additive or multiply visual errors in those blend pixels.

    You could use World Machine, it generates summed splatmaps. But that's pretty procedural, probably not what you want. 

    You can export your splatmap, that's what i did after using Terrain to paint it. Just so I could use it in my own shader, on my own optimized mesh. 
  • Eric Chadwick
    There were plugins on the Asset Store that I used to improve Terrain painting tools. Specifically one to blur and sharpen, that was helpful. That was 4 years ago tho, not sure what's current. 
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    Thanks. Yeah I was thinking about "how does the splatmap read my hand blended textures though?" and couldn't imagine any way it could do that well.

    I thought about world machine. I have actually been using heightmaps to generate terrain from terrainparty. As the game is semi-educational I thought that seems like a good idea to sort of recreate real world locations it's meant to take place in. Only problem with world machine is that it's one more big complicated thing to learn... lol. 

    Maybe some day but for now i think i spend a week or two learning more about shaders and terrain. Most answers people give me is full of words I dunno so gotta fix that.


Sign In or Register to comment.