THREE.js - Cannot read property 'lib' of undefined (THREE.ShaderUtils.lib["normal"])
javascript, three.js, webgl
Solution
The naming convention changed, this should work now
var shader = THREE.ShaderLib[ "normalmap" ];
Problem
I'm working through the exercises found in the WebGL getting started book by Oreilly. The following line causes a run-time error. I googled around and don't see anyone else have the issue, so what am I doing wrong? ``` var specularMap= THREE.ImageUtils.loadTexture("WebGLBook/images/earth_specular_2048.jpg"); var shader = THREE.ShaderUtils.lib[ "normal" ]; <-- fails var uniforms = THREE.UniformsUtils.clone(shader.uniforms); uniforms['tNormal'].texture = normalMap; uniforms['tDiffuse'].texture = surfaceMap; ``` The noted lines fails w/the following error: ``` Uncaught TypeError: Cannot read property 'lib' of undefined solar-system-spec-map.html:60 Earth.createGlobe solar-system-spec-map.html:60 Earth.init solar-system-spec-map.html:51 EarthApp.init solar-system-spec-map.html:33 (anonymous function) solar-system-spec-map.html:93 deferred.resolveWith jquery-1.6.4.js:1016 jQuery.extend.ready jquery-1.6.4.js:437 DOMContentLoaded ``` What's also strange about this is that "ShaderUtils" is not listed in the THREE.js documentation ... http://mrdoob.github.com/three.js/docs/55/ What's going on?!