Jump to content

Why are MaterialDefines linked to SubMeshes rather than Materials?


Recommended Posts


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. :huh:

Thanks for your help !

Link to comment
Share on other sites

You can have two submeshes from 2 differents meshes that share the same material but defines are not the same because they are constructed with data from material AND meshes

For instance:

- active lights come from the mesh

- mesh can turn off fog (mesh.applyFog)

- bones and morph targets come from mesh

- etc..


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...