Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
1.0.0:terrain [2023/02/22 14:57] – created - external edit 127.0.0.1 | 1.0.0:terrain [2023/02/23 16:47] (current) – [Configuration] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
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 | + | 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 " | ||
+ | - 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. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Choose one of the " | ||
+ | |||
+ | 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 " | ||
+ | |||
+ | After you have loaded | ||
+ | |||
+ | {{: | ||
+ | |||
+ | 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 " | ||
+ | |||
+ | {{: | ||
+ | |||
+ | === 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 " | ||
+ | |Instance Scale | A basis scaling of each instance (will be multiplied with source scale if "Apply Source Transformation" | ||
+ | |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 " | ||
+ | |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:// | | Brownian | Brownian terrains or brownian surface is based on the diamond square based terrain algorithm: https:// | ||
- | ===== 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: |