Home › Forums › General Questions › Reduce Shaders
- This topic has 3 replies, 2 voices, and was last updated 3 years, 3 months ago by Mikhail Luzyanin.
-
AuthorPosts
-
2021-09-14 at 8:57 am #44621webCustomer
Hello,
I’ve got quite a heavy application and trying to optimize everything as much as possible. The batchGeometry feature already helped a lot, but I still wondering if there is more I can do.
I looked quite extensive into the docs with all the optimization parts, and still wondering about the shader stuff. I’ve got many objects which got a very simple material, with just a diffuse texture. So I would say 80% of my application got the same material which just differs by the used diffuse texture. This point in the docs attracted my interest:
If you have similar materials that only differ by textures, you can use only one material and load/swap its textures at run time. For this, you can use the replace texture puzzle or do it with JavaScript. This not only will optimize the number of shaders but also will reduce the number of images loaded at application startup.
I was now wondering how that approach whould look like in the real world. Whould I have to create just on material in 3dsMax which is applied to all objects and then replaceTexture on runtime for every single object with the proper one? Wouldnt I need to copy the material first for every object, because its instanced and used for all objects?
Is the batchGeometry option already doing that stuff automatically? Would be great if someone of the devs could shed some light on that situation
2021-09-14 at 10:17 am #44630Mikhail LuzyaninStaffI thinks using one shader for multiple object by replacing it’s texture with puzzles possible only if this materials displayed at the same moment only in one of it;s object otherwise it will replace texture on all your object. Reducing amount of shaders depends on shaders and application, in one application you may just join all models with the same materials or use batching in another you can replace textues with vertex color or bake few textures into one texture or reuse textures or combine then by RGB channel and so on. All depends on a scene and it’s content.
Co-founder and lead graphics specialist at Soft8Soft.
2021-09-14 at 12:31 pm #44634webCustomerIn that particular scene all of that objects are displayed at the same time. So I could only use replaceTexture when doing a copy of the material for every single object. Which makes the approach, exporting with only one material for all the objects, obsolete.
But I don’t get what would be the real world approach for the quote I referenced in my first post from the documentation. Only thing I could see is that the images arent loaded on startup.
2021-09-14 at 1:13 pm #44637Mikhail LuzyaninStaffIf you have material that replaced by another material but the only difference they have is texture, but they have the same structure than you can use replace texture instead of creating multimple amount of texture and replace one by another.
Co-founder and lead graphics specialist at Soft8Soft.
-
AuthorPosts
- You must be logged in to reply to this topic.