Open Nielsbishere opened 5 years ago
2/4 light changes addressed in feature_optimization_lights;
Lighting is currently updated every frame. This can be optimized by keeping track of a boolean that specifies whether a update is required.
Setting up lights takes too much time, LightNodes should have a Light* that can can change location depending on if LightNodes before it have been deallocated (it should be one filled array of Light).
For raytracing:
The current implementation of instancing could be optimized. Currently it always updates the mesh batches and sends it to the GPU, the reason is that setting a pointer on init for MeshNode won't be valid if another MN gets destructed. This could potentially be fixed by moving MeshNodes after the destructed MN back a step, requiring them to be recalculated next frame. This same issue is present with the current light system.
All optimizations & changes for draw calls include:
Include instancing into vertex buffers (Con: requires changes to root signatures, it is less easy to add per object data and matrices can't be sampled directly, Pro: Is faster)
Instancing is limited to n instances where n = 48 * 1024 / 80, because buffers bigger than 48 KiB get slow. Of course this hard limit can be changed, but is discouraged for speed.
When a batch is out of space it doesn't allocate a new batch, causing a cut off after 614 instances.
SceneGraph::Optimize takes too much time, MeshNodes should have an ObjectData* that can change location depending on if MeshNodes before it have been deallocated (it should be one filled array of ObjectData).
(Scope increaser): Multi Draw Indirect could be used to batch up all kinds of geometry, which would require VBO and IBO to allow suballocating meshes into it
(Scope increaser): Parts of geometry could be culled with a compute shader (or on CPU), MDI with this technique would be a lot of performance gain.
Optimizations & changes for lighting include:
Setting up lights takes too much time, LightNodes should have a Light* that can can change location depending on if LightNodes before it have been deallocated (it should be one filled array of Light).
(Scope increaser): Lights could be culled with either CPU or compute shader
(Scope increaser): Clustered Deferred Rendering severely decreases the number of light calculations