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 1.17 kB
// Do not edit. import { ShaderStore } from "../Engines/shaderStore.js"; const name = "circleOfConfusionPixelShader"; const shader = `varying vUV: vec2f;var depthSamplerSampler: sampler;var depthSampler: texture_2d<f32>; #ifndef COC_DEPTH_NOT_NORMALIZED uniform cameraMinMaxZ: vec2f; #endif uniform focusDistance: f32;uniform cocPrecalculation: f32; #define CUSTOM_FRAGMENT_DEFINITIONS @fragment fn main(input: FragmentInputs)->FragmentOutputs {var depth: f32=textureSample(depthSampler,depthSamplerSampler,input.vUV).r; #define CUSTOM_COC_DEPTH #ifdef COC_DEPTH_NOT_NORMALIZED let pixelDistance=depth*1000.0; #else let pixelDistance: f32=(uniforms.cameraMinMaxZ.x+uniforms.cameraMinMaxZ.y*depth)*1000.0; #endif #define CUSTOM_COC_PIXELDISTANCE var coc: f32=abs(uniforms.cocPrecalculation*((uniforms.focusDistance-pixelDistance)/pixelDistance));coc=clamp(coc,0.0,1.0);fragmentOutputs.color= vec4f(coc,coc,coc,1.0);} `; // Sideeffect if (!ShaderStore.ShadersStoreWGSL[name]) { ShaderStore.ShadersStoreWGSL[name] = shader; } /** @internal */ export const circleOfConfusionPixelShaderWGSL = { name, shader }; //# sourceMappingURL=circleOfConfusion.fragment.js.map