Skip to content

PBR材质

🕒 Published at:

PBR材质简介

Three.js提供了两个PBR材质相关的API MeshStandardMaterial 和MeshPhysicalMaterial,MeshPhysicalMaterial是MeshStandardMaterial扩展的子类,提供了更多功能属性。

  • MeshLambertMaterial: Lambert光照模型(漫反射)

  • MeshPhongMaterial:Phong光照模型(漫反射、高光反射)

  • MeshStandardMaterial和MeshPhysicalMaterial:基于物理的光照模型(微平面理论、能量守恒、菲涅尔反射...)

PBR材质相比MeshLambertMaterial和MeshPhongMaterial可以提供更逼真的、更接近生活中的材质效果,当然也会占用更多的电脑硬件资源。

整体上来看,就是渲染表现能力越强,占用的计算机硬件资源更多。

  • 占用渲染资源 MeshBasicMaterial < MeshLambertMaterial < MeshPhongMaterial < MeshStandardMaterial < MeshPhysicalMaterial

  • 渲染表现能力 MeshBasicMaterial < MeshLambertMaterial < MeshPhongMaterial < MeshStandardMaterial < MeshPhysicalMaterial

金属度metalness

金属度属性.metalness表示材质像金属的程度, 非金属材料,如木材或石材,使用0.0,金属使用1.0。

threejs的PBR材质,.metalness默认是0.5,0.0到1.0之间的值可用于生锈的金属外观

js
new THREE.MeshStandardMaterial({
    metalness: 1.0,//金属度属性
})
// 或者
mesh.material.metalness = 1.0;//金属度

粗糙度roughness

生活中不同物体表面的粗糙程度不同,比如地面比较粗糙,比如镜子表面就非常非常光滑。

粗糙度roughness表示模型表面的光滑或者说粗糙程度,越光滑镜面反射能力越强,越粗糙,表面镜面反射能力越弱,更多地表现为漫反射。

粗糙度roughness,0.0表示平滑的镜面反射,1.0表示完全漫反射,默认0.5。

js
new THREE.MeshStandardMaterial({
    roughness: 0.5,//表面粗糙度
})
// 或者
mesh.material.roughness = 0.5;//表面粗糙度