Commit Graph

22 Commits

Author SHA1 Message Date
smix8 2e1f6b50fb Add bounds function to NavigationMeshSourceGeometryData
Adds get_bounds() function to NavigationMeshSourceGeometryData2D/3D to get a bounding box that covers all the geometry.
2024-08-19 00:12:37 +02:00
Patrick Sean Klein a1fe6ffa19
NavigationPolygon: Implement get/set_polygon fast paths. 2024-08-17 00:31:58 +02:00
Arseny Kapoulkine 0fde03c0e0 Optimize base and shadow meshes for cache
Previously, vertex cache optimization was ran for the LOD meshes, but
was never ran for the base mesh or for the shadow meshes, including
shadow LOD chain (shadow LOD chain would sometimes get implicitly
optimized for vertex cache as a byproduct of base LOD optimization, but
not always). This could significantly affect the rendering performance
of geometry heavy scenes, especially for depth or shadow passes where
the fragment load is light.
2024-08-16 07:36:12 -07:00
Rémi Verschelde 5960555f9b
Merge pull request #94726 from BastiaanOlij/primitive_texel_size_update
Make primitive meshes react to texel size change
2024-08-16 10:34:35 +02:00
Rémi Verschelde e58a7530aa
Merge pull request #93727 from zeux/raycast-opt
Disable normal raycaster for LOD generation by default
2024-08-16 10:34:03 +02:00
Bastiaan Olij b9790cef47 Make primitive meshes react to texel size change 2024-07-26 13:54:11 +10:00
Arseny Kapoulkine 18d6ae1161 Fix LOD generation for meshes with tangents & mirrored UVs
When UVs are mirrored in a mesh, collapsing vertices across the
mirroring seam can significantly reduce quality in a way that is not
apparent to the simplifier. Even if simplifier was given access to UV
data, the coordinates would need to be weighted very highly to prevent
these collapses, which would penalize overall quality of reasonable
models.

Normally, well behaved models with mirrored UVs have tangent data that
is correctly mirrored, which results in duplicate vertices along the
seam. The simplifier automatically recognizes that seam and preserves
its structure; typically models have few edge loops where UV winding is
flipped so this does not affect simplification quality much.

However, pre-processing for LOD data welded vertices when UVs and
normals were close, which welds these seams and breaks simplification,
creating triangles with distorted UVs.

We now take tangent frame sign into account when the input model has
tangent data, and only weld vertices when the sign is the same.
2024-07-23 16:35:46 -07:00
Arseny Kapoulkine a13a64eacd Disable normal raycaster for LOD generation by default
Normal raycaster makes LOD generation process >2x slower and often
generates normals that look significantly worse compared to what the
simplifier comes up with by default. This was likely different before
last meshoptimizer upgrade, as the attribute metric was not functioning
properly, but now it looks like it's doing more harm than good.

This change makes it disabled by default but keeps an easy option to
re-enable it per mesh using LOD parameters for now until we get more
confidence and can remove the code outright.

Because the long term plan would be to disable this feature entirely,
the scripting API isn't changed, and it's just off-by-default there with
no way to re-enable.
2024-07-02 10:18:15 -07:00
smix8 d4722b9e1f Fix thread-use causing navigation source geometry data corruption
Fixes navigation source geometry data corruption caused by thread-use that changed vertices or indices while the source geometry data was used in a parsing process or read from by the navmesh baking.
2024-06-21 08:06:14 +02:00
kobewi 413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
Rémi Verschelde 98cce21e78
Merge pull request #90921 from smix8/navmesh_bake_warn
Warn that navigation mesh baking from Meshes is bad for runtime performance
2024-04-22 22:18:30 +02:00
Rémi Verschelde bfca90acb7
Merge pull request #90935 from smix8/navdata_append
Add NavigationMeshSourceGeometryData append functions
2024-04-22 12:53:32 +02:00
smix8 b9225f67c8 Warn that navigation mesh baking from Meshes is bad for runtime performance
Warns that navigation mesh baking from Meshes is bad for runtime performance.
2024-04-22 12:49:47 +02:00
smix8 2594c57361 Add NavigationMeshSourceGeometryData append functions
Adds append functions to NavigationMeshSourceGeometryData.
2024-04-21 04:57:05 +02:00
Lyuma a99756a07f Expose create_from_arrays in SurfaceTool and cleanup some naming 2024-04-19 18:45:06 -07:00
Aaron Franke 77e35cf781
Move NavigationMeshSourceGeometryData(2D/3D) to the 2D/3D subfolders 2024-04-15 18:40:43 -07:00
smix8 924a5c6573 Add HeightMapShape3D update with Image data
Adds HeightMapShape3D update with Image data.
2024-04-04 02:10:00 +02:00
A Thousand Ships 79ba22a73f
Use `Vector*` component-wise `min/max/clamp` functions where applicable 2024-03-20 13:47:42 +01:00
Aaron Franke 6aac3e4a16 Disable all 3D nodes, physics, and resources when compiling without 3D 2024-03-11 01:00:55 -07:00
Micky ba867042a2 Fix Label3D, TextMesh & Font not following project default theme in editor 2024-03-09 17:35:48 +01:00
jsjtxietian 1716f12451 Expose PrimitiveMesh's `request_update`` method 2024-03-06 19:18:01 +08:00
Aaron Franke c399424db9
Move 3D-only resources to their own folder 2024-02-26 05:23:04 -06:00