Added screenshots of basic generators to the doc
parent
bd09b18911
commit
5e99992cb3
|
@ -4,6 +4,8 @@
|
|||
Graph-based generator for smooth voxel worlds.
|
||||
</brief_description>
|
||||
<description>
|
||||
Generates SDF voxel data from a graph of operations.
|
||||
Warning: methods to modify the graph should only be called from the main thread.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
@ -7,19 +7,94 @@ Generators
|
|||
How generators work
|
||||
----------------------
|
||||
|
||||
TODO
|
||||
Generators currently run on the CPU and primarily work on blocks of voxels. For example, given a `VoxelBuffer` of 16x16x16 voxels, they decide what value each one will take. Using blocks makes it easier to split the work across multiple threads, and focus only on the area the player is located, especially if the world is infinite.
|
||||
|
||||
Voxel data is split into various channels, so depending on the kind of volume to generate, one or more different channels will be used. For example, a Minecraft generator will likely use the `TYPE` channel for voxel types, while a smooth terrain generator will use the `SDF` channel to fill in distance field values.
|
||||
|
||||
Generators have a thread-safe API. The same generator `generate_block` method may be used by multiple threads at once. However, depending on the class, some parameters might only be modifiable from the main thread, so check the documentation to be sure.
|
||||
|
||||
If a volume is not given a generator, blocks will be filled with air by default.
|
||||
|
||||
|
||||
Basic generators
|
||||
-------------------
|
||||
|
||||
These generators are simple examples to get a quick result, and showing how the base API can be implemented.
|
||||
The module provides several built-in generators. They are simple examples to get a quick result, and showing how the base API can be implemented (see source code).
|
||||
|
||||
TODO Info/screenshots about them
|
||||
Some of these generators have an option to choose which channel they will work on. If you use a smooth mesher, use the `SDF` channel (1), otherwise use the `TYPE` channel (0).
|
||||
|
||||
The following screenshots use a smooth `VoxelLodTerrain`.
|
||||
|
||||
### [Flat](api/VoxelGeneratorFlat.md)
|
||||
|
||||
Generates a flat ground.
|
||||
|
||||
![Screenshot of flat generator](images/generator_flat.png)
|
||||
|
||||
### [Waves](api/VoxelGeneratorWaves.md)
|
||||
|
||||
Generates waves.
|
||||
|
||||
![Screenshot of waves generator](images/generator_waves.png)
|
||||
|
||||
### [Image](api/VoxelGeneratorImage.md)
|
||||
|
||||
Generates a heightmap based on an image, repeated infinitely.
|
||||
|
||||
![Screenshot of image generator](images/generator_image.png)
|
||||
|
||||
!!! note
|
||||
With this generator, an `Image` resource is required. By default, Godot imports image files as `StreamTexture`. You may change this in the Import dock. At time of writing, in Godot 3, this requires an editor restart.
|
||||
|
||||
### [Noise2D](api/VoxelGeneratorNoise2D.md)
|
||||
|
||||
Generates a heightmap based on fractal noise.
|
||||
|
||||
![Screenshot of 2D noise generator](images/generator_noise2d.png)
|
||||
|
||||
### [Noise (3D)](api/VoxelGeneratorNoise3D)
|
||||
|
||||
Generates a blobby terrain with overhangs using 3D fractal noise. A gradient is applied along height so the volume becomes air when going up, and closes down into matter when going down.
|
||||
|
||||
![Screenshot of 3D noise generator](images/generator_noise3d.png)
|
||||
|
||||
|
||||
Node-graph generators
|
||||
----------------------
|
||||
Node-graph generators (VoxelGraphs)
|
||||
------------------------------------
|
||||
|
||||
Basic generators may often not be suited to make a whole game from, but you don't necessarily need to program one. If you need smooth terrain, a graph-based generator is available, which offers a very customizable approach to make procedural volumes.
|
||||
|
||||
This generator currently doesn't support blocky terrains.
|
||||
|
||||
### Concept
|
||||
|
||||
TODO
|
||||
|
||||
### Examples
|
||||
|
||||
TODO
|
||||
|
||||
### Performance tuning
|
||||
|
||||
This generator uses a number of optimization strategies to make the calculations faster. You may want to fine-tune them in some cases depending on the kind of volume you want to generate.
|
||||
|
||||
#### Buffer processing
|
||||
|
||||
TODO
|
||||
|
||||
#### Range analysis
|
||||
|
||||
TODO
|
||||
|
||||
#### SDF clipping
|
||||
|
||||
TODO
|
||||
|
||||
#### Local optimization
|
||||
|
||||
TODO
|
||||
|
||||
#### Subdivision
|
||||
|
||||
TODO
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 350 KiB |
Binary file not shown.
After Width: | Height: | Size: 885 KiB |
Binary file not shown.
After Width: | Height: | Size: 719 KiB |
Binary file not shown.
After Width: | Height: | Size: 892 KiB |
Binary file not shown.
After Width: | Height: | Size: 543 KiB |
|
@ -122,6 +122,18 @@ func _notification(what: int):
|
|||
Image.lock() won't be required anymore in Godot 4.
|
||||
|
||||
|
||||
### Accessing neighbors to generate structures
|
||||
|
||||
Generators cannot access neighbor blocks, because they may be dependent on neighbors themselves, and may, or may not be available yet. It's also bad for performance to have threads interdepend on others. The solution to overcome this is to use a seed to drive every calculations so results are predictable.
|
||||
|
||||
Noise-based terrain usually don't need any dependency on neighbors, since any queried voxel position will always yield the same values.
|
||||
|
||||
Generating structures like trees in a Minecraft world is however a bit more complicated.
|
||||
|
||||
TODO Explain the logic behind the demo
|
||||
https://github.com/Zylann/voxelgame/blob/2fa552abfdf52c688bbec27edd676018a31373e0/project/blocky_game/generator/generator.gd#L144
|
||||
|
||||
|
||||
Custom stream
|
||||
---------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue