[BREAKING] More general instancing #6867
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4878
Marked as BREAKING, as in case the user modified transformVS chunk, this needs to be updated to the new format. But no public API has been changed otherwise, and the default instancing works exactly as before.
https://x.com/ValigurskyM/status/1819367152614260934
This PR adds a user exposed and more generic version of hardware instancing. Details:
transformVS
chunk has been moved totransformInstancingVS
chunk. This implements the existing instancing, where 4 x Vec4 are passed in by the vertex buffer, representing a world matrix.Example of custom instancing for StandardMaterial:
Example of custom instancing for ShaderMaterial. Shader variations for instancing are created automatically if instancing is set up on the mesh instance using this material.
New examples
ShaderMaterial using instancing:
Custom StandardMaterial instancing: