Terrain and iPhone (420553)

Hi,

I am new in Unity and I would like to have some inputs and best practices about level design under Unity iPhone.

I understand there is no terrain editor in Unity iPhone mainly due to poor performance of portable device GPUs. Though I guess the lack of embedded terrain editor does not prevent to import a terrain in Unity iPhone. I would like to make sure the following strategy is feasible:

First in Maya:

  • create the terrain (as low poly as possible)
  • texture the terrain
  • create skydome, place sunlight
  • place the non-interactive objects, especially trees
  • cast and bake shadows in texture
    Then in Unity iPhone:
  • import the whole .fbx scene from Maya
  • compile and run

If I use multiple instances of the same tree in Maya, how would it be imported in Unity? Would it be multiple instances of the same prefab or as many objects as trees in the scene? In that case, I guess it would be better to place trees in Unity to benefit from the static geometry batching. However, what about baking in Unity iPhone? is that possible?

Also, what about occlusion culling for outdoor scene? Is there a way in Unity iPhone to prevent far away objects being rendered?

Thanks for your help!

You’re going to have to assign a lightmapped shader; that won’t transfer from Maya, but that’s about the only extra step.

Yes. Beäst works across all platforms in Unity 3. You’ll probably get better results in Maya if you don’t have the Pro license though, which adds some bells and whistles that aren’t fully documented yet, but apparently GI is one of them.

All versions of Unity allow you to use multiple cameras. Using a closer far clip plane on one for smaller objects, and one with a farther clip plane for the terrain, is a quick solution.

As for the tree situation, I don’t use Maya, but I’m assuming it behaves the same way as Blender. With Blender, the FBX file contains a Game Objects for each of your meshes, and each one will have a copy of the mesh, despite being instances in Blender. Personally, I do level design in Blender, so I can better model around all the prefabs.

I make use of this script. I import an fbx file, and for new objects that I want to be instances of prefabs, or ones whose transforms I’ve altered, I use the copy function. I get the appropriate prefeb into the scene, and then run the Paste function on it. I typically figure out how many things I’m going to need, hit Command-D that many times on a Prefab in the hierachy, to get however many I need, and repeat the process for each, deleting the junk from the FBX as I go and leaving the instantiated prefab. I assign three finger trackpad swipe down to copy, and swipe up to paste, and use those with my left hand while picking the appropriate Game Objects with my right, so it’s not too slow. If you have a lot of trees, however, you may want to go with a more automated solution, based perhaps on naming. (i.e. Instantiate the Tree <<-* prefab for anything named Tree <<- in the FBX, grabbing a transform from the FBX and deleting the associated Game Object. Delete all the old *Tree <<-*s at the start of the script.)

  • <<- is a drawing of a tree, if it wasn’t obvious.

366669–12726–$transformcopypaste_137.cs (972 Bytes)

Thanks Jessy, It helps me a lot!

Assuming I am going to purchase the Pro license, what would you recommend between baking shadows in Maya or Unity? I guess baking + design lightmap shader in Unity all at once may be easier?

As you pointed out, I guess the best way would be to create a script that automatically replaces tree copies by prefab instances and then use the static geometry batching featured in Unity iPhone Advanced to render them in one shot.

I don’t know all the features Unity-Beäst offers. Check it out for yourself and see how it compares to what you get with what you can do with Maya; I have a feeling that even on iOS, with no dynamic lights, you’ll get more with Unity’s solution than just a lightmap, but I haven’t had a need to look into it yet – my own projects haven’t required computed lightmaps. If you find that Maya would offer all you need, though, I’d say go with that, just because it’s a lot easier to work in Maya because its SpaceNavigator support is the best in the industry and Unity doesn’t offer that at all.