Search Unity

Alternative methods for terrain texturing

Discussion in 'Editor & General Support' started by camjackson89, Nov 16, 2009.

  1. camjackson89

    camjackson89

    Joined:
    Nov 16, 2009
    Posts:
    10
    My first post :)

    I've previously used L3DT to generate terrain heightmaps and textures, and really love using it. I've imported a RAW heightmap from L3DT into Unity without any trouble, but I'm a little confused about applying the generated textures to the terrain.
    I have the base map from L3DT that I want to apply to my terrain in Unity. I can see the Base Map Dist. parameter when editing the terrain settings, but I can't see anywhere to choose the actual base map. Generating a light map and replacing it with my base map texture worked, but surely that's not the 'proper' way?
    Also, L3DT generates layer masks, which show exactly where each detail texture (grass, dirt, rock etc) should be applied on top of the base map, and I was wondering if there was a way to utilise these masks in unity, rather than repaint all the textures in unity?

    cheers,
    Cam
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you could import them but need scripts to replace the splat maps with these textures to work
     
  3. camjackson89

    camjackson89

    Joined:
    Nov 16, 2009
    Posts:
    10
    Sorry, but I don't really understand what you mean. Are the splat maps the textures applied to the terrain? (ie the thing that is seen in the end result)
    Or is the splat map Unity's internal representation of where to show the different textures on the terrain?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Fractscape includes a script which applies a splatmap to the terrain. Most of this area (applying pre-made textures and splatmaps to terrains) relies on undocumented scripting APIs.

    --Eric
     
  5. camjackson89

    camjackson89

    Joined:
    Nov 16, 2009
    Posts:
    10
    Thanks Eric.
    When you use the term 'splatmap', are you referring to the pretty colourful thing that gets painted onto the heightmap and rendered? Or do you mean the black and white texture that shows where a certain pretty colourful thing should and should not be applied to the heightmap?

    Yeah, I was beginning to think that it might be undocumented stuff, seeing as I wasn't turning up much in the manuals or references. Is there anywhere I can look to read about undocumented things? Do you have any idea about what I could be fiddling with?

    cheers,
    Cam

    PS- I'm aware that undocumented things are subject to removal or change in future versions etc etc :p
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Neither

    The splat map is the "color full thing" that defines where which of your textures will be painted to which degree at a specific pixel position. You can see it if you open the terrain asset in the resource tree where it will list the splat maps
     
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There isn't a black and white texture actually...a splatmap uses the rgba channels of a control texture, with each channel controlling a different terrain texture. If you have grayscale textures, you'd have to combine them into a proper splatmap before you can use them for anything in Unity. You need one splatmap for every 4 textures. The script I mentioned only works for 1 splatmap though.

    There's a topic somewhere on the forum that deals with more of the undocumented stuff, which should turn up in a search.

    --Eric
     
  8. camjackson89

    camjackson89

    Joined:
    Nov 16, 2009
    Posts:
    10
    Got your email, thanks so much Eric, I'll go have a play with that now.
    Good luck with starscene :)
     
  9. camjackson89

    camjackson89

    Joined:
    Nov 16, 2009
    Posts:
    10
    Oh I think I understand now.
    So the splat map is an RGBA, where each colour channel is a number that corresponds to the degree to which each of 4 textures is applied to that point.
    What about determining which texture is being used by which channel of the splatmap? Do I just have to ensure I add my textures to the terrain in the correct order?
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yep.

    Yep again. :) R = first texture, G = second texture, etc.

    --Eric
     
  11. camjackson89

    camjackson89

    Joined:
    Nov 16, 2009
    Posts:
    10
    OK, that makes sense now.
    Now I just have to turn my 4 greyscale png's into 1 png...
    Hopefully there'll be a simple way to do this with paint.net. Unless anyone else has a better suggestion?