__shdBulbTonemapUnreal3.fsh 493 B

12345678910111213141516171819202122
  1. varying vec2 v_vTexcoord;
  2. varying vec4 v_vColour;
  3. uniform float u_fExposure;
  4. uniform sampler2D u_sLightMap;
  5. const float gamma = 2.2;
  6. vec3 Unreal3(vec3 color)
  7. {
  8. return color / (color + 0.155) * 1.019;
  9. }
  10. void main()
  11. {
  12. gl_FragColor = v_vColour*texture2D(gm_BaseTexture, v_vTexcoord);
  13. gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(gamma));
  14. vec4 light = texture2D(u_sLightMap, v_vTexcoord);
  15. gl_FragColor.rgb = Unreal3(u_fExposure*gl_FragColor.rgb*light.rgb);
  16. }