一种用于具有镜面高光的光泽表面的材质。
MeshMatcapMaterial 有 十四个 属性
- alphaMap alpha贴图是一张灰度纹理,用于控制整个表面的不透明度。(黑色:完全透明;白色:完全不透明)。 默认值为null。,需要注意要使透明贴图生效要设置 alphaTest = 0 与 transparent = true
// 创建 TextureLoader 实例
const textureLoader = new THREE.TextureLoader();
const texture = textureLoader.load(imgPng);
const geometry = new THREE.BoxGeometry( 10, 10, 10 );
const material = new THREE.MeshMatcapMaterial({
alphaMap: texture,
transparent: true,
alphaTest: 0
});
const box = new THREE.Mesh(geometry, material);
scene.add(box);
- bumpMap 凹凸贴图的纹理 使用这个时需要注意 使用 bumpScale 调整 凹凸 正负数对应着凹凸
// 创建 TextureLoader 实例
const textureLoader = new THREE.TextureLoader();
const texture = textureLoader.load(person);
const geometry = new THREE.BoxGeometry( 10, 10, 10 );
const material = new THREE.MeshMatcapMaterial({
color: 0xffffff,
bumpMap: texture,
bumpScale: 5
});
const box = new THREE.Mesh(geometry, material);
scene.add(box);
- bumpScale 凹凸贴图会对材质产生多大影响。典型范围是0-1。默认值为1。
- color 材质颜色
- displacementMap 位移网格顶点贴图 黑色部分为位移部分 displacementBias 与 displacementScale 决定位移量
// 创建 TextureLoader 实例
const textureLoader = new THREE.TextureLoader();
const texture = textureLoader.load(person);
const geometry = new THREE.PlaneGeometry( 5, 5, 256, 256 );
const material = new THREE.MeshMatcapMaterial({
map: texture, // 基础颜色贴图
displacementMap: texture, // 置换贴图
displacementScale: 0.5, // 控制置换强度,减少位移幅度
displacementBias: 0.5 // 设置偏移值,确保黑色部分不会向内移动
});
const plane = new THREE.Mesh(geometry, material);
scene.add(plane);
- displacementScale 位移贴图对网格的影响程度(黑色是无位移,白色是最大位移)。如果没有设置位移贴图,则不会应用此值。默认值为1。
- displacementBias 位移贴图在网格顶点上的偏移量。如果没有设置位移贴图,则不会应用此值。默认值为0。
- flatShading 定义材质是否使用平面着色进行渲染。默认值为false。
- fog 材质是否受雾影响。默认为true。
- map 颜色贴图。可以选择包括一个alpha通道,通常与.transparent 或.alphaTest。默认为null。 纹理贴图颜色由漫反射颜色.color调节。
- matcap 固定贴图 使用这个贴图时相当于将贴图固定挡住几何体
- normalMap 用于创建法线贴图的纹理。RGB值会影响每个像素片段的曲面法线,并更改颜色照亮的方式。法线贴图不会改变曲面的实际形状,只会改变光照。
- normalMapType 法线贴图的类型。 选项为THREE.TangentSpaceNormalMap(默认)和THREE.ObjectSpaceNormalMap。
- normalScale 法线贴图对材质的影响程度。典型范围是0-1。默认值是Vector2设置为(1,1)。