glsl - Three.js ShaderMaterial shaders: What's the identity ("hello world") vertex and fragment code? -
i'm trying write custom shader three.js shadows, new glsl , having trouble getting started. think best approach start "identity" functions produce same shading default shadermaterial function , hack on those. can't seem work. here's i've tried:
      // vertex function       void main() {         gl_position = projectionmatrix * modelviewmatrix * vec4( position, 1 );        }        // fragment function       uniform vec3 shadowcolor;       void main() {         gl_fragcolor = vec4(shadowcolor, 1);       }     the uniforms provides black shadow color:
       uniforms: {           shadowcolor: {                 type: 'c',                 value: new three.color(0x000000)           }         },         vertexshader: vshader,         fragmentshader: fshader,         side: three.doubleside,         blending: three.additiveblending,         transparent: true     });   this produces nothing in way of shadow, though it's firing correctly, see, because can change output of gl_fragcolor arbitrary hsl value , see whole view shaded color. don't understand correct vertexshader produces same output default. 
any identity vertexshader , fragmentshader aid me in getting feet wet glsl.
thanks!
 
 
Comments
Post a Comment