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
OutlinePass: Support meshes with grouped BufferGeometry #24152
Conversation
Sorry, but I think this change introduces an inappropriate complexity to @mrdoob This is another good example why I think multi-material support should be removed. @ingun37 If possible, please avoid using |
@Mugen87 I have a question. If I use separate Mesh then how can I share index buffer between different Meshes? I thought the point of using BufferGeometry.Groups was in there. |
I don't think this was the primary intention. It's more a side effect that occurs when using a multi-material mesh. However, you still end up with multiple draw calls. Splitting up the index buffer into multiple ones or just using non-indexed geometries right from the beginning should have no noticeable impact on performance. It should also be easier to handle and process geometry data (although this is somewhat subjective). |
Since we have stated to not add multi-material specific logic to example modules like exporters (see #22555), it's only consistent to apply the same principle to post processing passes. |
@Mugen87 In my case there are many Meshes associated to the same geometry but different index ranges and materials. Interestingly enough I recently compared two versions of my library, one avoid dividing geometry by utilizing Not only performance but code also had gotten much tidy being somewhat more natural data structure for my case. It's sad to hear you are planning to remove |
There are no concrete plans yet (e.g. a fixed release). Do you mind demonstrating the performance differences with two live examples? |
@Mugen87 sure, ill try and let you know |
Sidenote: In certain use cases however, it might be more resource efficient to reuse buffer attributes across geometries and use |
@Mugen87 Here's the live examples.
They try to load the same dummy data with the same code except the second one converts using
I have question to this comment. Does sharing |
Basically yes. The draw range is just defined differently (not via |
@Mugen87 Just letting you know to thank you that I changed from using |
Good to hear that! I'm also glad you have made the performance analysis since it demonstrates the limitations of |
Description
OutlinePass takes extra parameter
selectedMaterialGroups: Map<Mesh, Material[]>
which enables outlining each BufferGeometry Group. Each (Mesh, Material[]) pair represents which sub-geometries (identified by Materials) should be outlined.I have tested various combinations of (Material.visible * material selection) and they all worked correctly so far.