2022/1/17

材质节点错乱

修改前:

  1. mt.diffuse_map.map1.map1.sourceA.fileName = Diffuse
  2. mt.diffuse_map.map1.sourceA.sourceA.map.sourceB.fileName = Opacity
  3. local dm = mt.diffuse_map.map1.sourceA.sourceA.map.sourceA.coords
  4. local am = mt.diffuse_map.map1.sourceA.sourceA.map.sourceB.coords
  5. am.U_Offset =dm.U_Offset = 法线U
  6. am.U_Offset =dm.V_Offset = 法线V
  7. am.U_Offset =dm.U_Tiling = 法线U*贴图密度
  8. am.U_Offset =dm.V_Tiling = 法线V*贴图密度
  9. am.U_Offset =dm.W_angle = 法线角度
  10. if 贴图对比度 <=1 then
  11. (
  12. mt.diffuse_map.map1.sourceA.sourceA.contrast = (贴图对比度-1)*100
  13. mt.diffuse_map.map1.sourceA.sourceA.contrast = (贴图对比度-1)*100
  14. ) else
  15. (
  16. mt.diffuse_map.map1.sourceA.sourceA.contrast = (贴图对比度-1)*50
  17. mt.diffuse_map.map1.sourceA.sourceA.contrast = (贴图对比度-1)*50
  18. )
  19. if 贴图亮度 <=1 then
  20. (
  21. mt.diffuse_map.map1.sourceA.sourceA.brightness = (贴图亮度-1)*100
  22. ) else
  23. (
  24. mt.diffuse_map.map1.sourceA.sourceA.brightness = (贴图亮度-1)*50
  25. )
  26. mt.texmap_diffuse.mixAmount = 混合度
  27. mt.diffuse_map.map1.sourceA.sourceB.map1.sourceB.color = 贴图叠加颜色
  28. mt.diffuse_map.map2.map2.color = 印花颜色
  29. mt.diffuse_map.map2.map1.color = 颜色
  30. local c = 印花不透明度*255
  31. mt.texmap_opacity.map2.color = (color c c c)
  32. c = 纱不透明度*255
  33. mt.texmap_opacity.map1.color = (color c c c)

修改后:

  1. local mt = makeMt mtName
  2. mt.texmap_diffuse.map1.map1.sourceA.map.fileName = Diffuse
  3. mt.texmap_diffuse.mask.fileName = Opacity
  4. local dm = mt.diffuse_map.map1.map1.sourceA.map.coords
  5. local am = mt.diffuse_map.mask.coords
  6. am.U_Offset =dm.U_Offset = 法线U
  7. am.U_Offset =dm.V_Offset = 法线V
  8. am.U_Offset =dm.U_Tiling = 法线U*贴图密度
  9. am.U_Offset =dm.V_Tiling = 法线V*贴图密度
  10. am.U_Offset =dm.W_angle = 法线角度
  11. --贴图亮度映射优化
  12. mt.texmap_diffuse.map1.map1.sourceA.lightnessMode = 1
  13. mt.texmap_diffuse.map1.map1.SourceA.gainRGB = 贴图亮度*100.0
  14. --贴图对比度映射优化
  15. if 贴图对比度 >=1 then
  16. (
  17. mt.texmap_diffuse.map1.map1.SourceA.gammaRGB = 1-(贴图对比度-1)*0.8
  18. ) else if (贴图对比度 <1 and 贴图对比度 >0.1 ) then
  19. (
  20. mt.texmap_diffuse.map1.map1.SourceA.gammaRGB = 1+(1-贴图对比度)*5
  21. ) else if 贴图对比度 <=0.1 then(
  22. mt.texmap_diffuse.map1.map1.SourceA.gammaRGB = 15
  23. )
  24. mt.texmap_diffuse.map1.mixAmount = 混合度*100
  25. mt.texmap_diffuse.map1.map2.color = 颜色
  26. local y = (1-粗糙度)*255
  27. mt.Reflection = (color y y y)
  28. mt.texmap_diffuse.map1.map1.sourceB.color = 贴图叠加颜色
  29. mt.texmap_diffuse.map2.color = 印花颜色
  30. local c = (印花不透明度*255)-20
  31. mt.texmap_opacity.map2.color = (color c c c)
  32. local c = (纱不透明度*255)-20
  33. mt.texmap_opacity.map1.color = (color c c c)
  34. )

image.png