-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mesh: add thin instances #8208
Mesh: add thin instances #8208
Conversation
Hum, shouldn't I add an optional parameter to the |
sounds totally fine to me :-) |
Also should try to ensure we use the types that are not creating dupplicate in the engine updateBuffer ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALLL GOOD. You rock
Can you add a visual test for thinInstances?
I also wonder if we shouldn't also let the user be able to set the current number of instances (but always < matrixBuffer.length / 16): that way, they would be able to allocate a bigger buffer at start in case they need to have more instances during the course of the program, they would not have to reallocate / copy a buffer each time they have to add an instance. |
Visual test added |
I took model on the regular instance implementation for the thin instance implementation:
_thinInstanceDataStorage
of type_ThinInstanceDataStorage
to hold the main data (much like_instanceDataStorage
/_InstanceDataStorage
)._userThinInstanceBuffersStorage
to hold data for additional custom attributes other than the matrices (much like_userInstancedBuffersStorage
). This way, if no custom attributes are added, no penalty paidI have prefixed all methods by
thinInstance
, I can change that (notably,addThinInstance
isthinInstanceAdd
instead).By default, the bounding box is recomputed to encompass all thin instances, but it can be disabled by setting
doNotSyncBoundingInfo
totrue
(already existing property).As discussed, thin instances are always displayed with shader code assuming non uniform scaling, but with an optimized code (shearing not supported).