【问题标题】:Define transparent material in JSON Model format 3.1JSON模型格式3.1定义透明材质
【发布时间】:2013-08-28 23:46:37
【问题描述】:

我想问一下,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]
}

我也尝试过使用不同的照明、光密度和透明度值,但也没有运气。

谢谢杨

【问题讨论】:

    标签: javascript json three.js webgl


    【解决方案1】:

    您需要设置transparent: truetransparency: 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

    【讨论】:

      猜你喜欢
      • 2022-01-27
      • 2015-03-04
      • 2023-03-21
      • 2020-07-12
      • 2021-06-12
      • 2016-12-04
      • 2016-11-10
      • 2015-02-16
      • 1970-01-01
      相关资源
      最近更新 更多