lizehua-cn / tips

tips
0 stars 0 forks source link

threejs 相关 #6

Open lizehua-cn opened 1 year ago

lizehua-cn commented 1 year ago

TransformControls 移动时报错 NaN

解决: 平移旋转缩放属性值需设置为数字, 数字字符串不行

lizehua-cn commented 1 year ago

threejs 相机坐标转化 blender 坐标

如果相机有父级, 获取相机父级 位移, 缩放, 四元数并设置到新相机上, 如果相机使用轨道控制器OrbitControls, 控制器需设置聚焦点

lizehua-cn commented 1 year ago

threejs 设置透明背景

renderer.setClearColor(0x000000, 0)

lizehua-cn commented 1 year ago

如果没有全局环境光, 物体材质金属性太高, 会导致物体看起来是黑色

Glb model is very dark

lizehua-cn commented 1 year ago

贴图

环境遮挡贴图(aoMap) 需要设置第二组 UV

geometry.setAttribute('uv2', new THREE.BufferAttribute(geometry.attributes.uv.array, 2))
lizehua-cn commented 1 year ago

贴图

置换贴图 需要设置比较多的顶点, 需要配合 displacementScale 设置凸出程度

lizehua-cn commented 1 year ago

性能优化

合并几何体 https://threejs.org/manual/#zh/optimize-lots-of-objects

http://www.yanhuangxueyuan.com/doc/three.js/renderoptimization.html