useShadowMapInstancingPS.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
  2. static const char* useShadowMapInstancingFragmentShader= \
  3. "#version 330 core\n"
  4. "//precision highp float;\n"
  5. "in Fragment\n"
  6. "{\n"
  7. " vec4 color;\n"
  8. "} fragment;\n"
  9. "in Vert\n"
  10. "{\n"
  11. " vec2 texcoord;\n"
  12. "} vert;\n"
  13. "uniform sampler2D Diffuse;\n"
  14. "uniform sampler2DShadow shadowMap;\n"
  15. "in vec3 lightDir,normal,ambient;\n"
  16. "in vec4 ShadowCoord;\n"
  17. "out vec4 color;\n"
  18. "void main(void)\n"
  19. "{\n"
  20. " vec4 texel = fragment.color*texture(Diffuse,vert.texcoord);\n"
  21. " vec3 ct,cf;\n"
  22. " float intensity,at,af;\n"
  23. " \n"
  24. " intensity = 0.5+0.5*clamp( dot( normalize(normal),lightDir ), -1,1 );\n"
  25. " \n"
  26. " af = 1.0;\n"
  27. " \n"
  28. " ct = texel.rgb;\n"
  29. " at = texel.a;\n"
  30. " \n"
  31. " //float bias = 0.005f;\n"
  32. " \n"
  33. " \n"
  34. " float visibility = texture(shadowMap, vec3(ShadowCoord.xy,(ShadowCoord.z)/ShadowCoord.w));\n"
  35. " \n"
  36. " intensity = 0.7*intensity + 0.3*intensity*visibility;\n"
  37. " \n"
  38. " cf = intensity*(vec3(1.0,1.0,1.0)-ambient)+ambient;\n"
  39. " \n"
  40. " color = vec4(ct * cf, fragment.color.w);\n"
  41. "}\n"
  42. ;