Marc Gilleron
9f7a081dd4
Non-cube voxels don't contribute to AO for now
2020-02-23 01:29:32 +00:00
Marc Gilleron
f5001fdc07
Merge branch 'master' into custom_blocky_mesh
...
# Conflicts:
# util/array_slice.h
2020-02-22 22:55:50 +00:00
Cory Petkovsek
40e3fdc878
Adjust PR
2020-02-15 04:09:31 +08:00
Cory Petkovsek
24841e9a18
fix gcc warnings
2020-02-13 21:49:11 +08:00
Marc Gilleron
8c16424af1
Fix usage of SDF on VoxelTerrain
...
It causes the blocky mesher to be called potentially with uniform blocks,
which is actually a valid case to handle better in the future.
2020-02-12 21:16:29 +00:00
Marc Gilleron
197c6c71bc
Use a pattern matrix to determine side culling, so it can be baked more precisely
2020-02-11 21:20:05 +00:00
Marc Gilleron
7aa33267a8
Culling masks improvements:
...
- Use a 64-bit mask instead of 8-bit
- Fix face separation when a custom mesh is used
- Automatically generate culling masks using raster approximation
2020-02-08 23:05:44 +00:00
Marc Gilleron
b2f7d23f7f
Clang-format
2020-02-06 18:52:18 +00:00
Marc Gilleron
8eae71e1cb
Added face culling masks to customize when blocky sides are getting culled
2020-02-03 16:03:44 +01:00
Marc Gilleron
6c6bd52a68
Can add custom collision AABBs to blocky voxels, for use with VoxelBoxMover
2020-02-03 10:29:25 +01:00
Marc Gilleron
9a296952b7
A blocky voxel can be defined with a custom mesh. Needs a few improvements
2020-01-31 17:53:34 +01:00
Marc Gilleron
3ec2275ffb
Moved Voxel and VoxelLibrary under the blocky mesher directory, since that's what they are actually used for
2020-01-27 00:04:13 +00:00
Marc Gilleron
aec06b214b
Merge branch 'master' into depth
2020-01-26 23:34:08 +00:00
Marc Gilleron
20dc0008f4
Removed legacy marching cubes mesher
2020-01-26 20:18:21 +00:00
Marc Gilleron
4b52d8fd18
get_channel_raw returns an ArraySlice instead of a pointer
2020-01-25 23:26:55 +00:00
Marc Gilleron
7723988b15
Merge branch 'master' into depth
...
# Conflicts:
# meshers/transvoxel/voxel_mesher_transvoxel.cpp
2020-01-25 19:46:53 +00:00
Marc Gilleron
4f9b05dfc0
Bake LOD into Transvoxel instead of scaling afterwards
2020-01-23 23:33:48 +00:00
Marc Gilleron
1e1385c86c
VoxelMesherBlocky supports 16-bit voxels
2020-01-18 19:51:21 +00:00
Marc Gilleron
09acd82c72
Merge branch 'master' into depth
2020-01-18 19:29:57 +00:00
Marc Gilleron
a4707f8943
Use integer math to interpolate cell corners, instead of floats, and untangle padding from places it didn't need to be
2020-01-13 00:43:07 +00:00
Marc Gilleron
2d1a53048c
Merge branch 'master' into depth
...
# Conflicts:
# streams/voxel_block_serializer.cpp
2020-01-10 01:43:38 +00:00
Marc Gilleron
a06de157bf
Tweaked calculation to better ensure no null normals will be produced
2020-01-06 21:48:07 +00:00
Marc Gilleron
b1c38a40c0
Fix something that prevented GCC from compiling
2020-01-06 20:08:51 +00:00
Marc Gilleron
5e066fa7cd
Fix compilation
2020-01-06 00:46:58 +00:00
Marc Gilleron
04d15fe843
Merge branch 'master' into depth
...
# Conflicts:
# meshers/blocky/voxel_mesher_blocky.cpp
# meshers/transvoxel/voxel_mesher_transvoxel.cpp
2020-01-05 23:40:44 +00:00
Marc Gilleron
ebe62cde69
Forgot this
2020-01-04 23:30:51 +00:00
Marc Gilleron
8056f7e679
Fix transition meshes not being scaled with LOD, provide LOD in mesher API
2020-01-04 23:24:33 +00:00
Marc Gilleron
a8f8a03439
Added customizable bit depth to VoxelBuffer. UNTESTED
2020-01-04 19:20:49 +00:00
Marc Gilleron
a11a95bcce
Renamed CHANNEL_ISOLEVEL => CHANNEL_SDF
2020-01-02 21:03:44 +00:00
Marc Gilleron
d4986489cf
Fix rare bug with vertex sharing causing long spiky artifacts
...
Basically we were checking case code of the ReuseCell to know if we can
re-use a vertex from it, but sometimes the associated cell did not write
a re-usable vertex, and we were not resetting such vertex indices.
So in some cases, we were accessing a very old index.
The case code doesn't need to be remembered, we just reset the first vertex.
No need to check if the ReuseCell was empty, we can read the vertex directly,
as it will be -1 anyways if it isn't re-usable. At least, this fixed the bug
and did not reproduce after testing a lot of noise data sets.
2020-01-01 00:41:21 +00:00
Marc Gilleron
ee8a70bc75
Attempt to tweak normals calculation to avoid some cases of null normals
2019-12-31 20:00:39 +00:00
Marc Gilleron
ebc6be35d1
Implement LOD transitions in VoxelLodTerrain
...
- VoxelBlock contains 6 optional transition meshes
- VoxelLodTerrain calculates transition masks when block visibility changes
- VoxelMesher can now specify different min and max paddings
- Fix Cube::SIDE_POSITIVE/NEGATIVE_X/Y/Z enum not matching Cube::g_side_normals
- Convert transition masks to make up for the Cube:: inconsistency for now
2019-12-31 16:48:46 +00:00
Marc Gilleron
e8bb2fa5e1
Implement rotated transition meshes for all 6 sides,
...
and fix miscalculated secondary positions on max edges
2019-12-28 21:38:32 +00:00
Marc Gilleron
fe3475e81e
Project secondary position along normal as described by the paper
2019-12-27 23:51:20 +00:00
Marc Gilleron
b226c14284
Compute secondary positions and a second border mask to deal with edges
2019-12-27 17:33:30 +00:00
Marc Gilleron
a9952179a7
Transition meshes WIP and bug fixes
...
- Allow meshers to specify compression flags
- Use uncompressed COLOR to fit extra vertex data for transition meshes
- Simplify a few interpolations
- Fix a few buffer overruns which were not detected by the debugger
- Use array wrappers to better detect overrun mistakes
2019-12-26 20:29:55 +00:00
Marc Gilleron
d768af5bdd
Implemented transition meshes, in very basic form.
...
Work remains to be done:
- Transform the mesh into proper orientation
- Introduce secondary positions to make it fit in a regular block
- Make it available in the API and use it in terrain nodes
2019-12-23 21:44:25 +00:00
Marc Gilleron
6977133006
Forked Transvoxel mesher into an MC one with overlap seam mode.
...
It's mostly because the transvoxel mesher is going to change,
and the MC mesher will only act as a simplified legacy mesher.
It has experimental support for overlap seams, but it didn't work
well due to Z-buffer precision being too weak.
2019-12-23 21:41:30 +00:00
Marc Gilleron
28d45fa758
Was using wrong triangle table for marching squares. Didn't see any difference tho.
2019-12-16 19:55:35 +00:00
Marc Gilleron
3e52295279
Comment about asymetry
2019-12-15 03:24:03 +00:00
Marc Gilleron
a79404f96c
Use proper name in include guard
2019-12-15 03:23:23 +00:00
Marc Gilleron
6568ce3a5f
Expose minimum padding
2019-12-15 03:23:06 +00:00
Marc Gilleron
56dc78b8cc
Align transvoxel with other meshers, its results were offset cuz its padding is asymetric
2019-12-15 03:22:37 +00:00
Marc Gilleron
add32f89a9
Invert SDF in Transvoxel mesher, otherwise it was producing inverted results...
2019-12-14 21:34:08 +00:00
Marc Gilleron
28cb74e9b1
Fix invalid normals causing occasional shading artifacts
2019-12-14 21:32:30 +00:00
Marc Gilleron
cef43e4087
Take voxel color into account in blocky mesher
2019-09-11 20:10:08 +01:00
Marc Gilleron
959f4432dd
A bit of code grooming
2019-09-10 20:42:07 +01:00
Marc Gilleron
026fa96654
Fix mesh corruption when using two different materials
2019-09-10 20:40:42 +01:00
Marc Gilleron
f59b34f1a0
Fix material assignments being shifted if one of the surfaces has no vertex
2019-09-10 20:04:08 +01:00
Marc Gilleron
a0c7201fcd
Rename `get_stats()` => `get_statistics()`
2019-08-25 17:40:19 +01:00