Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1.  
  2. #version 100
  3.  
  4. precision mediump float;
  5.  
  6.  
  7. varying float lightDiffuse;
  8.  
  9. void main()
  10. {
  11. float light = ( 1.0 - lightDiffuse) * 0.5;
  12. vec3 lightColor = vec3(0.0,1.0,1.0);
  13. vec3 diffuseColor = lightColor * light ;
  14.  
  15. vec4 c;
  16. if(lightDiffuse <0.0 )
  17. {
  18. // back faces, opaque
  19. // front faces, very transparent
  20. c = vec4(diffuseColor, 0.2);
  21.  
  22. }
  23. else
  24. {
  25. discard;
  26.  
  27. }
  28.  
  29. gl_FragColor = c;
  30.  
  31. }
  32.  
  33.  
  34.  
  35.  
  36. #version 100
  37. #define lowp
  38. #define mediump
  39. #define highp
  40.  
  41. attribute vec4 vertex;
  42. attribute vec3 normal;
  43.  
  44.  
  45. uniform mat4 normalMatrix;
  46. uniform mat4 modelViewProjectionMatrix;
  47. uniform mat4 modelView;
  48. uniform vec3 camera_world_position;
  49.  
  50. varying highp float lightDiffuse;
  51.  
  52. void main()
  53. {
  54. gl_Position = modelViewProjectionMatrix * vertex;
  55.  
  56. vec3 norm = normal;
  57. norm *=-1.0;
  58. lightDiffuse = dot(normalize(vec3(norm.x, norm.y, norm.z)), normalize(camera_world_position));
  59.  
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement