1
This commit is contained in:
43
public/docs/camera-light.md
Normal file
43
public/docs/camera-light.md
Normal file
@ -0,0 +1,43 @@
|
||||
# 相机与灯光/环境
|
||||
|
||||
## 相机控制
|
||||
```ts
|
||||
// 直接设置视角
|
||||
sdk.camera.set({
|
||||
position: [2.5, 1.6, 3.2],
|
||||
target: [0, 0.8, 0],
|
||||
fov: 45,
|
||||
near: 0.1,
|
||||
far: 200,
|
||||
})
|
||||
|
||||
// 平滑过渡到指定视角
|
||||
sdk.camera.animateTo(
|
||||
{ position: [1.2, 1, 2.4], target: [0, 0.8, 0], fov: 50 },
|
||||
{ duration: 0.8, easing: 'easeOutCubic' }
|
||||
)
|
||||
```
|
||||
|
||||
## 灯光调参
|
||||
```ts
|
||||
// 更新主方向光
|
||||
sdk.lights.update('key', {
|
||||
intensity: 1.5,
|
||||
color: '#ffffff',
|
||||
direction: [0.3, -1, 0.25],
|
||||
castShadow: true,
|
||||
})
|
||||
|
||||
// 环境光/辅光
|
||||
sdk.lights.update('fill', { intensity: 0.6, color: '#dfe8ff' })
|
||||
sdk.lights.update('ambient', { intensity: 0.25 })
|
||||
```
|
||||
|
||||
## 环境贴图
|
||||
```ts
|
||||
await sdk.environment.setHDRI('/envs/showroom_2k.hdr', {
|
||||
exposure: 1.1,
|
||||
rotation: [0, 45, 0], // yaw/pitch/roll
|
||||
blur: 0.2,
|
||||
})
|
||||
```
|
||||
Reference in New Issue
Block a user