4,119 Commits over 1,219 Days - 0.14cph!
Merging rewrite back into global_networked_bases
Reconverted all building block prefabs & now all roofs work
Fixed converter not overwriting buildingblock prefabs when using converting tool
Reimplemented LOD level inside InstancedLODState config class
Fixed NativeArray of render data not being resized when the computebuffer is resized
Fix IndirectExtraArg being multiplied by 5, causing meshes to render on top of eachother
Fix typo causing distance culling to use fov scale instead of max distance (culling everything)
Fix & refactor cell removal code
More refactoring & fixes
Fixed IndirectArgs buffer being set to Structured accidently (which silently fails)
Rewrote "MeshScheduler" into 5+ different classes and split responsibilities
Replaced block allocator with fixed size cell allocator
Refactored tons of code to make it readable, organized and reliable
Add `force_lod_level` convar to force the culling system to only accept certain LOD levels (and bypass culling for them) to narrow down why certain LODs are disappearing "randomly"
Store LOD level of each mesh in `InstanceLODState`
Still debugging mesh culling randomly breaking
Region out client analytics variables that are "assigned but never used" when compiling client
Move shadows to their own grids
Distance cull both meshes & shadows
Only frustum cull meshes
Fix `test_instancing_culling` spawning prefabs outside of the map and overloading the "out of map" grid
Fix "outside of map" grid not having a gridId set and looking like grid #0
Refactor RendererJobData to store ShadowMode instead of "IsOnlyShadow"
Refactor culling system to completely ignore shadows
Change InstancedScheduler script update order to near the end
Count number of meshes & shadows separately
Add number of rendered meshes, shadows & draw calls for instancing to `perf 8`
Add average number of meshes & shadows drawn to client performance analytics
Add `print_instanced_grid {id}` and `print_instanced_grids` to print meshes per grid for debugging
Add menu option for instanced rendering called "Building Distance" (it also handles cliffs but yea)
Clamp instanced rendering distance from 500 - 2500
Take lower of draw distance vs instanced render distance when culling
Run codegen to apply convar descriptions
Add description to all convars
Add clientside performance analytics for instanced rendering
- culling time
- draw calls
- render distance
- size of compute buffers & arrays
- mesh count
- prefab count
- entity count
Add `shadow_culling` convar to toggle culling of shadows for instanced rendering
Disable shadow culling by default
Fix meshes with skins registering a extra renderer
Add `instanced_memory_usage` command to print off size & memory usage of every array used for instanced rendering
Remove some redundant convars
Add `--instanced-rendering` convar to turn instanced rendering on (if we need it default disabled)
Check if deathInfo.attackerName is null (no idea why this appeared on aux2 but need to fix to keep testing)
Enable GPU instancing on brick roof material
Run Initialize() when leaving server to cleanup all arrays
Cleanup code of all schedulers
Try ComputeBuffer.SetData() instead of ComputeBuffer.BeginWrite() when expanding the compute buffer
Fix MaterialPropertyBlocks not having new ComputeBuffers assigned when the ComputeBuffer is "resized"
More cleanup & hopefully fixes
Update global_networked_bases/2021
Fix stackoverflow from typo
Fix setting DrawCallCount to material count instead of submesh count
Refactor & fix writing IndirectArgs
Refactor & fix initialization / cleanup of arrays + compute buffers
Fix IndirectArgs not being rewritten after expanding the compute buffer
Support renderers that have more submeshes than materials
Remove redundant testing convars
Trying to fix errors that appear in CLIENT mode but not CLIENT + SERVER on craggy
Fix IndirectArgs ComputeBuffer not expanding because it is 5 uint each draw call
Merge from main -> global_networked_bases
Cherrypick
84979 (BeginWrite two new compute buffers)
Fix 2021 to use BeginWrite() & EndWrite() on the two new ComputeBuffers (IndirectArgs & InstanceOffsets)
Update global_networked_bases/2021
Add `use_command_buffers` command to toggle between Graphics.DrawMeshInstancedIndirect() and CommandBuffers
Can use convar at runtime to switch back and forfth
Added manually submitting draw calls back as CommandBuffers broke lighting & were slower after first iteration
Finally fixed the rendering so opaque geometry & shadows are kept in separate command buffers... although I would need to add the shadow commandbuffer to each light now
Give name to the the instanced CommandBuffer & CommandBuffers created by `CommandBufferSystem`
It now renders with the command buffer, just gotta figure out incorrect lighting, multiple meshes overlapping & lighting turning off every 1s
Submit DrawCalls via `CommandBuffer` instead of `Graphics.DrawMeshInstancedIndirect()`
Hook `MainCamera.OnPreCull()` via a `InstancedCameraComponent` instead of static Action
Change shaders to use a commandBuffer to get the start index of each drawcall instead of passing an index into each MaterialPropertyBlock
(not completely done, more of a stash)
Remove instanced rendering from furnace & planters as they require an extra color to be passed in
Some materials missed
Merge from main -> global_networked_bases
See if small tweak fixes "virtual mesh not found"
Enabling material instancing on a few electrical materials (not custom instancing)