Santarh / MToon

Toon Shader with Unity Global Illumination
MIT License
538 stars 60 forks source link

Shows up as black when i edit the material map #113

Closed torchesburn closed 2 years ago

torchesburn commented 2 years ago

The map shows as black when i apply it

image


    const {name, shader, vectorProperties, textureProperties, floatProperties} = materialProperty;
    console.log(materialProperty);
    if (shader === 'VRM/MToon') {
      const objects = _findMaterialsObjects(o.scene, name);
      for (const object of objects) {
        const newMaterial = new MToonMaterial();
        newMaterial._debugMode = true;
        const oldMaterial = object.material;
        Object.keys(vectorProperties).forEach(key=>{
          newMaterial[key] = vectorProperties[key];
        });
        Object.keys(textureProperties).forEach(key=>{
          newMaterial[key] = textureProperties[key];
        });
        Object.keys(floatProperties).forEach(key=>{
          newMaterial[key] = floatProperties[key];
        });

        newMaterial.map = oldMaterial.map;

        This is how the materialProperties look : 

        ```json
        floatProperties: {_Cutoff: 0.5, _BumpScale: 1, _ReceiveShadowRate: 1, _ShadingGradeRate: 1, _ShadeShift: -0.6, …}
keywordMap: {_ALPHABLEND_ON: true, _NORMALMAP: true}
name: "F00_000_00_EyeExtra_01_EYE"
renderQueue: 3000
shader: "VRM/MToon"
tagMap: {RenderType: 'Opaque'}
textureProperties: {_MainTex: 14, _ShadeTexture: 14, _BumpMap: 1, _SphereAdd: 6, _EmissionMap: 2}
vectorProperties: {_Color: Array(4), _ShadeColor: Array(4), _MainTex: Array(4), _ShadeTexture: Array(4), _BumpMap: Arra