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.

38 lines 1.37 kB
// Do not edit. import { ShaderStore } from "../../Engines/shaderStore.js"; const name = "pbrBlockAlphaFresnel"; const shader = `#ifdef ALPHAFRESNEL #if defined(ALPHATEST) || defined(ALPHABLEND) struct alphaFresnelOutParams {alpha: f32};fn faceforward(N: vec3<f32>,I: vec3<f32>,Nref: vec3<f32>)->vec3<f32> {return select(N,-N,dot(Nref,I)>0.0);} #define pbr_inline fn alphaFresnelBlock( normalW: vec3f, viewDirectionW: vec3f, alpha: f32, microSurface: f32 )->alphaFresnelOutParams {var outParams: alphaFresnelOutParams;var opacityPerceptual: f32=alpha; #ifdef LINEARALPHAFRESNEL var opacity0: f32=opacityPerceptual; #else var opacity0: f32=opacityPerceptual*opacityPerceptual; #endif var opacity90: f32=fresnelGrazingReflectance(opacity0);var normalForward: vec3f=faceforward(normalW,-viewDirectionW,normalW);outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)), vec3f(opacity0), vec3f(opacity90),sqrt(microSurface)).x; #ifdef ALPHATEST if (outParams.alpha<ALPHATESTVALUE) {discard;} #ifndef ALPHABLEND outParams.alpha=1.0; #endif #endif return outParams;} #endif #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStoreWGSL[name]) { ShaderStore.IncludesShadersStoreWGSL[name] = shader; } /** @internal */ export const pbrBlockAlphaFresnelWGSL = { name, shader }; //# sourceMappingURL=pbrBlockAlphaFresnel.js.map