circleOfConfusion.fragment.js 823 B

1234567891011121314151617
  1. // Do not edit.
  2. import { ShaderStore } from "../Engines/shaderStore.js";
  3. const name = "circleOfConfusionPixelShader";
  4. const shader = `uniform sampler2D depthSampler;varying vec2 vUV;uniform vec2 cameraMinMaxZ;uniform float focusDistance;uniform float cocPrecalculation;
  5. #define CUSTOM_FRAGMENT_DEFINITIONS
  6. void main(void)
  7. {float depth=texture2D(depthSampler,vUV).r;
  8. #define CUSTOM_COC_DEPTH
  9. float pixelDistance=(cameraMinMaxZ.x+cameraMinMaxZ.y*depth)*1000.0;
  10. #define CUSTOM_COC_PIXELDISTANCE
  11. float coc=abs(cocPrecalculation*((focusDistance-pixelDistance)/pixelDistance));coc=clamp(coc,0.0,1.0);gl_FragColor=vec4(coc,coc,coc,1.0);}
  12. `;
  13. // Sideeffect
  14. ShaderStore.ShadersStore[name] = shader;
  15. /** @internal */
  16. export const circleOfConfusionPixelShader = { name, shader };
  17. //# sourceMappingURL=circleOfConfusion.fragment.js.map