three.js - Build phong shader from THREE.ShaderLib -


i'm trying build phong shader three.shaderlib. got:

var phongshader = three.shaderlib.phong; var uniforms = three.uniformsutils.clone(phongshader.uniforms);  material = new three.shadermaterial({   uniforms: uniforms,   vertexshader: phongshader.vertexshader,   fragmentshader: phongshader.fragmentshader }); 

it doesn't seem work. doing wrong?

fiddle: http://jsfiddle.net/jvf9k/2/ similar question: three js - cloning shader , changing uniform values

edit: updated fiddle of tapio answer. works!

your jsfiddle using three.canvasrenderer doesn't (and can't) support shader materials (but can support built-in materials). change three.webglrenderer. also, doesn't make sense use phong material without lights result black. phong wireframe doesn't sound useful either.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -