Commit Graph

60 Commits (00d6190d3c7bbe39f918e8694ddc60d38c47149b)

Author SHA1 Message Date
Marc Gilleron 30db0c5193 Split VoxelBuffer in two, script-facing wrapper and internal.
The internal is the main use within the voxel engine,
and does not inherit Reference.
2021-09-26 04:14:50 +01:00
Marc Gilleron 2fda5747c6 Comments 2021-09-13 00:19:51 +01:00
Marc Gilleron 52aa4963ea Fixed some crashes occurring when giving invalid arguments to functions 2021-07-19 19:04:52 +01:00
Marc Gilleron 5fcd7f7363 Added mesh optimization option to Transvoxel, using MeshOptimizer 2021-07-11 16:19:49 +01:00
Marc Gilleron 40cd4b3b98 Fix crash in Transvoxel mesher when the input block is not cubic 2021-07-07 00:22:02 +01:00
Marc Gilleron 411be94559 Renamed ArraySlice -> Span 2021-05-31 16:48:49 +01:00
Marc Gilleron a24c56e064 Fix unused var 2021-05-31 02:11:09 +01:00
Marc Gilleron f9f7e07b33 Fix unused vars, unhandled cases and shadowing 2021-05-31 01:45:14 +01:00
Marc Gilleron a4f01b096e Moved some storage functions out of VoxelBuffer 2021-05-29 23:23:18 +01:00
Marc Gilleron f943339f31 Researching tri-channel weights storage
- No changes made for now, but the code is there if we want to switch
- Renamed functions to be more explicit
2021-05-23 20:28:06 +01:00
Marc Gilleron f5446e3d69 Fix broken vertex sharing when texture mode is enabled 2021-05-03 00:10:24 +01:00
Marc Gilleron 7e905913c9 Unused functions 2021-04-30 01:34:59 +01:00
Marc Gilleron 1f60b9c7e9 Fix used channels when the Transvoxel mesher is set to produce texture info 2021-04-30 01:34:40 +01:00
Marc Gilleron 0e2d7dc596 Comments and format 2021-04-25 20:23:52 +01:00
Marc Gilleron 8b017f460f Basic VoxelTool function to paint textures on buffers 2021-04-25 20:23:14 +01:00
Marc Gilleron 91c469bde5 Unused variable 2021-04-24 21:30:40 +01:00
Marc Gilleron bbb64a1740 Don't check bounds in release builds 2021-04-24 21:25:45 +01:00
Marc Gilleron 20547241cb Further optimizations and move to new file
- Moved Transvoxel implementation to its own file
- Optimized case where a whole block uses the same textures indices
2021-04-24 21:22:05 +01:00
Marc Gilleron b75f746ae7 Optimized Transvoxel
- Removed some conditionals using templates
- The hot path skipping empty cells is much faster
- Access to voxels is done more by index instead of position lookup
2021-04-23 22:12:39 +01:00
Marc Gilleron 82fc44d41e Restructured transvoxel logic to prepare templatization 2021-04-21 19:18:08 +01:00
Marc Gilleron dc2f853b50 First version of texturing for Transvoxel. Needs optimization and tooling. 2021-04-21 18:26:40 +01:00
Marc Gilleron 76ec90fe34 Moved constants and tables under a folder 2021-02-21 23:58:00 +00:00
Marc Gilleron d1207bdd96 Reorganized some utility files 2021-02-17 20:34:35 +00:00
Marc Gilleron 55a38957b5 Added SDF scale to VoxelTool. Default value should work best with default bit depth. 2021-01-24 13:54:38 +00:00
Marc Gilleron 24c2d88e8e Comments 2021-01-18 18:47:37 +00:00
Marc Gilleron a12144304f Optimized Transvoxel (nearly twice as fast), also allowing 16, 32 and 64 bit precision 2020-12-23 02:27:54 +00:00
Marc Gilleron 791bdafff1 Meshers are now resources assigned on terrain nodes 2020-12-18 21:01:50 +00:00
Marc Gilleron 6c80da0425 Moved VoxelBuffer and VoxelMemoryPool under storage/ directory 2020-09-14 19:33:02 +01:00
Marc Gilleron fb8a1210e3 Comment and formatting 2020-09-06 19:59:08 +01: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 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 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 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