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.

36 lines 1.57 kB
// Do not edit. import { ShaderStore } from "../../Engines/shaderStore.js"; const name = "oitFragment"; const shader = `#ifdef ORDER_INDEPENDENT_TRANSPARENCY var fragDepth: f32=fragmentInputs.position.z; #ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS var halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x; #endif var fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var lastDepth: vec2f=textureLoad(oitDepthSampler,fragCoord,0).rg;var lastFrontColor: vec4f=textureLoad(oitFrontColorSampler,fragCoord,0);fragmentOutputs.depth=vec2f(-MAX_DEPTH);fragmentOutputs.frontColor=lastFrontColor;fragmentOutputs.backColor= vec4f(0.0); #ifdef USE_REVERSE_DEPTHBUFFER var furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y; #else var nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y; #endif var alphaMultiplier: f32=1.0-lastFrontColor.a; #ifdef USE_REVERSE_DEPTHBUFFER if (fragDepth>nearestDepth || fragDepth<furthestDepth) { #else if (fragDepth<nearestDepth || fragDepth>furthestDepth) { #endif return fragmentOutputs;} #ifdef USE_REVERSE_DEPTHBUFFER if (fragDepth<nearestDepth && fragDepth>furthestDepth) { #else if (fragDepth>nearestDepth && fragDepth<furthestDepth) { #endif fragmentOutputs.depth=vec2f(-fragDepth,fragDepth);return fragmentOutputs;} #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStoreWGSL[name]) { ShaderStore.IncludesShadersStoreWGSL[name] = shader; } /** @internal */ export const oitFragmentWGSL = { name, shader }; //# sourceMappingURL=oitFragment.js.map