Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

A way to make awesome playable game terrain with heightmaps

Discussion in 'Made With Unity' started by PrimeDerektive, Feb 25, 2010.

  1. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    So I was playing with the terrain editor for a few days trying to make a good, playable terrain.

    The type of terrain I was going for was Zelda or Halo-esque. If you play these games, you'll notice that while they provide the illusion of being believable, wide open outdoor areas, they are really mostly different sized canyons with varying height plateaus. They usually put billboarded trees, mountains and doodads on highest plateaus, to make it seem like a larger world than it is.

    To this end, I decided to make my terrain in photoshop as a .raw heightmap, and import it into U3D. It took me about 10 minutes.

    All I did was draw out and fill the varying height leveled plateaus freehand with the pencil tool and with the paint bucket, on different layers and in different shades of gray. The closer to black your gray is, the lower it will be, and the closer to white, the higher.

    After I finished creating all my different height plateaus, I flattened the layers, applied a gaussian blur to soften the edges of the canyons. Finally, I created a new layer and rendered some clouds, and played with the opacity. This is important, because the black and white rendered clouds with a low opacity will create nice, rolling hills all over your terrain.

    Anyway, here was my finished game level. I'll post screenshots when I'm done painting my textures and placing my objects.
     

    Attached Files:

  2. KHopcraft

    KHopcraft

    Joined:
    Jun 6, 2009
    Posts:
    3,247
    Looks good. Sounds interesting. I wouldn't mind seeing a level like this. Can't wait for screenies. :D
     
  3. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,032
    Interesting, but how does it look in-game? The "paint it" approach to heightmaps often results in artificially flat terrains with visible steps. I see you used a few clouds to put noise in, but does it solve it?

    I'm a strong proponent of using fractal terrain generation tools. They're built for creating realistic terrain.

    I've taken your image into Terragen 2 and added some fractal detail and erosion. Here's the end result, maybe it's useful to you. I've also added a fractal splatmap that'll give you a smooth grass getting darker (or lighter, depending on your textures) by height and stone looking through at the steep slopes. Can be used with my terrain tools:
     

    Attached Files:

  4. drag0nsphere

    drag0nsphere

    Joined:
    Nov 7, 2007
    Posts:
    285
    how do you import them onto the unity terrain.... i tried import hightmap... but it didnt work
     
  5. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,032
    You have to convert the .png into .raw files.

    You can use Photoshop, or look at the Wiki where someone posted a Texture2Heightmap editor script.
     
  6. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    Wow, that's sick Tom, thanks.

    I understand that fractals are great for creating realistic terrain. But my point was that in many games, the terrain isn't realistic at all... they just provide enough details to give the illusion of realism.

    See here:

    http://media.giantbomb.com/uploads/0/4745/264069-ze15_super.jpg

    I do however, like the idea of adding minor fractal details like you did, that looks amazing.

    Also, your splatmap terrain painting plugin looks sick from the documentation. I will have to purchase it right after work :)

    How does it work in the editor? Do you assign different textures to different colors on the map?
     
  7. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    Sorry dragon, I posted it as a .png because I didn't think the browser would show a .raw as an image.

    If you have photoshop, just open the .png and go to file->save as and save it as a photoshop .raw
     
  8. RoyS

    RoyS

    Joined:
    Jan 12, 2009
    Posts:
    625
    I highly recommend Tom's Terrain Tools. See the link in his sig.
     
  9. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    I have every intention of getting them as soon as I'm done with work :)

    How do those texture splatmaps work? With your tools, how do you specify what texture goes to what color?

    And how did you make the splatmap so fast?
     
  10. RoyS

    RoyS

    Joined:
    Jan 12, 2009
    Posts:
    625
  11. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Agreed. I had some nice workflows and results with World Machine 2, basically by supplying height maps and masks for erosion. Produced an excellent balance between control and automation, and WM2 can output some interesting terms to maps, like erosion flow, so for generating material masks, and other things, it's quite nice.
     
  12. Wox

    Wox

    Joined:
    Dec 14, 2009
    Posts:
    86
    3DLT ? Whats that?
     
  13. Falin

    Falin

    Joined:
    Sep 29, 2009
    Posts:
    242
    i think it's L3DT
     
  14. RoyS

    RoyS

    Joined:
    Jan 12, 2009
    Posts:
    625
  15. Wox

    Wox

    Joined:
    Dec 14, 2009
    Posts:
    86
    Thanks, looks cool , shall test it.
     
  16. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    You guys that use L3DT, WorldBuilder and Terragen, is there any good workflows for making more zelda-esque maps, versus the hyper realistic ones I keep seeing?

    The point of my post and my original heightmap was that, as you notice in a lot of games, they make the details realistic, but the actual playable terrain isn't realistic at all.

    Like Zelda, Hyrule Field looks beautiful and realistic for the most part, but when you look a little closer you notice that all the playable terrain is enclosed by steep canyons with billboard trees and mountain skyboxes and stuff on top, to provide the illusion of being bigger than it is.

    Is there like a checkbox in any of these editors that says "enclose terrain in steep canyons"?

    Heheh, I guess I'm asking for a bit much.
     
  17. RoyS

    RoyS

    Joined:
    Jan 12, 2009
    Posts:
    625
    You can go in and manually change the L3DT terrain in step 1 or 2. I did this to sink all my terrain around the edges into the ocean, so you can do the same to make them mountains.

    L3DT also allows you to put in elevation numbers above sea level. Easy to do. L3DT has a wizard to help you learn to use the tool until you know what you're doing.

    There's a free version you can use, but I upgraded to get the larger terrain settings.
     
  18. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    While I haven't used L3DT, and been a while since I used terragen, what I did in WM2 was build a kinda template setup where I could use a mask for erosion, then another map for the general height of the terrain that I cared about. The mask basically defined the hardness of the rock, so that roads and such wouldn't move, but everything else got eroded normally.

    Included is a shot of what it looked like in-game, and you can likely guess what kind of game it was :). Anyways, this used a complicated shader that placed snot/grass depending on time of year, but with WM2 I was able to create some extra terms that made that possible (or at least look better). Was also able to smack ambient occlusion term in so ridges were better defined. It definitely took time to setup the process, but IMO worth the effort if producing a number of environments using the same technique.
     

    Attached Files:

  19. capnbubs

    capnbubs

    Joined:
    Jan 26, 2009
    Posts:
    85
    I've been doing something similar to RElam, using layouts in WM2 to control the shape of my world.

    I've also used WM2 to create maps for the grass and textures i'm using too.

    It gets a bit complex though!

    Here's a screen cap to demonstrate how out of hand my WM2 setup has gotten by this point, and a couple screens of the results =]



     
    jaikumarr1019 likes this.
  20. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    geeeeeWOOOWW that looks amazing dude. You should probably just give me that heightmap ;)
     
  21. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,069
    Fantastic terrain, capnbubs.
    Are you available to make (paid) heighmaps like that? :)
     
  22. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    764
    Wow. The end result in Unity is stunning!
     
  23. capnbubs

    capnbubs

    Joined:
    Jan 26, 2009
    Posts:
    85
    thanks guys, it's the first time I've really shown it to anybody. Workin on trees and rocks now.
     
  24. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,057
    What he said man, I'd totally buy something like that.

    Of course, your the dude that did that blue galaxy WIP, that explains a lot haha.

    If you're not going to sell them, you should definitely write a tutorial or something; that stuff is hot.

    First time I've seen anything but a crysis-esque island in unity that looked good.
     
  25. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Yea, my WM2 setup was not as complex as capnbubs, but it's still surprising how quickly it can get complicated (still likely 2/3rds as complex, which is far more than I'd have expected before doing it). The application looks daunting, but it's usually pretty easy to isolate the elements you change frequently, as capnbub's image demonstrates well, I think, so the complexity of the initial setup doesn't carry over to subsequent uses of the template, or tweaking. Regardless of how serious you are about the terrain, I think WM2 is well worth trying before settling on a workflow.
     
  26. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,032
    The splatmap is also fractally generated in TG2.

    The colours are simply channels, so red is the first texture you set up in your terrain, green the second, blue the third and black the fourth.
     
  27. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    beautifull shots!!! could you post a video in youtube?
     
  28. jaikumarr1019

    jaikumarr1019

    Joined:
    Nov 7, 2017
    Posts:
    1
    Oh Man I can Give u money for that just give that heightmap to me I Really Want It