@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.
20 lines • 1.55 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
const name = "volumetricLightScatteringPixelShader";
const shader = `varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>;var lightScatteringSamplerSampler: sampler;var lightScatteringSampler: texture_2d<f32>;uniform decay: f32;uniform exposure: f32;uniform weight: f32;uniform density: f32;uniform meshPositionOnScreen: vec2f;
@fragment
fn main(input: FragmentInputs)->FragmentOutputs {
var tc: vec2f=input.vUV;var deltaTexCoord: vec2f=tc-uniforms.meshPositionOnScreen;deltaTexCoord*=1.0/f32(NUM_SAMPLES)*uniforms.density;var illuminationDecay: f32=1.0;var color: vec4f=textureSample(lightScatteringSampler,lightScatteringSamplerSampler,tc)*0.4;for (var i: i32=0; i<NUM_SAMPLES; i++) {tc-=deltaTexCoord;var dataSample: vec4f=textureSample(lightScatteringSampler,lightScatteringSamplerSampler,tc)*0.4;dataSample*=illuminationDecay*uniforms.weight;color+=dataSample;illuminationDecay*=uniforms.decay;}
let realColor: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);fragmentOutputs.color=vec4f(color.rgb*uniforms.exposure,realColor.a)+realColor*(1.5-0.4);
}
`;
// Sideeffect
if (!ShaderStore.ShadersStoreWGSL[name]) {
ShaderStore.ShadersStoreWGSL[name] = shader;
}
/** @internal */
export const volumetricLightScatteringPixelShaderWGSL = { name, shader };
//# sourceMappingURL=volumetricLightScattering.fragment.js.map