@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
JavaScript
// Do not edit.
import { ShaderStore } from "../../Engines/shaderStore.js";
const name = "oitFragment";
const shader = `
var fragDepth: f32=fragmentInputs.position.z;
var halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x;
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);
var furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y;
var nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y;
var alphaMultiplier: f32=1.0-lastFrontColor.a;
if (fragDepth>nearestDepth || fragDepth<furthestDepth) {
if (fragDepth<nearestDepth || fragDepth>furthestDepth) {
return fragmentOutputs;}
if (fragDepth<nearestDepth && fragDepth>furthestDepth) {
if (fragDepth>nearestDepth && fragDepth<furthestDepth) {
fragmentOutputs.depth=vec2f(-fragDepth,fragDepth);return fragmentOutputs;}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStoreWGSL[name]) {
ShaderStore.IncludesShadersStoreWGSL[name] = shader;
}
/** @internal */
export const oitFragmentWGSL = { name, shader };
//# sourceMappingURL=oitFragment.js.map