开放能力
开发平台
行业应用
生态合作
开发与教学
资讯 社区 控制台
技术能力
语音技术
文字识别
人脸与人体
图像技术
语言与知识
视频技术
AR与VR
数据智能
场景方案
部署方案
行业应用
智能教育
智能医疗
智能零售
智能工业
企业服务
智能政务
信息服务
智能园区

光照

Light

此类描述json灯光相关字段(默认节点,建议直接套用)

Fields
number shadowFrustumSize
设置渲染阴影贴图的视椎的大小
number shadowMapSize
阴影贴图的分辨率
number closeLight
是否关闭灯光
light color
角度(用于聚光)
light lightNodeSuppl
消散(用于聚光)
light direction
方向
light distance
距离(用于聚光和点光)
light intensity
强度
light penumbra
阴影(用于聚光)
light skyColor
天空颜色(用于半球光)
light groundColor
地面颜色(用于半球光)
light color
色度
light lightNodeSuppl
光节点属性配置
string name
camera、light节点名使用其type
number position
位置
number rotation
旋转
number scale
大小
number type
当前节点类型 (平行光/环境光/聚光/点光/半球光)
string visible
是否显示
Public methods
light AllLightDemo()
全部灯光示例

AllLightDemo ()

全部灯光示例

sample:
{
"name": "directLight",
"type": "directLight",
"visible": "1",
"scale": "2.5,2.5,2.5",
"rotation": "270,0,270",
"children": [],
"lightNodeSuppl": 
    {
       "color": "255.0,255.0,255.0",
       "intensity": 1.5,
       "direction": "-2.5,-1,3",
       "enableShadow": 1,
       "shadowMapSize": "256,256"
       "shadowFrustumSize": "2000,2000"
       "closeLight":1
    }
},
{
"name": "ambientLight",
"type": "ambientLight",
"lightNodeSuppl": 
    {
       "color": "255.0,255.0,255.0",
       "intensity": 0.1,
       "closeLight":1
    }
},
{
"name": "spotLightUp",
"type": "spotLight",
"visible": 1,
"position": "0,30,18",
"scale": "5.0,5.0,5.0",
"rotation": "0,0,0",
"children": [],
"lightNodeSuppl":
    {
       "color": "255.0,255.0,255.0",
       "intensity": 2.5,
       "direction": "0.5,0,-1",
       "distance": 1700,
       "decay": 1,
       "angle": 30,
       "penumbra": 0.04,
       "closeLight":1
    }
},
{
"name": "pointLight",
"type": "pointLight",
"visible": 1,
"position": "-5,30,20",
"scale": "1.0,1.0,1.0",
"rotation": "0,0,0",
"children": [],
"lightNodeSuppl": 
    {
       "color": "255.0,255.0,255.0",
       "intensity": 0.5,
       "distance": 1500,
       "decay": 0.3,
       "closeLight":1
    }
},
{
"name": "hemisphereLight",
"type": "hemisphereLight",
"lightNodeSuppl": 
    {
       "skyColor": "240,240,240",
       "groundColor": "40,40,40",
       "intensity": 1.3,
       "direction": "2.5,1,-3",
       "enableShadow": 0,
       "closeLight":1
    }
}

shadowFrustumSize

version 25

设置渲染阴影贴图的视椎的大小,用于配置解决某些角度下阴影被裁切的问题,并不是越大越好,以刚好能够包裹需要展示阴影效果的场景为宜。建议范围为(500 - 10000),依据场景的size和光的方向来调试确定,不配置的话默认值为"2000, 2000"

sample:
"shadowFrustumSize": "2000,2000"

shadowMapSize

version 25

阴影贴图的分辨率(决定阴影的精细程度),字段的值的提供形式为字符串,分辨率的宽、高使用逗号隔开,建议范围为"128,128"至"1024,1024",不配置的话默认值为 "1024,1024"

sample:
"shadowMapSize": "256,256"

closeLight

version 18

是否关闭灯光(默认为0。0为开启,1为关闭)

sample:
"closeLight":0

angle

version 8

角度(用于聚光)

sample:
"angle":30

decay

version 8

消散(用于聚光)

sample:
"decay":1

direction

version 8

方向

sample:
"direction":"0.5,0,-1"

distance

version 8

距离(用于聚光和点光)

sample:
"distance":"1700"

groundColor

version 8

地面颜色(用于半球光)

sample:
"groundColor":"40,40,40"

intensity

version 8

强度

sample:
"intensity":2.5

penumbra

version 8

阴影(用于聚光)

sample:
"penumbra":0.04

skyColor

version 8

天空颜色(用于半球光)

sample:
"skyColor":"240,240,240"

color

version 8

色度

sample:
"color":"255.0,255.0,255.0"

lightNodeSuppl

version 8

光节点属性配置

sample:
"nodeList":[
    {
       "lightNodeSuppl":
       {
          "color": "255.0,255.0,255.0",
          "intensity": 2.5,
          "direction": "0.5,0,-1",
          "distance": 1700,
          "decay": 1,
          "angle": 30,
          "penumbra": 0.04,
          "skyColor": "240,240,240",
          "groundColor": "40,40,40",
          "enableShadow": 0,
          "closeLight":1
       }
    }
]

name

version 8

camera、light节点名使用其type

sample:
"nodeList":[
    {
       "name":"define_node_name"
    }
]

position

version 8

位置

sample:
"nodeList":[
    {
       "position":"1,1,1"
    }
]

rotation

version 8

旋转

sample:
"nodeList":[
    {
       "rotation":"90,0,0"
    }
]

scale

version 8

大小

sample:
"nodeList":[
    {
       "scale":"1,1,1"
    }
]

type

version 8

当前节点类型(平行光/环境光/聚光/点光/半球光)

sample:
"nodeList":[
    {
       "type":"directLight/ambientLight/spotLight/pointLight/hemisphereLight"
    }
]

visible

version 8

是否显示(1:显示;0:隐藏)(number 类型)

sample:
"nodeList":[
    {
       "visible":0
    }
]
上一篇
多媒体
下一篇
材质