Simplest way to create a 3D terrain?
Posted: Fri Jun 03, 2016 3:51 pm
Although I am an old hand at programming, I struggle with 3D and I am somewhat ashamed to admit that I cannot create a simple 3D terrain.
I have read the documentation (help file) and have looked at the terrain.pb but I cannot create a working code from what I see there. I have also tried to replicate the terrain code of the Purebasic book (A Beginner's Guide to Computer Programming) but there are syntax changes that prevent me from making that code work (it seems to refer to an older version of Purebasic).
I need something very simple, even minimal: a terrain based on a heighmap jpg file, with a single texture layer. In my efforts, I call the following commands in the specified order (parameters etc. omitted)
In particular, I am confused about the world size. How does that relate to the texture size and in what coordinates is it expressed?
I am also confused about the filename and extension required by the CreateTerrain command. Should they point to an existing heighmap file (I am guessing not) or to a file that will be created by the pb code as it runs? Or something else?
Finally, I am confused by the DefineTerrainTile command: what are the TileX and TileY indexes and how do they relate to the worldsize and the size of the texture (that will be used to paint the heighmap) in pixels?
Your help would be appreciated and, please, do forgive my ignorance.
I have read the documentation (help file) and have looked at the terrain.pb but I cannot create a working code from what I see there. I have also tried to replicate the terrain code of the Purebasic book (A Beginner's Guide to Computer Programming) but there are syntax changes that prevent me from making that code work (it seems to refer to an older version of Purebasic).
I need something very simple, even minimal: a terrain based on a heighmap jpg file, with a single texture layer. In my efforts, I call the following commands in the specified order (parameters etc. omitted)
Code: Select all
SetupTerrains
CreateTerrain
DefineTerrainTile
AddTerrainTexture
BuildTerrainI am also confused about the filename and extension required by the CreateTerrain command. Should they point to an existing heighmap file (I am guessing not) or to a file that will be created by the pb code as it runs? Or something else?
Finally, I am confused by the DefineTerrainTile command: what are the TileX and TileY indexes and how do they relate to the worldsize and the size of the texture (that will be used to paint the heighmap) in pixels?
Your help would be appreciated and, please, do forgive my ignorance.





