I’m trying to enable the extension KHR_materials_transmission for a material in runtime.
I have a model that has among other things KHR_materials_transmission enabled, but I can’t manage to enable this manually:
I have created this simple playground with 2 example models:
You can un/comment the model URL to compare. Is it possible at all to enable this manually or is it (currently) only possible by setting it in the model file itself? Where within babylon is it generally stored which extensions are enabled/applied to materials in the first place?
You can’t manually do what the transmission extension does because it’s currently not possible to access the transmission helper class from a user code, see these posts for context:
I see, so from what I can gather it’s currently not possible to enable/add the extension after loading the model, mostly due to the current flow of the babylon.js engine? Like we can’t add the material to whatever list keeps track of where this extension logic should be applied?
And we can’t replicate the behavior either because we currently have no (good) way to get the texture the extension generates (a RenderTargetTexture of all opaque objects in the screen). I suppose we can’t replicate whatever the extension does internally because there’s no good “hook” or “observer” point to attach to where we could replicate and insert this?
No, the extension is parsed at loading time, and the transmission helper is created only if this extension exists.
Maybe you could “inject” this extension yourself during load, if we have a way to do it… Let’s ask @bghgary if it’s possible (be patient, he will be back next week).
You can’t replicate it because the TransmissionHelper class (which is used to implement the feature) is not available to user code. Actually, you can replicate it if you copy/paste the class in your own project :). It’s implemented here: