Home Technical Talk

Texturing a terrain

jrush
polycounter lvl 6
Offline / Send Message
jrush polycounter lvl 6
Hi guys,

I created a mesh a terrain mesh in maya for use in Unity game engine and i have a couple of questions and would really appreciate some help in what approach to take.

I use Maya, Mudbox and Zbrush. I know I can import a mesh to unity and use the mesh to terrain plugin. But I'd really prefer not to do it that way.

I want to be able to paint and blend textures on the mesh directly. I know that would be the easiest way to do it.

I can also UV map the stage and maybe paint in Photoshop, I think.

Can anyone please guide me to maybe something that could help. Anything really. I've searched but havent found anything that useful yet.

Replies

  • illbleed
    Offline / Send Message
    illbleed polycounter lvl 6
    I think you're looking for vertex painting. Let's you paint and blend textures. It's done in engine.
  • cesarinm7
    Offline / Send Message
    cesarinm7 polycounter lvl 4
    but the vertex painter need a lot of vertex to have a good detail on painted texture. How do you keep low poly terrain or terrain polygon optimized but at the same time be able to use vertex painter efficiently??
  • leleuxart
    Offline / Send Message
    leleuxart polycounter lvl 10
    If you're using an actual terrain mesh, then yes the more vertices the better for vertex painting. But if you use the integrated landscape system(does Unity have that?), then they usually have their own subdivision and LOD system so painting is much easier. 

    If your terrain doesn't have any steep angles, you could do a top-down projection for UVs and paint it on a large, single texture, but you run the risk of stretching on the steeper areas and not having enough resolution overall.
  • Eric Chadwick
    Unity terrain system uses a splat map for blending, not vertex color. Splat map is a RGBA texture, each channel controls one tiled texture (grass, or rock, or dirt, etc.).

    You could also use a splat map on your own mesh-based terrain. However you will need a custom shader to do this. Shader Forge is a great way to make shaders, I'm using it to make custom shaders for Unity terrain and custom shaders for my own meshes.

    One issue with splat maps is that each pixel must always sum to 100%. If you paint a pixel 100% red, then green/blue/alpha must be black. The same if you paint a pixel 100% alpha, the other channels have to be black. If you paint 30% red, then you cannot paint more than 70% with the other channels.

    I think you can do non-summed splat maps, though I haven't tested it.

    A splatmap in World Machine:

  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 15
    Interesting about non-summed splat maps. This is what I've done in the past; tree/bush placement with alpha (clamped values for bush/tree), R,G and B controlled other items like flowers and other types of brush. One of the problems at the offset was things from the RGB part of the texture showing up inside the trees. We used the alpha to control the RGB intensity. So if it was 100% then it was trees and nothing else could go there, then the bushes were clamped between a certain value, and since bushes can have grass/plants grow around then, it was allowed.

  • Eric Chadwick
    @jrush: take a look at Shader FX in Maya. You can make a shader which will blend textures in the viewport.

    If you use a splatmap, you could probably use Maya's 3D Paint Tool to paint the splatmap directly on the terrain, and with the right Shader FX shader you could see your tiled textures appear while you paint.

    I haven't tried this in Maya, but that would be the first thing I'd try if I were dead-set on painting it in Maya.
Sign In or Register to comment.