I have made a simple terrain out of terrain.party and placed it at Benj’s LOD system.
Original thread:
Is it possible to export the generated terrain to an obj file?
I tried to make a terrain out of the heightmap but it doesn’t match the generated terrain.
The physics terrain also doesn’t match the visible terrain…
I think that this is the best terrain LOD system in Blender and i believe that it should be implemented more.
Is it possible to export the generated terrain to an obj file?
Ergh, that’ll involve writing a custom exporter in Python. I see you’ve already loaded the heightmap in blender. I’d just do File -> Export -> Wavefront. It’ll be up to whatever engine you’re using to texture it from the stencil map.
The physics terrain also doesn’t match the visible terrain…
The physics mesh needs more resolution. I’d subdivide another time or 2, then experiment with decimate to bring down the poly count. That said, this terrain system has a script that automatically updates a small high-res physics mesh around the player. The instructions weren’t updated when that feature was added.
I think that this is the best terrain LOD system in Blender and i believe that it should be implemented more.
Benj original blend uses the image below to calculate the physics mesh and it is 99% accurate.
I read something about perlin noise for terrain images…
I am using the blender game engine ONLY because i love it, but love hurts!
I want to sell it as a addon, once it’s more complete.
until then
I add a grid of tiles - (for x in range(xrange): for y in range(yrange): add tiles and move to position.
I use mathutils.noise to generate the terrain
I use a KD tree of all vertex, to create a dictionary
if str(vertex.worldPosition) not in dictionary -> create entry (put all vertex in .05 radius in list using kdtree)
(this creates ‘edges’ kinda)
if the vertex has been done already skip it.
recalculate normals of faces, than average normals across edges
5 -> take all data about tiles and put in a new dictionary
{ str([int(tile.worldPosition.x,int(tile.worldPosition.y)]):TileVertextDataTuple }
6 - a KD tree is built from the worldPositions stored in the dictionary
7 - all tiles in a radius of the actor are loaded in / out (I use a property in the data tuple to tell if the tile exists) if the property==False (no tile is loaded) if the tile is occupied it will be a KX_GameObect.
8 - all tiles in a small radius of the actor (or the mouse hitpoint) are built into a ‘micro kdtree’ that is small so it can update fast. this kdtree is used to edit the terrain.
9 -> when tiles are unloaded any changes are updated to the dictionary
Co = vector position (in a grid you can use this a key for a dictionary) to recall a tuple.
str(int(Co. X), int(Co.y)) is the key that I use to snag the tuple in my dictionary grid.
Index = in a list you can use this as a index to recall a tuple.
I think one could use a 2d array to store data, may be faster than a dictionary.