Using Unity Terrain Tools on Sketchup Terrain?


#1

Can someone please help me figure out how to use Unity’s terrain tools on my SketchUp terrain?


#2

Unity uses a height map, which is just a grayscale bitmap that is usually square, and typical power of 2 sized (1024x1024 for example). As you use the Unity brushes you’re just altering that image.

Your challenge is how to turn your geometry into a height map. I haven’t found a direct way to do it in SketchUp, but it can be done with Blender:

https://wiki.blender.org/index.php/Doc:2.4/Tutorials/Textures/Maps/Creating_a_Heightmap_from_a_Plane


#3

Thank you!


#4

It’s very easy:

  • camera, standard views, top, parallel projection, zoom extents;
  • style tool so your background is black;
  • fog tool, the topmost part of the terrain is white, the bottom is black and then you adjust to have the maximum range possible on gradient from the top to the bottom
  • export image and crop

#5

I wouldn’t have said “very” easy, but it did work out ok, thanks.

To get the image to be the right kind of Raw that Unity would accept was slightly tricky. I picked up tips in this discussion:

https://armedunity.com/topic/1103-advanced-terrain-geocontrol-2-to-unity/

The antialiasing in my test led to ragged edges, but that shouldn’t be a problem with a normal terrain.


#6

I think it’s easy enough but you are, of course, limited to an 8bit depth image.

The jagged edges would probably be solved by antialiasing settings on your sketchup preferences and you must make sure you export your image at a custom size.

If you have access to a render engine like thea, you can export it much easier as a depth channel of your render and on an exr, hdr, tiff format, which will allow for 32bit color depths.


#7

Unity does take 16 bit grayscale Raw files. Here’s my SketchUp test model and the terrain that it made.


#8

However, if you export a sketchup image it will only be 8 bit. even if you then save it as raw in photoshop, the color info inside won’t grow.

In the example above, with flat levels, problem won’t be noticeable (even if the top is shorter,as that might be due to other reasons), but with smoother surfaces you might have artifacts.

Saving from a render engine as 16bit depth map would be better.


#9

Would most renderers be able to do the similar fog trick? Or do they have other ways to illuminate a top down view so that the nearest geometry is white and the farthest is black?


#10

By the way, I think Forestr’s plan was to make this be the starting point, the Unity tools could smooth out some of the artifacts.


#11

If you can import the terrain flawlessly, why use smoothing tools?

Some renderers like thea or vray can createbrender channels. The channel you describe here is a depth map. Nearer point is brighter, farthest point is black. In thea you can also focus on a max and min distance so you get the depth map from the geometry only inside those two distances from camera.

If you export this depth channel as 16 or 32 bit maps, it gets really accurate and there should be no artifacts.


#12

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.