Commit Graph

275 Commits (master)

Author SHA1 Message Date
Marc Gilleron 5c34fa3a9a Merge branch 'master' into storage_refactoring 2022-08-30 00:10:32 +01:00
Marc Gilleron 8d8fad51d5 Unnecessary forward-declaration 2022-08-30 00:08:41 +01:00
Marc Gilleron 414aea52f3 Replaced VoxelDataMap with VoxelData in VoxelLodTerrain 2022-08-28 20:45:42 +01:00
Marc Gilleron dfbd7abfc1 Add missing argument names from class methods 2022-08-28 02:25:29 +01:00
Marc Gilleron ca29cde90d Rename lod => lod_index 2022-08-24 23:53:22 +01:00
Marc Gilleron 414d1ce2b8 Use common constant 2022-08-21 03:12:20 +01:00
Marc Gilleron f8883966db Split Godot utilities in their own files 2022-08-20 18:25:23 +01:00
Marc Gilleron a28a172763 Fix wrong block coordinate systems when computing normalmaps and a few other things 2022-08-17 22:23:13 +01:00
Marc Gilleron 5943b1d549 Moved VirtualTextureOutput out of VoxelMesher 2022-08-14 22:34:27 +01:00
Marc Gilleron 92b3c25292 Moved distance_normalmaps to engine/ since it doesn't depend on meshers 2022-08-14 21:53:59 +01:00
Marc Gilleron bab04748b3 Make normalmap baking more independent
- The baking code no longer depends on Transvoxel
- Moved usage out of the Transvoxel mesher, but still uses its fastpath
  for cells. There is still no "generic" path because there is no need yet.
- Moved settings on VoxelLodTerrain.
2022-08-14 19:15:55 +01:00
Marc Gilleron cf43ff5201 Missing include 2022-08-13 16:58:06 +01:00
Marc Gilleron dbbab6a81d Separate normalmap baking from meshing, so meshes don't have to wait.
- The option for having it separate is hardcoded and both code paths still
  exist. Not sure if that will be exposed or removed entirely.
- Still need to limit the frequency at which normalmaps are updated
- Would be nice to make this mesher-independent,
  Transvoxel is just a fastpath
- Task priority might need improvement, it's a bit messy. Maybe use bands?
2022-08-13 16:40:46 +01:00
Marc Gilleron 0b26071663 Support edited voxels in distance normalmaps 2022-08-09 23:56:38 +01:00
Marc Gilleron b0cd02a2ef Support modifiers in distance normalmaps 2022-08-07 23:03:45 +01:00
Marc Gilleron 5bb0f4a508 Fix some signedness GCC warnings 2022-08-07 23:00:41 +01:00
Marc Gilleron fcd1fc38a5 Group properties in VoxelMesherTransvoxel 2022-08-07 18:05:16 +01:00
Marc Gilleron 04bc2110df Default octahedral encoding to false for now because it doesnt look good enough 2022-08-07 17:46:20 +01:00
Marc Gilleron c15ded67f6 Vary tile size with LOD and integrate to VoxelLodTerrain 2022-08-07 16:40:27 +01:00
Marc Gilleron 8dab1e8f2a Fail earlier if the generator does not support series generation 2022-08-07 16:15:51 +01:00
Marc Gilleron c645bb708d Comments 2022-08-06 23:15:42 +01:00
Marc Gilleron dcc5e3c174 Added option for octahedral encoding of normals to save memory 2022-08-04 21:19:02 +01:00
Marc Gilleron 3606ab9b93 No need to cache direction 2022-08-04 21:16:33 +01:00
Marc Gilleron 3ee3931824 Separated function to store into images only 2022-08-03 21:43:57 +01:00
Marc Gilleron bde74f0785 Store final normals encoded instead of full vec3f, and copy into Image instead of using set_pixel 2022-08-03 21:31:29 +01:00
Marc Gilleron 6c0a1e4463 Missing ref 2022-08-03 21:05:26 +01:00
Marc Gilleron 9973ac5e3a Split into functions a bit 2022-08-03 19:31:24 +01:00
Marc Gilleron adbe393440 Optimized triangle raycasts a bit 2022-08-03 18:49:46 +01:00
Marc Gilleron 2d757c7ece Moved distance normalmaps code to its own file 2022-07-31 23:04:36 +01:00
Marc Gilleron 0c3b103689 Improvements
- Project samples on triangles to make cells more seamless,
  instead of a box of samples on a quad. Requires 2x more samples.
