Search Unity

Importing Terrains

Discussion in 'Asset Importing & Exporting' started by Artifact-Games, Jun 18, 2010.

  1. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    I see that Unity can only import greyscale heightmaps (i.e., .RAW files.) By the way I'm pretty new to how terrains work.

    "Note that the Unity Heightmap importer can only import grayscale raw files. Thus you can't create a raw heightmap using RGB channels, you must use grayscale."

    http://unity3d.com/support/documentation/Components/terrain-Height.html

    My questions is can Unity import realistic high-resolution terrains with texture maps from Carrara or Bryce? Will the new Unity 3.0 version be able to do this? If anyone knows please tell. Or if I have no clue of what I'm talking about, please explain that too!

    Here's an example of what I would like to import into Unity (from a Carrara .RAW):

    High-Resolution Terrain (4096 x 4096)with Snow Texture Map (4096 x 4096)
     

    Attached Files:

  2. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    You can certainly do what you're asking, but i'm curious about the color map - what are you expecting at eye-level? Using a 4096 texture alone will make for one hell of a blurry ground texture when you go further than a birds-eye view.
     
  3. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    hi duke,

    I'm seeing in another thread that the .RAW file needs to be in a multiple of 2 plus 1 (4097 x 4097 instead of 4096 x 4096). So how can I do what I'm asking? I'm not sure if it would work to just import the .RAW file the way it comes from the DAZ3D model community without some tweaks in another program. Also I'm not really sure why the texture map would be a blurry ground texture at eye-level, can you please elaborate on that a little bit further? Thanks!
     
  4. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    The 4097 RAw file will work for the Terrain heightmap if it's grayscale, but for the diffuse texturing of the terrain a single texture, even one at 4096, is going to get blurry close up.
     
  5. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    It must be possible to import heightmaps and texture maps from Carrara because I've done it! ;)

    http://forum.unity3d.com/viewtopic.php?t=7969

    I did this a long while back, but if I recall I was able to export a "multiple of 2 plus 1" heightmap from the Carrara Terrain editor, and then used an ortho camera to render a top view for the diffuse texture.
     
  6. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    Thanks for the clarification aNTeNNa trEE.

    Bigkahuna:
    I actually was looking at your post on the DAZ3D forums and I wrote you a message there a couple days ago! Brilliant work you've done I'd say. I just saw you replied to me there too.. Thanks again. So can you use a character controller attached to the ortho camera object only if it's flying high up above the texture map? Otherwise if it gets too close to the texture it will get blurry?

    This was what I found from this webpage discussing something very similar only using Google Earth:

    http://www.3dnemo.com/031_G_to_U.html

    On that page it says:

    "But ... As said you must be about 500m above the terrain to get a good mesh, you can capture at higher altitudes but you'll get a very low resolution mesh."

    It appears the best results are obtained from blending and combining low-resolution tiled textures using Unity's precision tools to make varied and exciting terrains. Would you agree?
     
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    All I did was position the ortho camera above the terrain and scale it so the terrain completely fills the camera's view. The elevation of the camera isn't critical, it just has to be above the highest point of the terrain. Then I rendered that view to the max resolution Unity takes (4096x4096). That's it, easy peasy.

    In the terrain editor on the left side is an "export" button. I can't remember what format I used, but it's probably one of the RAW formats there.

    Import the height map and then apply the rendered texture to the entire terrain and you're done.
     
  8. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    Wow.. That's awesome. I'll let you know how it goes. Thanks! :D
     
  9. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    The following realistic terrain in the DAZ 3D store says in the description:
    "Resolution: 4096 x 4096 Procedural Terrain
    Great for close-ups!"

    So I'm still a bit confused as to why I'm told the texture maps supposedly get blurry?

    http://www.daz3d.com/i/3d-models/-/realistic-terrain-for?item=9195_m=d

    [/url]
     
  10. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Because you're stretching the 4096x4096 texture across your whole terrain. If you have a 4096x4096 meter terrain, that gives you 1 pixel per square meter...very blury. If you drop it to a 1km x 1km terrain, then you get 4 pixels per meter....still very blurry.

    In order to keep detail you'll need to either break your terrain down into small chunks and have multiple high resolution texture maps (which will eat up your texture budget really fast), or use a splatmap that tells it where to paint tiled textures. This is how the terrain engine currently works. One thing you can do is use the 4096 texture as a base texture to show you where to paint the other textures and fill in gaps that you might miss.

    As for that link, I believe it's saying that the 4096x4096 terrain is using a 4k height map, not texture map. It still tiles multiple materials via a splatmap most likely.
     
  11. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    Hi niosop,

    Thanks for getting back to me on this question, I really appreciate it. I looked again at the description at that link, and it mentions that it includes 4 texture maps each at 4k resolution. So I think I see what you are saying about the terrain texture being broken down into small (in this case 4 big) chunks. This will certainly eat up your texture budget. If I understand you correctly, I could cut up the large texture maps into small texture maps and paint them as a splatmap. Is that basically what you are saying? Please correct me if I misunderstood.
     
  12. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    No, what I think he means to say is that instead of using a single 4096x4096 texture (such as I alluded to earlier in this thread) that you use a splat map and several smaller textures (512x512 for example). The advantage to splat maps is that you get the illusion you want for terrain viewed in the distance while still having clear images of the terrain that's close up. Creating a splat map in Carrara is something I haven't tried yet. In theory you could create a splat map by using Carrara's terrain distribution tools and just assign a primary color (red, blue, etc.) to each terrain type (snow, rocks, grass, etc.). Then convert that into a splat map Unity can use in Photoshop. Another method would be to use a tool such as "Fractscape" which is designed specifically for this and sold by fellow Unity user Eric5h.
     
  13. Artifact-Games

    Artifact-Games

    Joined:
    May 19, 2010
    Posts:
    43
    That makes sense. I've tried Fractscape and I'm very impressed with that tool. I'll try making some splatmaps with Fractscape as it seems easier than using Carrara. Thanks for your answer BigKahuna.
     
  14. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    What is the pipeline for importing colors to the terrain created from heightmap?