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.

How to generate and assign new material?

Home Forums Programming How to generate and assign new material?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33364
    Avatarderekwang0605
    Licensee

    var color = new v3d.Color(‘#0000FF’);
    color.convertSRGBToLinear();
    var mymat = new v3d.MeshStandardMaterial({ color: color, emissive: color, emissiveIntensity: 0.4, toneMapped: false });

    assignMat([‘GROUP’, ‘L100’], mymat);

    But it did not change the material. Not sure why? Thanks!

    #33383
    Yuri KovelenovYuri Kovelenov
    Developer

    Hi,

    does it print any errors in the browser console?

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #33406
    Avatarderekwang0605
    Licensee

    No errors and no color has been changed to new color.
    setMaterialColor(‘Verge3D_Environment_World’, ‘Principled Color’, 0.1, 0.5, 0.05, ”);
    assignMat([‘GROUP’, ‘L100’], ‘Verge3D_Environment_World’);
    Instead if I use ‘Verge3D_Environment_World’, it works and color will be changed.

    #33441
    Yuri KovelenovYuri Kovelenov
    Developer

    the function assignMat takes material name (a String value). Try to name your material first.

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #33448
    Avatarderekwang0605
    Licensee

    I have already generated a new material but did not work. And I have to add a new color in Blender and then it can work in runCode().
    var color = new v3d.Color(‘#0000FF’);
    color.convertSRGBToLinear();
    var mymat = new v3d.MeshStandardMaterial({ color: color, emissive: color, emissiveIntensity: 0.4, toneMapped: false });

    assignMat([‘GROUP’, ‘L100’], mymat);

    #33476
    Yuri KovelenovYuri Kovelenov
    Developer

    assignMat only works with materials that are already assigned to some object

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

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