Formatting fixes

master
Marc Gilleron 2021-05-31 16:11:58 +01:00
parent 35de0883d2
commit fcab95427b
1 changed files with 17 additions and 16 deletions

View File

@ -111,17 +111,18 @@ WEIGHTS: aaaa bbbb cccc dddd
By default, these channels default to indices `(0,1,2,3)` and weights `(1,0,0,0)`, meaning voxels always start with texture `0`. By default, these channels default to indices `(0,1,2,3)` and weights `(1,0,0,0)`, meaning voxels always start with texture `0`.
!!! warn The feature is recent and will need further work or changes in this area.
The feature is recent and will need further work or changes in this area. At the moment, indices and weights are mostly applied manually. It is possible to set them directly with `VoxelTool.set_voxel` but it is up to you to pack them properly. One easy way to paint is to use `VoxelTool.do_sphere()`:
At the moment, indices and weights are mostly applied manually. It is possible to set them directly with `VoxelTool.set_voxel` but it is up to you to pack them properly. One easy way to paint is to use `VoxelTool.do_sphere()`:
```gdscript ```gdscript
# Paints texture 2 in a sphere area (does not create matter) # Paints texture 2 in a sphere area (does not create matter)
voxel_tool.set_mode(VoxelTool.MODE_TEXTURE_PAINT) voxel_tool.set_mode(VoxelTool.MODE_TEXTURE_PAINT)
voxel_tool.set_texture_index(2) voxel_tool.set_texture_index(2)
voxel_tool.set_texture_opacity(1.0) voxel_tool.set_texture_opacity(1.0)
voxel_tool.do_sphere(hit_position, radius) voxel_tool.do_sphere(hit_position, radius)
``` ```
It is also possible to generate this in `VoxelGeneratorGraph` using special outputs, but it still requires a bit of math to produce valid data.
It is also possible to generate this in `VoxelGeneratorGraph` using special outputs, but it still requires a bit of math to produce valid data.
#### Mesh data #### Mesh data
@ -157,7 +158,8 @@ vec4 decode_8bit_vec4(float v) {
float((i >> uint(24)) & uint(0xff))); float((i >> uint(24)) & uint(0xff)));
} }
// A voxel mesh can have overhangs in any direction so we may have to use triplanar mapping functions. // A voxel mesh can have overhangs in any direction,
// so we may have to use triplanar mapping functions.
vec3 get_triplanar_blend(vec3 world_normal) { vec3 get_triplanar_blend(vec3 world_normal) {
vec3 blending = abs(world_normal); vec3 blending = abs(world_normal);
blending = normalize(max(blending, vec3(0.00001))); // Force weights to sum to 1.0 blending = normalize(max(blending, vec3(0.00001))); // Force weights to sum to 1.0
@ -313,8 +315,7 @@ Note: this is an example of implementation. There might be more optimized ways t
This will discard such that pixels of the two meshes will be complementary without overlap. `discard` is used so the mesh can remain rendered in the same pass (usually the opaque pass). This will discard such that pixels of the two meshes will be complementary without overlap. `discard` is used so the mesh can remain rendered in the same pass (usually the opaque pass).
!!! warn This technique is still imperfect because of several limitations:
This technique is still imperfect because of several limitations: - Transition meshes used to stitch blocks of different LOD are currently not faded. Doing so requires much more work, and in fact, the way these meshes are handled in the first place could be simplified if Godot allowed more fine-grained access to `ArrayMesh`, like switching to another index buffer without re-uploading the entire mesh.
- Transition meshes used to stitch blocks of different LOD are currently not faded. Doing so requires much more work, and in fact, the way these meshes are handled in the first place could be simplified if Godot allowed more fine-grained access to `ArrayMesh`, like switching to another index buffer without re-uploading the entire mesh. - Shadow maps still create self-shadowing. While both meshes are rendered to cross-fade, one of them will eventually project shadows on the other. This creates a lot of noisy patches. Turning off shadows from one of them does not fix the other, and turning shadows off completely will make shadows pop. I haven't found a solution yet. See https://github.com/godotengine/godot-proposals/issues/692#issuecomment-782331429
- Shadow maps still create self-shadowing. While both meshes are rendered to cross-fade, one of them will eventually project shadows on the other. This creates a lot of noisy patches. Turning off shadows from one of them does not fix the other, and turning shadows off completely will make shadows pop. I haven't found a solution yet. See https://github.com/godotengine/godot-proposals/issues/692#issuecomment-782331429