Hi,
I’m trying to get vertex positions and normals as uniforms from a non planar surface, to use them into a shader applied to another mesh .
here is my code in gltf.scene.traverse:
positionAttribute = child.geometry.getAttribute( 'position' );
normalAttribute = child.geometry.getAttribute( 'normal' );
console.log(positionAttribute.array); // this one works
uniforms.vRef = positionAttribute.array;
uniforms.nRef = normalAttribute.array;
and uniform is:
uniforms = {
texture1: { type:"t", value: texture },
vRef: { value: null },
nRef: { value: null },
layers: { value: colors}
};
Is it right to pass attibute.array? in the shader I get this error:
Uncaught TypeError: Cannot read properties of undefined (reading ‘x’)