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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Runtime Mesh to Terrain

Discussion in 'Scripting' started by DarkHorseTrolls, Sep 10, 2019.

  1. DarkHorseTrolls

    DarkHorseTrolls

    Joined:
    Aug 29, 2019
    Posts:
    13
    I have a Mesh.
    bound size - 10 x 10 x 10
    vertex count 307200 ( 640 x 480 ) - the Vector 3 array

    I would like to create a terrain from it's height values that is 640 x 480

    How do i go about doing this? I already can make a terrain of a desired size from Perlin noise.
     
  2. Thibault-Potier

    Thibault-Potier

    Joined:
    Apr 10, 2015
    Posts:
    206
    I would feed the heighmap of the terrain with the "altitude" of the mesh vertices (their y positions). So first thing is to get a table of your vertices Y position values and then create a 640*480 array based on this first table. You would probably want to use some smoothing functions on your values before feeding the heighmap table of your terrain
     
    DarkHorseTrolls likes this.