UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

27 lines 989 B
// Do not edit. import { ShaderStore } from "../Engines/shaderStore.js"; const name = "circleOfConfusionPixelShader"; const shader = `uniform sampler2D depthSampler;varying vec2 vUV; #ifndef COC_DEPTH_NOT_NORMALIZED uniform vec2 cameraMinMaxZ; #endif uniform float focusDistance;uniform float cocPrecalculation; #define CUSTOM_FRAGMENT_DEFINITIONS void main(void) {float depth=texture2D(depthSampler,vUV).r; #define CUSTOM_COC_DEPTH #ifdef COC_DEPTH_NOT_NORMALIZED float pixelDistance=depth*1000.0; #else float pixelDistance=(cameraMinMaxZ.x+cameraMinMaxZ.y*depth)*1000.0; #endif #define CUSTOM_COC_PIXELDISTANCE float coc=abs(cocPrecalculation*((focusDistance-pixelDistance)/pixelDistance));coc=clamp(coc,0.0,1.0);gl_FragColor=vec4(coc,coc,coc,1.0);} `; // Sideeffect if (!ShaderStore.ShadersStore[name]) { ShaderStore.ShadersStore[name] = shader; } /** @internal */ export const circleOfConfusionPixelShader = { name, shader }; //# sourceMappingURL=circleOfConfusion.fragment.js.map