Hello!
A bit of an open question here, but I’m looking for input of what approach you would recommend for updating ‘defines’ on a ShaderMaterial dynamically. I want to make sure we play nicely with the effect/mesh caching systems and rendering steps inside Babylon ![]()
Our setup is that we have custom shader materials that we use like any other in Babylon, and we have some configurations put behind the preprocessor. Some of these options are static for the lifetime of the application, others change a few times, and others will differ for different meshes (ie will require several parallel effects for one material in a frame).
Should be noted here that we do not consider parallel shader compilation at the moment, so it can be assumed to always be disabled ![]()
From experimentation, it seems like updating defines (using Material.setDefine) inside Material.isReady seems to work, but hard to tell if this is the “intended” way.
Thanks in advance ![]()
-Tore