Commit Graph

374 Commits (badf3876c38485d2cdb7be9bbbc538f49062dbc1)

Author SHA1 Message Date
Marc Gilleron badf3876c3 When a block is not visible, remove it from world instead 2020-01-07 02:04:24 +00:00
Marc Gilleron 051034fc51 Improve transition mask calculation on world borders.
It fixes a case where a block at world border would remain with
a transition mask of 0 when a neighbor block of lower LOD becomes visible.
Now a block side bordered by an empty area will assume transition.
2020-01-07 00:22:58 +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 dacd18b772 Added function to debug pointed blocks 2020-01-05 23:27:43 +00:00
Marc Gilleron 3ead96f06e Added option to tweak how VoxelStreamImage samples the heightmap 2020-01-05 22:42:02 +00:00
Marc Gilleron 462e453cf4 Fix thin cracks caused by pooled material params not being reset when reused 2020-01-05 04:57:40 +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 716b820599 Remove VoxelIsoSurfaceTool, superseded by VoxelTool 2020-01-02 21:07:23 +00:00
Marc Gilleron a11a95bcce Renamed CHANNEL_ISOLEVEL => CHANNEL_SDF 2020-01-02 21:03:44 +00:00
Marc Gilleron 3c3fe017d8 Remove channel enum from Voxel, it was redundant with VoxelBuffer 2020-01-02 20:46:27 +00:00
Marc Gilleron a4b806a9f2 Optimize uniform buffers generated by VoxelStreamImage 2020-01-02 20:31:43 +00:00
Marc Gilleron f2975e517a Add memory pool for VoxelBuffer channels 2020-01-02 20:31:05 +00:00
Marc Gilleron d8677cd663 Fix heavy stuttering caused by ShaderMaterial 2020-01-02 20:29:40 +00:00
Marc Gilleron 31f588c1a1 Add profiling scopes to VoxelLodTerrain, also fix usage in VoxelStream 2020-01-02 20:29:02 +00:00
Marc Gilleron 68e35744b2 Rewrite profiler dump to not use Godot API, also allow to use a singleton 2020-01-02 20:24:20 +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 44f84a9422 Template max() so places using int don't have to go through float 2019-12-31 16:37:40 +00:00
Marc Gilleron 2d32eebed5 Remove VoxelStreamNoise buffering optimization, it was introducing LOD cracks 2019-12-31 16:32:16 +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 6b05b9c9ce Expose VoxelBuffer.downscale_to 2019-12-26 20:30:20 +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 9dcf8c83cb Did not need to be included in header 2019-12-23 21:36:34 +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 8322617110 Merge branch 'master' of https://github.com/Zylann/godot_voxel 2019-12-14 21:35:10 +00:00
Marc Gilleron 2e974444c6 Implement VoxelTool for VoxelBuffer 2019-12-14 21:34:41 +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 cfe6eb3313
Merge pull request #85 from tinmanjuggernaut/fix_macro_errors
Fix build errors due to Godot macro change
2019-11-18 14:29:09 +01:00
Cory Petkovsek 4820998c56 Fix build errors due to Godot macro change 2019-11-13 13:20:05 +08:00
Marc d70dfca8ea
Merge pull request #76 from tinmanjuggernaut/doc_update
Update docs
2019-10-05 18:54:38 +02:00
Cory Petkovsek 629631e1d9 Update docs 2019-10-05 22:35:13 +08:00
Marc bd857dcdfc
Merge pull request #65 from tinmanjuggernaut/mono-build-errors
Fix mono & gcc build issues
2019-10-03 20:24:31 +02:00
Cory Petkovsek 9a06cdd3ef Fix mono build warnings 2019-10-04 02:17:44 +08:00
Marc Gilleron 2b15ca6457 Remove `for_all_blocks` from header, it causes compilation error due to `map` not being fully defined. Move logic to .cpp file to keep it forward-declared. 2019-10-03 18:55:13 +01:00
Marc Gilleron e783c75242 Register missing class to fix C# binding 2019-09-24 18:48:30 +01:00
Marc Gilleron 1a1b46cfd8 Don't use individual set_voxel edits in do_sphere 2019-09-11 21:30:26 +01:00
Marc Gilleron d4e7ac7845 Fix do_sphere(), the bounding box wasn't lining up 2019-09-11 21:25:15 +01:00
Marc Gilleron cef43e4087 Take voxel color into account in blocky mesher 2019-09-11 20:10:08 +01:00