ShowNormal_ps.glsl
上传用户:xhbjoy
上传日期:2014-10-07
资源大小:38068k
文件大小:2k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. /******************************************************************************
  2. Copyright (c) W.J. van der Laan
  3. Permission is hereby granted, free of charge, to any person obtaining a copy of 
  4. this software  and associated documentation files (the "Software"), to deal in 
  5. the Software without restriction, including without limitation the rights to use, 
  6. copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
  7. Software, and to permit persons to whom the Software is furnished to do so, subject 
  8. to the following conditions:
  9. The above copyright notice and this permission notice shall be included in all copies 
  10. or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
  12. INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
  13. PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
  14. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
  15. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE 
  16. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. ******************************************************************************/
  18. /** Deferred shading framework
  19. // W.J. :wumpus: van der Laan 2005 //
  20. Post shader: Debug, show normal channel
  21. */
  22. uniform sampler2D tex0;
  23. uniform sampler2D tex1;
  24. varying vec2 texCoord;
  25. varying vec3 projCoord;
  26. void main()
  27. {
  28. vec4 a0 = texture2D(tex0, texCoord); // Attribute 0: Diffuse color+shininess
  29.     vec4 a1 = texture2D(tex1, texCoord); // Attribute 1: Normal+depth
  30.     
  31.     gl_FragColor=vec4((a1.xyz+vec3(1))*0.5,0);
  32. }