-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
WebGLRenderer: Consider skinning / instancing when sorting objects. #28125
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
79a5ace to
d90f2cc
Compare
|
I did not have the opportunity so far to review this change, sorry. At first sight I do not understand why it's necessary to alter the render lists for your use case so this needs some time for testing and debugging. |
|
When you have a scene where the same material is used for instanced and non-instanced geometry, the sorting currently sorts by material only. As a result, you can get your instanced and non-instanced geometry with the same material rendered in any order, like: After the change the order is: The number of program changes is reduced from 7 to 3. With skinned it works the same way. |
|
@Mugen87 This is hanging here for quite a long time. It is a fix of a minor performance issue. Could someone please check it and provide a feedback? |
|
I agree this makes sense so let's give it a try. Sorry that this one got lost. |
|
Thanks for merging this. I understand it is a minor optimization which applies to a situation which is not very common, but the impact was measurable in my scenario. |
Description
Since #20135 a single material may be represented by multiple programs. In my scene I use the same material with instanced and non-instanced geometry. As a result I see frequent
needsProgramChange = trueinWebGLRenderer.setProgram.This PR adds skinning and instancing as a secondary criterion for sorting into the default
painterSortStablejust after the material id.