simple_texturing.glsl 712 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma anki vert_shader_begins
  2. varying vec2 tex_coords;
  3. varying vec3 normal;
  4. void main()
  5. {
  6. tex_coords = gl_MultiTexCoord0.xy;
  7. normal = gl_NormalMatrix * gl_Normal;
  8. gl_Position = ftransform();
  9. }
  10. #pragma anki frag_shader_begins
  11. #pragma anki include "shaders/pack.glsl"
  12. uniform sampler2D diffuse_map, noise_map;
  13. varying vec2 tex_coords;
  14. varying vec3 normal;
  15. void main()
  16. {
  17. /*vec3 _noise = DecodeNormal( texture2D( noise_map, gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H ) ).rg ).rgb;
  18. _noise = _noise * 2 - 1;
  19. _noise *= 7.0;*/
  20. vec4 _texel = texture2D( diffuse_map, (gl_FragCoord.xy+(normal.xy*2))*vec2( 1.0/R_W, 1.0/R_H ) );
  21. //vec4 _texel = texture2D( diffuse_map, tex_coords );
  22. gl_FragColor = _texel;
  23. }