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.

91 lines 2.26 kB
// Do not edit. import { ShaderStore } from "../../Engines/shaderStore.js"; import "./decalFragment.js"; const name = "pbrBlockAlbedoOpacity"; const shader = `struct albedoOpacityOutParams {vec3 surfaceAlbedo;float alpha;}; #define pbr_inline albedoOpacityOutParams albedoOpacityBlock( in vec4 vAlbedoColor #ifdef ALBEDO ,in vec4 albedoTexture ,in vec2 albedoInfos #endif ,in float baseWeight #ifdef BASE_WEIGHT ,in vec4 baseWeightTexture ,in vec2 vBaseWeightInfos #endif #ifdef OPACITY ,in vec4 opacityMap ,in vec2 vOpacityInfos #endif #ifdef DETAIL ,in vec4 detailColor ,in vec4 vDetailInfos #endif #ifdef DECAL ,in vec4 decalColor ,in vec4 vDecalInfos #endif ) {albedoOpacityOutParams outParams;vec3 surfaceAlbedo=vAlbedoColor.rgb;float alpha=vAlbedoColor.a; #ifdef ALBEDO #if defined(ALPHAFROMALBEDO) || defined(ALPHATEST) alpha*=albedoTexture.a; #endif #ifdef GAMMAALBEDO surfaceAlbedo*=toLinearSpace(albedoTexture.rgb); #else surfaceAlbedo*=albedoTexture.rgb; #endif surfaceAlbedo*=albedoInfos.y; #endif #ifndef DECAL_AFTER_DETAIL #include<decalFragment> #endif #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) surfaceAlbedo*=vColor.rgb; #endif #ifdef DETAIL float detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; #endif #ifdef DECAL_AFTER_DETAIL #include<decalFragment> #endif #define CUSTOM_FRAGMENT_UPDATE_ALBEDO surfaceAlbedo*=baseWeight; #ifdef BASE_WEIGHT surfaceAlbedo*=baseWeightTexture.r; #endif #ifdef OPACITY #ifdef OPACITYRGB alpha=getLuminance(opacityMap.rgb); #else alpha*=opacityMap.a; #endif alpha*=vOpacityInfos.y; #endif #if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) alpha*=vColor.a; #endif #if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL) #ifdef ALPHATEST #if DEBUGMODE != 88 if (alpha<ALPHATESTVALUE) discard; #endif #ifndef ALPHABLEND alpha=1.0; #endif #endif #endif outParams.surfaceAlbedo=surfaceAlbedo;outParams.alpha=alpha;return outParams;} `; // Sideeffect if (!ShaderStore.IncludesShadersStore[name]) { ShaderStore.IncludesShadersStore[name] = shader; } /** @internal */ export const pbrBlockAlbedoOpacity = { name, shader }; //# sourceMappingURL=pbrBlockAlbedoOpacity.js.map