Search the Community
Showing results for tags 'materialdefines'.
-
Hello, No bug, no issue today ! I was just wondering about the choice of linking materialDefines to subMeshes, rather than directly on materials themselves. Does that mean that two subMeshes could have the same material, but different defines ? As the material updates the defines depending on its own properties (not the properties of the subMesh), I can hardly see how it's possible. I would love to see an example of this if you have one. I mean, I'm missing something. I'm quite sure this choice has been made for a good reason. But I don't get why. Thanks for your help !
- 3 replies
-
- submesh
- materialdefines
-
(and 2 more)
Tagged with:
-
Hello everybody, I face some errors in my app concerning material defines, I don't understand how they're managed. To render a mesh, subMesh.getMaterial().isReadyForSubMesh() and subMesh.getMaterial().bindForSubMesh() functions are successively called each frame, right ? Material defines are created at the beginning of the isReady function if subMesh doesn't have defines (so, if it's the first time this mesh is rendered, I assume). Defines are stored in subMesh with the _materialDefines property. Guess we begin with a standard material, we'll get StandardMaterialDefines on our subMesh and use the isReady function of StandardMaterial. Now, I assign another material to my mesh (a PBR for example). We'll now use the isReady function of PBRMaterial. In the isReady function, we'll only check if defines exist and we will work with StandardMaterialDefines instead of PBRMaterialDefines, no ? This is what happens to me in some circumstances... PG: https://www.babylonjs-playground.com/#YNCHVR (Open your console) But then, there is a mechanism that handles this issue and this doesn't happen anymore. I don't understand this either. Someone could enlight me please ?