simple_texturing.glsl 990 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma anki vertShaderBegins
  2. attribute vec3 position;
  3. attribute vec3 normal;
  4. //attribute vec2 texCoords;
  5. //varying vec2 texCoords_v2f;
  6. varying vec3 normal_v2f;
  7. void main()
  8. {
  9. //texCoords_v2f = texCoords;
  10. normal_v2f = gl_NormalMatrix * normal;
  11. gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0);
  12. }
  13. #pragma anki fragShaderBegins
  14. #pragma anki include "shaders/pack.glsl"
  15. uniform sampler2D isFai, noise_map;
  16. //varying vec2 texCoords_v2f;
  17. varying vec3 normal_v2f;
  18. uniform vec2 rendererSize;
  19. void main()
  20. {
  21. /*vec3 _noise = DecodeNormal( texture2D( noise_map, gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H ) ).rg ).rgb;
  22. _noise = _noise * 2 - 1;
  23. _noise *= 7.0;*/
  24. vec4 _texel = texture2D( isFai, (gl_FragCoord.xy+(normal_v2f.z*50))*vec2( 1.0/rendererSize.x, 1.0/rendererSize.y ) ) * 0.75;
  25. //vec4 _texel = texture2D( isFai, gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H ) );
  26. gl_FragData[0] = _texel;
  27. //if( normal_v2f.z > 0.5 ) discard;
  28. //gl_FragData[0] = vec4( normal_v2f.z );
  29. }