We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Shared Materials

Home Forums Programming Shared Materials

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #81975
    kvdml
    Customer

    I’m trying some things with shared materials (I have 160 objects, 4 materials, 100 color variationss)

    If two objects in my main scene that have the same material (powdercoat), I can change the rgb of object 2:
    setMaterialColor(getObjectMaterial(‘test2’, undefined, true), ‘RGB’, 0, 0, 0, ‘#b512f6’);

    If I change the material of ‘test2’ first to ‘steel’, I can no longer change the RGB on this object, instead the original ‘steel’ changes its RGB:

    assignMat(‘test2’, ‘steel’)
    setMaterialColor(getObjectMaterial(‘test2’, undefined, true), ‘RGB’, 0, 0, 0, ‘#b512f6’);

    Am I overlooking something? I do need the assignMat(): I’m making 160 clones….

    #81989

    Hi,
    If you need to change colors independently, the materials should be cloned along with meshes. Check out Puzzles code in Verge3D 4.8 (clone object puzzle) to see how it is done.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #81991
    kvdml
    Customer

    so I can’t assign a different material and control that one on the clone?

    #81992

    so I can’t assign a different material and control that one on the clone?

    Sure, you can assign different material on the cloned object and control it as you need.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.