Jump to content

Different color/alpha for each object sharing the same material


Recommended Posts


Im fairly new to babylonjs.

I need give meshes materials which alpha/color properties depend on the mesh'es location/distance/placement relative to each other( or some internal mesh property that is different for each mesh )
The scene setup is very simple.
I have thousands of cubes( all sharing the same material ).
Now, i want to make it so that the cube's alpha and color values depend on how close a mesh is to another mesh in the scene. This would create a dynamic 
range of alpha/color values which are always changing( as meshes change ).

I know I could give each mesh its own material, but that would hit the performance( and i need the meshes to share almost all material properties except alpha/color )
Is there a way to share a material between thousands of meshes, but allow each mesh have its own alpha value ?

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