I have no idea how to extend my shader. It is quite simple. I have geometries with custom focus
attribute with value between 0-1 and based on that I render plane colour. But for BatchedMesh
this shader does not work. (I see geometry on (0,0,0) point ) In web I found something about instanceMatrix
attribute but I don`t know how to use it correctly.
const focusMaterial = new THREE.ShaderMaterial({
vertexShader: /* glsl */`
attribute float focus;
varying float vFocus;
void main() {
vFocus = focus;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,
fragmentShader: /* glsl */`
varying float vFocus;
void main() {
gl_FragColor = vec4(vFocus,vFocus,0.5,1.0);
}
`,
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743754404a4501492.html
评论列表(0条)