- Home /
How can i generate a terrain from discrete points
I wanna to generate the terrain by scripting. and the data source is not a hight map, but discrete points that generated by hard device GPS and saved in database, i have these points that with elevation. how can i generate the terrain? thanks.
ps: i can handle the data using triangular mesh but i can not assign other gameObjects on the GUI, if there is a method/script that can convert my "terrain mesh" to the real Terrain which have terrainData and trees/grass can be planted.
Answer by Bunny83 · Mar 10, 2011 at 03:04 PM
Well, I guess the "real" terrain you're talking about is the Unity's built-in terrain engine, right? Unity's terrain is always hightmap based. So you have to convert your data into a hightmap or use just a mesh instead of a terrain. You could write an editor script that generates a hightmap from a collection of 3D points but i guess there are even better programs out there to generate a heightmap.
The main task would be to generate a smooth terrain from these points. To "fill" your heightmap's pixels you need some quadratic or expondential weight function and include all data you have. The closer the pixel is a discrete point the more weight this point gets. But as i said it's a lot math and I think it's easier to look for an external tool that can do that.
Once you have the heightmap as grayscale image you can export it as RAW (from Photoshop) and import it into Unity as terrain-heightmap.
Answer by ant123 · Jul 06, 2011 at 07:05 PM
exactly, an external tool that can convert the format you have, and a program that can do linear interpolation on your data, like a graphing tool, a terrain boffin tool, i dunno, im sure there is one.
Your answer
Follow this Question
Related Questions
Terrain Details Point Filtering? 0 Answers
(point)Light goes through objects 1 Answer
Add Points for Terrain Heightmap at Runtime 0 Answers
Make a simple tree 1 Answer
Terrain generation problem. 1 Answer