Home › Forums › Graphics / Blender › Optimizing a model with Instances and Data Transfer Modifier
-
AuthorPosts
-
2024-11-15 at 5:30 pm #78823adamabrCustomer
Hi there!
I’ve been exploring the potential of dividing an object into linked instances along its symmetry planes. The idea is simple. If you have a symmetrical object, cut it along the symmetry plane, make a linked duplicate, and use that for the other half.
Based on what I can find linked instances can be used to minimize the size of the exported bin file. This would reduce load times which is desirable.
When first trying this, I encountered a few issues.
Issues:
a) Normals are not continuous, you can clearly see the seams if the surface isn’t flat.
b) Textures will be symmetric as well, which can look funky.
c) The number of render calls becomes very high if you take this far.Solutions:
a) The seams can be remedied by keeping a copy of the original object and adding a Data Transfer Modifier to the instances. We then transfer the normals from the copy of the original to the instances. This works well in Blender and in Verge3D.b) Once again the Data Transfer Modifier can be used to transfer UVs from the original object to the instances. This works great in Blender (visually anyway), however, when I export to Verge3D they all repeat the same part of the texture.
c) Adding a batch geometry puzzle brings down the number of render calls to the same as for the original object. I am not aware if this causes any issues. It keeps the normals at least.
Questions:
1. Are there any other benefits to using linked instances?
2. Is there any way to make the Data Transfer Modifier for UVs transfer over to Verge3d and keep the linked instances?I’ll give an example in the next post to make this a little clearer.
2024-11-15 at 5:53 pm #78824adamabrCustomerExample:
I have this bearing I want to try to optimize as much as possible.
The bearing geometry is radially symmetric, however the texture on the front cover is not.
I make a copy of the original and keep only one radial slice of the bearing. Then I instance this so I essentially recreate the whole bearing again.
Shaded mode shows the issues of seams and textures.
Adding the Data Transfer Modifier and enabling custom normals solves the normal issue.
Adding a Data Transfer Modifier and enabling UVs solves the texture issue (in Blender anyway).
So in Blender it looks like we have created a perfect copy this way. Let’s export to Verge 3D.
The normals are transferred properly but not the UVs. Adding a batch geometry puzzle brings down the render calls to the same as the original version.
A reasonable question would be if this is even relevant to do. Is it worth it? (Assuming the UVs work) Here is a comparison of file size.
Only the original exported:
GLTF: 11 KB
Bin: 40 KB
Total: 51 KBOnly the instanced version exported:
GLTF: 22 KB
Bin: 3 KB
Total: 25 KB
Savings: -26 KB (-51%)So my take is that there are a lot of potential savings here if we can figure this out. What do you think?
2024-11-16 at 3:43 am #78828kdvParticipantI have this bearing I want to try to optimize as much as possible.
it’s a strangest way to optimize a cylinder I’ve ever seen…
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-16 at 4:40 pm #78834adamabrCustomerHahah! I’m ready to agree. Radially symmetric objects are interesting because they enabled pushing this technique to the extreme. And a file size reduction of 50% is quite impressive. In this case the object is so simple that it makes more sense to not bother, but imagine this used multiple times across a large scene. I imagine there are plenty of objects that have one or two symmetry planes. If these objects are geometrically complex, a lot of data could be saved.
We just gotta manage those textures somehow.
2024-11-16 at 4:54 pm #78836kdvParticipantYou’d better look towards DRACO compression and Instanced Meshes… Just imagine 1000 clones and only 1 render call )))
A small example: ~200 meshes in the scene…
xxx.bin.xz – 1.8 Mb
xxx.gltf.xz – 20 KbPuzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-16 at 5:20 pm #78839adamabrCustomerInteresting, I’ll look into that. I guess I was assuming making linked duplicates creates instances meshes?
2024-11-16 at 5:22 pm #78840kdvParticipantmaking linked duplicates creates instances meshes?
In Blender – yes. In Verge3D – no. After exporting 10 linked duplicates from Blender to Verge3D you will get 10 individual meshes sharing same material and geometry and 10 render calls.
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
-
AuthorPosts
- You must be logged in to reply to this topic.