Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- vertext shader a.k.a. pixel shader -->
- <script id="vertexShader" type="x-shader/x-vertex">
- varying vec3 vNormal;
- varying vec3 vPositionNormal;
- void main()
- {
- vNormal = normalize( normalMatrix * normal ); // 转换到视图空间
- vPositionNormal = normalize(( modelViewMatrix * vec4(position, 1.0) ).xyz);
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }
- </script>
- <!-- fragment shader a.k.a. pixel shader -->
- <script id="fragmentShader" type="x-shader/x-vertex">
- uniform vec3 glowColor;
- uniform float b;
- uniform float p;
- uniform float s;
- varying vec3 vNormal;
- varying vec3 vPositionNormal;
- void main()
- {
- float a = pow( b + s * abs(dot(vNormal, vPositionNormal)), p );
- gl_FragColor = vec4( glowColor, a );
- }
- </script>
- <div id="ThreeJS" style="position: absolute; left:0px; top:0px"></div>
Add Comment
Please, Sign In to add comment