Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Is it possible to export a Terrain to OBJ?

Discussion in 'Editor & General Support' started by Drewson, Apr 20, 2009.

  1. Drewson

    Drewson

    Joined:
    Apr 19, 2009
    Posts:
    168
    I want to make a series of grouped objects in my terrain and it would be easiest for me to do my object placement in Maya and merge the objects together into one draw call.

    Only problem is - I need a guide to work from!

    -Thanks!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You can also export the heightmap and generate a mesh through that likely.
    just be aware that you will lose detail, that you can no longer use foliage or the texturing and that the whole stuff can not be brought back as terrain.

    to reduce draw calls, group all the additional objects into a single game object and add the combinechildren script. then all objects using the same material are merged.

    But also keep in mind that merged objects mean that they will likely always be sent to driver / GPU to be rendered as the occlusion is done on the bounding box, not on triangle level. This basically means: combine stuff thats near each other in the world, instead of just everything or you will likely lose more than you gain
     
    Erutan likes this.
  4. Drewson

    Drewson

    Joined:
    Apr 19, 2009
    Posts:
    168
    Eric5h5-

    Thanks, it worked perfectly!
     
  5. BetaRayBill

    BetaRayBill

    Joined:
    Jun 6, 2009
    Posts:
    188
    I got the ExportTerrain.js working on this, but my terrain is coming into max in the lower right quadrant. Also, its rotated 90 degrees in Y when I bring it back to Unity. (scale issues working fine)

    So after countless hrs on this, it appears the ExportTerrain.js doesn't respect its position, and.... changing the "resolution" not only changes the detail of the mesh by half, it also halves the size,.. or if you set resolution to quarter, your mesh will now be a quarter of its original size (not detail like you would think).

    I'm trying to export the terrain to max, add all buildings etc, and then later export those buildings and objects so they land right on my terrain in the same spot they were in Max.
    Also, is the top viewport in Unity upside down? Exporting from Max 2009 fbx looks fine in Max's front viewport, and in Unity's front viewport,.. If I click on the "top" view in Unity, it flips everything upside down.
    thx
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Good catch on the "different res = different size" thing...I always had the import scale clamped to 100 in Blender, so I never noticed. The script was initially written when there was no ability to move terrains, so I added that, as well as a progress bar, and updated the script on the wiki.

    The rest of it, though, is down to importer/exporter behavior and every 3D app using a different coordinate system, so there's nothing I can do about that. You have to adjust for it manually.

    --Eric
     
  7. BetaRayBill

    BetaRayBill

    Joined:
    Jun 6, 2009
    Posts:
    188
    You updated it already? Ur fast, thanks.
    So it will still export the terrain to the lower right quadrant of 0,0,0 then? I imported my terrain to Maya 8.5 and it did the same thing,.. except when selecting the terrain in Maya, it crashed. memory..

    I'm trying to think of how to get this working properly though,.. I guess its like Terragen in a way exporting their terrain, but is fbx open source?.. can you use fbx to export instead of obj? (I guess that still wouldn't read properly unless the exporter had presets for each app)

    Thanks again Eric

    btw... maybe the best way is to make a terrain in Unity, export it to Max or Maya, then fbx it back to Unity, then line up my Unity terrain with my imported/exported mesh,.. then everything i do in Max or Maya will line up perfectly. Maybe I'll do that for now...
     
  8. JayCally

    JayCally

    Joined:
    Apr 22, 2009
    Posts:
    45
    If you have zBrush, you can export out either the high res object or the map and recreate it. You can then recreate all the subdivision levels so you can export out a low res model and normals to use in Maya or Max.

    I created a cool terrain in Unity but want to use it in an iPhone game but you can't use the terrain engine on the iPhone. I used the above steps to export out a decent low res mesh for use. With textures, props and lighting, it looks pretty damn good.
     
  9. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi,

    TerrainObjExporter works very well. It is there a way to export the final texture (composite) of the land?

    JP
     
  10. The-W-A-T-Z-R

    The-W-A-T-Z-R

    Joined:
    Apr 13, 2014
    Posts:
    22
    hum the Link dosent work !?!
     
  11. Enrinor

    Enrinor

    Joined:
    Jun 18, 2014
    Posts:
    3
  12. Benjahmin

    Benjahmin

    Joined:
    Oct 10, 2014
    Posts:
    1
    Does anybody know where the terrain menu the above article references is located? I cant find where the "export to obj" command is located. I see all the terrain options on the right hand side of the screen, but no drop down anywhere. Cheers!
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The terrain menu is added when you use the script.

    --Eric
     
  14. cm

    cm

    Joined:
    Jul 31, 2012
    Posts:
    14
    I know this thread is old, but I have the same question as "JP" from 2010 -
    - " ...Is there a way to export the final texture (composite) of the land?"

    I have no trouble exporting the land, but it does not include the texture. When I attempt to re-apply it the scaling is off. Is there a modified script (or alternative method) that includes exporting of the texture to the OBJ file?

    Thx & Best Wishes!
    Chris
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Not really; there's no "texture" as such, but instead a specialized terrain shader essentially creates composite textures on the fly from the splatmaps. Technically it would be possible to compute a combined texture somehow and export that, but it would likely be unusably huge, depending on various settings and splatmap size.

    --Eric
     
  16. roborb

    roborb

    Joined:
    Aug 26, 2013
    Posts:
    15
    I seem to be having an issue where selecting the terrain (I have 25 terrain tiles in a 5x5 grid) makes no difference on what gets exported.

    What's even stranger is the tile it *is*exporting is #10 in the list.