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

Blender terrain import to Unity

Discussion in 'Editor & General Support' started by AcTiQnLy60, Dec 7, 2020.

  1. AcTiQnLy60

    AcTiQnLy60

    Joined:
    Aug 13, 2020
    Posts:
    2
    Hi everybody i have a question,
    I did a terrain with using blender. when ı import as .fbx to unity,ı cant use the unity terrain tools to terrain.
    like this screenshot
    upload_2020-12-7_13-27-38.png
    how can ı fix this ?
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    I don't think Blender can create a "Unity Terrain". That's a special type of object that can only be created by Unity. It's not a traditional 3D mesh. It's represented by a heightmap rather than normal vertex/triangle data like a mesh.
     
    AcTiQnLy60 and Joe-Censored like this.
  3. AcTiQnLy60

    AcTiQnLy60

    Joined:
    Aug 13, 2020
    Posts:
    2
    TY for your help I think I will make my terrains in unity now.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    Blender definitely can NOT create such a thing.

    BUT! If you have an arbitrary object, such as your Blender-created terrain, you can convert it to a terrain heightmap with a fairly simple script. There are many examples of such a script lying around the internet, but I made my own with the help of another fellow here named @Zer0Cool a few months back. Here's the skinny:

    // Script originally from user @Zer0Cool at:
    //
    // https://forum.unity.com/threads/terrain-leveling.926483/
    //
    // Revamped by @kurtdekker as follows:
    //
    // - put this on the object (or object hierarchy) with colliders
    // - drag the terrain reference into it
    // - use the editor button to "Stamp"
    // - support for a ramped perimeter, curved as specified
    //
    // posted at:
    // https://twitter.com/kurtdekker/status/1281619776587001856?s=20
    //

    // https://pastebin.com/DYFAYgnE
    //
     
  5. kenncann

    kenncann

    Joined:
    Jul 16, 2015
    Posts:
    17
    Hey Kurt I'm trying to apply your script but I'm having trouble getting it to work and I'm not sure why. I'll try to outline what I'm doing:
    1. I have a huge mold for a terrain that I'm trying to extend the terrain to and basically fill the mold.
    2. I put a mesh collider on this mold object and set the size of the terrain to roughly match that of the mold. And I set the terrain as the input for the script.
    3. When I click the button nothing seems to happen though. I don't think it's taking a long time because I can do other things. It seems like it's not executing at all.

    I put a screenshot below so you can see what I'm trying to accomplish. Let me know if I can provide any other info.

    upload_2021-1-22_20-56-42.png
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    I think you might need to
    Cast From Above
    , especially if your collider is only facing upwards.
     
  7. kenncann

    kenncann

    Joined:
    Jul 16, 2015
    Posts:
    17
    Thanks for the quick reply Kurt. I'm pretty ignorant of this stuff so sorry if my questions come off sounding dumb. I tried that but I only get ~1 quadrant filled in and even that doesn't really look like it should. Is there a way I could get the mesh collider on the bottom face?

    upload_2021-1-22_23-6-5.png
     
  8. kenncann

    kenncann

    Joined:
    Jul 16, 2015
    Posts:
    17
    I ended up figuring out some of my problem with a different tool. Part of my problem was mesh size and complexity, things got better when I downsized in unity and reduced polygons in blender.
     
  9. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    Oh! Didn't think about that... I think by default a single mesh can only have 65535 polygons, and if you go beyond that Unity is clever enough to chop your mesh into a bunch of smaller meshes, but that means only ONE of them can be handled (by default) by the script above. Good catch.
     
    kenncann likes this.
  10. kenncann

    kenncann

    Joined:
    Jul 16, 2015
    Posts:
    17
    Ahh that makes sense and good to know, thanks!
     
    Kurt-Dekker likes this.