- Don't sample when there is no triangle for a given pixel
- Dilate normalmaps to reduce artifacts on edge of triangles
- Moved math functions about triangles in their own file
2022-07-31 22:42:05 +01:00
Marc Gilleron fcddf4da61 WIP normalmaps for Transvoxel.
Adds enough stuff to test the approach. It is not correct at the
moment, probably needs to project to triangles to make cells line up,
currently it's using planes. There might be incorrect coordinates too,
did that with bit of guessing. A grid-like pattern is also showing, so
might have to make tiles a bit larger to account for filtering.
2022-07-31 16:14:36 +01:00
Marc Gilleron 7254dcb7fc Template vector types 2022-07-17 18:34:05 +01:00
Marc Gilleron ac62a05346 Fix errors caused by empty materials in VoxelBlockyLibrary 2022-07-16 19:39:36 +01:00
Marc Gilleron c13303b464 Fix material properties were listing unsupported types 2022-07-16 17:37:22 +01:00
Marc Gilleron ec24204ecc Add override specifiers 2022-07-03 03:39:50 +01:00
Marc Gilleron 6e501811d1 Unused variable 2022-06-26 19:21:21 +01:00
Marc Gilleron afb83285f0 Update Transvoxel shader in docs, remove unnecessary shift 2022-06-26 18:33:03 +01:00
Marc Gilleron d9b74359f8 Provide a default material for VoxelMesherTransvoxel with variable-lod 2022-06-26 17:21:05 +01:00
Marc Gilleron eaa40876b8 Don't generate transition meshes when VoxelMesherTransvoxel is used in a fixed-lod volume 2022-06-26 17:20:08 +01:00
Marc Gilleron 647be47395 Fix secondary positions in positive axes 2022-06-25 17:28:00 +01:00
Marc Gilleron ce91b3890c Combine regular and transition meshes together.
- Less draw calls
- Much faster rendering updates (about 5x),
  although colliders are still the biggest bottleneck so when collision is
  enabled this improvement isn't noticeable
- A shader is now always required to render Transvoxel properly.
  TODO: integrate a default one when no material is assigned?
2022-06-25 16:47:09 +01:00
Marc Gilleron 13a9bf7deb Prefix `tls` 2022-06-23 19:39:53 +01:00
Marc Gilleron c7d8c2557c Attempting to give priority to main mesh building over transition meshes.
This effectively creates them after ALL main meshes have been built,
resulting in a seemingly faster convergence of LOD, however when moving
around it causes some cracks to appear briefly. This can be bad if the
terrain is dark and the underlying skybox is bright. Might need to be
optional, or find a different approach.
2022-06-22 22:05:25 +01:00
Marc Gilleron c51f3d8005 Merge branch 'modifiers' 2022-06-20 19:53:23 +01:00
Marc Gilleron 317cd23616 Fix per-surface collision generation in VoxelMesherBlocky 2022-06-19 22:57:55 +01:00
Marc Gilleron 19f94e9912 Merge branch 'master' into modifiers 2022-06-19 21:41:38 +01:00
Marc Gilleron a01fffd906 Fix mesh collision should be exposed as a boolean 2022-06-19 17:56:42 +01:00
Marc Gilleron 86ba74ce3a Some changes and fixes related modifiers
- VoxelLodTerrain no longer caches generated voxels by default, so
  generating on the fly is no longer exclusive to full load mode.
  Might add an option later, but not for now (VoxelTerrain is still
  unaffected and keeps caching them)
- The "Cached" state is represented with blocks having no voxel data,
  so it needs extra checks in some areas to avoid null access
- Fix generate task was not including modifiers after the base generator
- The "save_generator_output" option on streams now means such blocks are
  considered edited
- Modifying modifiers now clears cached generated blocks
  intersecting with them.
- Fix "re-generate" was erasing the internal stack of modifiers
- Added docs
2022-06-18 23:14:18 +01:00
Aaron Franke 3c37bb95a5
Add RWLock include to VoxelMeshLibrary header 2022-06-04 14:41:59 -05:00
Marc Gilleron 8966ad5b1f Fix holes in geometry with Transvoxel 2022-06-03 17:30:38 +01:00