我想问一下,如何在JSON模型格式3.1中定义透明材质。我尝试过遵循JSON但没有取得任何成功:
{
"metadata": {
"formatVersion" : 3
},
"materials": [{
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "dummy",
"illumination" : 2,
"opticalDensity" : 0.5,
"transparency" : 0.5,
"colorAmbient" : [ 0.9, 0.1, 0.1 ],
"colorDiffuse" : [ 0.1, 0.7, 0.1 ]
}],
"vertices": [0,0,0, 100,0,0, 100,100,0, 0,100,0 ],
"normals": [],
"colors": [1,0,0, 0,1,0 ],
"uvs": [],
"faces": [67, 0,1,2,3,0, 1]
}
我也尝试过不同的照度,光密度和透明度,但也没有运气。
谢谢Jan
答案 0 :(得分:1)
您需要设置transparent: true
和transparency: 0.5
。后者映射到opacity
。
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "dummy",
"transparent" : true,
"transparency" : 0.5,
"colorAmbient" : [ 0.9, 0.1, 0.1 ],
"colorDiffuse" : [ 0.1, 0.7, 0.1 ]
}],
three.js r.60