我对着色器不太懂,我把代码贴出来,可以帮忙看一下咋加吗
const creatShaderMaterial = (texture) => {
return new THREE.ShaderMaterial ({
vertexShader: `
varying vec2 vUv;
void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
vUv = uv;
}
`,
fragmentShader: `
uniform sampler2D heightMap;
uniform float uOpacity;
varying vec2 vUv;
void main() {
gl_FragColor = vec4(texture2D(heightMap, vUv.xy).rgb, uOpacity);
}
`,
uniforms: {
uOpacity: { value: 0.9 },
heightMap: { value: texture },
},
polygonOffsetUnits: 1,
polygonOffsetFactor: 1,
polygonOffset: true,
depthWrite: true,
depthTest: true,
transparent: true,
side: THREE.DoubleSide,
});
};
问 使用原生的threejs ,实现热力图,热力图模型和其他模型不在一个图层