Advertisement
Guest User

Untitled

a guest
May 1st, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. uniform mat4 matWorld;
  2.  
  3. varying vec3 vLightDir;
  4. varying vec3 vEyeVec;
  5. varying vec2 vTexcoord;
  6.  
  7. varying vec3 vNormal;
  8. varying vec3 vTangent;
  9. varying vec3 vBinormal;
  10.  
  11. uniform sampler2D normalMap;
  12. uniform sampler2D colorMap;
  13. uniform samplerCube cubeMap;
  14. uniform sampler2D reliefMap;
  15. uniform float bumpedpth;
  16. uniform float relifeDepth;
  17.  
  18.  
  19. void main( void )
  20. {
  21. vec3 B=normalize(vBinormal);
  22. vec3 N=normalize(vNormal);
  23. vec3 T=normalize(vTangent);
  24. vec3 E=normalize(vEyeVec);
  25. vec3 L=normalize(vLightDir);
  26.  
  27. float diffattenuation = smoothstep(-0.3,0.0,dot(N,-L));
  28.  
  29.  
  30. vec3 normaldelta = ((texture2D(normalMap,vTexcoord).xyz*2.0)-1);
  31. //normaldelta = snormaldelta,-1,bumpedpth);
  32.  
  33. //Convert Normal to World Space
  34. //N = normalize((T*normaldelta.x)+(B*normaldelta.y)+(N*normaldelta.z));
  35.  
  36. // diffuse lightning
  37. float diff = clamp(dot(N,-L),0,1);
  38.  
  39. // reflection
  40. vec3 R = reflect(-E,N);
  41. vec3 reflection = textureCube(cubeMap,R).xyz;
  42. float relief = texture2D(reliefMap,vTexcoord).x;
  43. reflection = mix(reflection ,reflection*relief,relifeDepth);
  44.  
  45.  
  46. vec3 texture = texture2D(colorMap,vTexcoord).xyz;
  47.  
  48. gl_FragColor = vec4(reflection,1.0);//texture * diff*diffattenuation+
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement