Exclude a class of materials from light. How to or best way?

Dears,
I have a stupid question. Well, I guess it’s stupid but thought I might ask anyway :wink:

Case is simple: I have an hemi light on which the user can set the intensity to adjust ambient light.
I want to exclude from this light all materials that are not of class PBR or PBRMetallic.
What would be the best/slickest way to do that?
Thanks in advance,

Hi @mawa!

This can be a solution

  • Iterate on your scene meshes.
  • Check if the Material Mesh is kind of “PRBMaterial”.
  • ExcludeMeshes for your HemiLight using push
3 Likes

Thank you, yes. This was actually one of my two thoughts about it. Might just be the way to go.
The other was to generate an array from i.e. material.id or .includes with an identifier (which would eventually let me also include materials from other classes). In fact, I was just wondering if I had a ‘special case’ or if it would make sense to have a parameter that excludes all meshes with materials from a given class? Never mind, might just be me. Thanks for the solution and have a great day,

1 Like