Reputation: 57982
I've got a MeshPhongMaterial named 'material' like so:
var material = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture('assets/images/8k-earth-diffuse.jpg'),
normalMap: THREE.ImageUtils.loadTexture('assets/images/8k-earth-normal.jpg'),
normalScale: (0.1, 0.1),
specularMap: THREE.ImageUtils.loadTexture('assets/images/8k-earth-spec.png'),
specular: new THREE.Color('grey')
});
Everything works and is applied, including the map and normalMap. The problem is, when I try to add a normalScale
property, it throws the following error:
Uncaught TypeError: Failed to execute 'uniform2fv' on 'WebGLRenderingContext': No function was found that matched the signature provided.
I've used normalScale
before and with the right syntax, and it's been working until recently. Without normalScale
everything is fine. I am using revision 77. My question is why is this happening and what causes this error? How can I use normalScale
without three.js throwing the error? I've used Chrome DevTools to get the line where the error is thrown in three.js source:
if ( v.x === undefined ) gl.uniform2fv( this.addr, v );
Upvotes: 4
Views: 1276
Reputation: 104833
You are not setting normalScale
properly:
var material = new THREE.MeshPhongMaterial( {
normalMap: THREE.ImageUtils.loadTexture('assets/images/8k-earth-normal.jpg'),
normalScale: new THREE.Vector3( 0.1, 0.1 );
) };
Alternatively, after the material is instantiated:
material.normalScale.set( 0.1, 0.1 );
three.js r.77
Upvotes: 3