Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
1.0.0:terrain [2023/02/22 14:57] – created - external edit 127.0.0.11.0.0:terrain [2023/02/23 16:47] (current) – [Configuration] admin
Line 1: Line 1:
-====== Loading terrain ======+====== Terrain ======
  
 Gorilla3D provides a simple terrain component for generation from height-map image. Besides the default usage, different procedural builders are available: diamond square, mandelbrot, perlin-noise (linear, cosine and cubic), plateau algorithms. The resolution / number of vertices is configurable. Gorilla3D provides a simple terrain component for generation from height-map image. Besides the default usage, different procedural builders are available: diamond square, mandelbrot, perlin-noise (linear, cosine and cubic), plateau algorithms. The resolution / number of vertices is configurable.
Line 6: Line 6:
 For detailed information about the component and its methods, check out: Gorilla.Terrain For detailed information about the component and its methods, check out: Gorilla.Terrain
  
 +===== DesignTime =====
  
-===== Creating a terrain at runtime from heightmap =====+You can generate a terrain at design time by different ways. 
 + 
 +==== From Heightmap ==== 
 + 
 +  - Drop a TGorillaTerrain component onto your GorillaViewport 
 +  - Select the TGorillaTerrain instance 
 +  - Go to "Heightmap" property in object inspector 
 +  - Open the editor dialog and load a 2D image from file 
 +  - The heightmap will be stored inside the IDE formular file (*.fmx) 
 + 
 +==== Autogenerate with Editor ==== 
 + 
 +When you select your TGorillaTerrain component in structure view of the IDE, you can right click onto and a popup will show. 
 + 
 +Here you can select between the embedded procedural terrain generation algorithms. 
 + 
 +{{:1.0.0:g3d-ide-terrain.jpg?nolink|}} 
 + 
 +Choose one of the "Random Terrain <ALGORITHM>" options. 
 + 
 +After you have clicked, you need to click into the viewport in your form to refresh rendering. 
 + 
 +==== Planting ==== 
 + 
 +The framework brings you a great feature called "Planting" to the terrain component. 
 + 
 +After you have loaded a terrain from heightmap or by procedural generation, you can use this functionality. 
 + 
 +{{:1.0.0:g3d-ide-planting-1.jpg?nolink|}} 
 + 
 +It will need another TGorillaModel component as template and will perform an instancing onto the selected terrain. 
 + 
 +This means all instances will automatically be adjusted to the shape of the terrain. 
 + 
 +When clicking the "Planting" option a new dialog will open where you can configure some settings for the planting algorithm. 
 + 
 +{{:1.0.0:g3d-ide-planting-2.jpg?nolink|}} 
 + 
 +=== Configuration === 
 + 
 +The algorithm will create instances for all meshes inside the selected template / source model. 
 + 
 +Basically the algorithm splits the terrain into cells for more realistic placement. 
 + 
 +^Setting ^ Description ^ 
 +|Clear Instances | Clears all previously available instances in the source. | 
 +|Minimum Scale | If "Random Scaling" is activated, this is the lowest limit for scaling.| 
 +|Instance Scale | A basis scaling of each instance (will be multiplied with source scale if "Apply Source Transformation" is activated.| 
 +|Space | Adjustment between cell-center and source size. | 
 +|Padding | Increasing this value will compress cells for planting. Objects will be placed closer together.| 
 +|Random Y-Rotation | This is not suitable for all kind of source models. Depending on the internal transformation of submeshes. | 
 +|Random Scaling |This will randomly scale instances with limitations given by "Minimum Scale".| 
 +|Apply Random Grid-Offset|Terrain is splitted into equal size grid cells. To produce a more realistic look, you can add some random offset to the cell-center.| 
 +|Apply Source Transformation|It will apply the transformation of the owner model. This is not suitable for all kind of models, depending on the internal transformation of submeshes.| 
 +|Count |The number of instances that should be created. This should be adjusted to the GPU you are using and the outcome you expect.| 
 + 
 +=== Source Models === 
 + 
 +The planting algorithm is straight forward and treats all submeshes inside the source model equaly on creating instances. 
 + 
 +Therefore it can produce unexpected results. 
 + 
 +The source model should contain a flat hierarchy without or less transformation of sub-meshes. 
 + 
 +__NOTICE:__ The applied instance transformation is absolute and not relative to the source model! 
 +===== Runtime ===== 
 + 
 +===From Heightmap ====
  
 <file pascal Form1.pas> <file pascal Form1.pas>
Line 50: Line 118:
   
  
-===== Creating a terrain at runtime by procedural method =====+===== Procedural Generation =====
  
 <file pascal Form1.pas> <file pascal Form1.pas>
Line 89: Line 157:
 __NOTICE:__ Once you build a random terrain, you are able to store the heightmap bitmap and reload later.  __NOTICE:__ Once you build a random terrain, you are able to store the heightmap bitmap and reload later. 
  
-==== Implemented terrain algorithms ====+==== Terrain-Algorithms ====
  
  
Line 100: Line 168:
 | Brownian | Brownian terrains or brownian surface is based on the diamond square based terrain algorithm: https://en.wikipedia.org/wiki/Brownian_surface The component computes peaks by a specific number of random particles. Afterwards the complete terrain will be smooth to create a realistic landscape. |  | Brownian | Brownian terrains or brownian surface is based on the diamond square based terrain algorithm: https://en.wikipedia.org/wiki/Brownian_surface The component computes peaks by a specific number of random particles. Afterwards the complete terrain will be smooth to create a realistic landscape. | 
  
-===== Creating an individual procedural terrain algorithm =====+==== Creating an individual procedural terrain algorithm ====
  
 You can also develop your own procedural algorithm by extending TRandomTerrainAlgorithm or any descendant. In the example below, we generate a random terrain:  You can also develop your own procedural algorithm by extending TRandomTerrainAlgorithm or any descendant. In the example below, we generate a random terrain: