@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
534 lines (523 loc) • 30 kB
JavaScript
import { S as ShaderStore } from './index-MZPybX0H.esm.js';
import './mainUVVaryingDeclaration-Bm0UsfVq.esm.js';
import './shadowsFragmentFunctions-A24LahRk.esm.js';
// Do not edit.
const name$8 = "pbrFragmentExtraDeclaration";
const shader$8 = `varying vec3 vPositionW;
varying vec4 vClipSpacePosition;
varying vec3 vNormalW;
varying vec3 vEnvironmentIrradiance;
varying vec4 vColor;
varying float vViewDepth;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$8]) {
ShaderStore.IncludesShadersStore[name$8] = shader$8;
}
/** @internal */
const pbrFragmentExtraDeclaration = { name: name$8, shader: shader$8 };
// Do not edit.
const name$7 = "subSurfaceScatteringFunctions";
const shader$7 = `bool testLightingForSSS(float diffusionProfile)
{return diffusionProfile<1.;}`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$7]) {
ShaderStore.IncludesShadersStore[name$7] = shader$7;
}
/** @internal */
const subSurfaceScatteringFunctions = { name: name$7, shader: shader$7 };
// Do not edit.
const name$6 = "pbrHelperFunctions";
const shader$6 = `
float convertRoughnessToAverageSlope(float roughness)
{return square(roughness)+MINIMUMVARIANCE;}
float fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}
vec2 getAARoughnessFactors(vec3 normalVector) {
vec3 nDfdx=dFdx(normalVector.xyz);vec3 nDfdy=dFdy(normalVector.xyz);float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);float geometricAlphaGFactor=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2(geometricRoughnessFactor,geometricAlphaGFactor);
return vec2(0.);
}
vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 anisotropicFrameDirection;if (anisotropy>=0.0) {anisotropicFrameDirection=B;} else {anisotropicFrameDirection=T;}
vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}
vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy))),MINIMUMVARIANCE);float alphaB=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG,MINIMUMVARIANCE);return vec2(alphaT,alphaB);}
vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 bentNormal=cross(B,V);bentNormal=normalize(cross(bentNormal,B));float a=square(square(1.0-anisotropy*(1.0-roughness)));bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}
vec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}
vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}
vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}
vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),
cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),
clearCoatIntensity);return clearCoatAbsorption;}
float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)
{const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$6]) {
ShaderStore.IncludesShadersStore[name$6] = shader$6;
}
/** @internal */
const pbrHelperFunctions = { name: name$6, shader: shader$6 };
// Do not edit.
const name$5 = "pbrDirectLightingSetupFunctions";
const shader$5 = `struct preLightingInfo
{vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float LdotV;float roughness;float diffuseRoughness;vec3 surfaceAlbedo;
float iridescenceIntensity;
vec3 areaLightDiffuse;
vec3 areaLightSpecular;vec4 areaLightFresnel;
};preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N,vec3 posW) {preLightingInfo result;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
preLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
preLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;
result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));
result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;preLightingInfo computeAreaPreLightingInfo(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
{preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);
result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
preLightingInfo computeAreaPreLightingInfoWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness )
{preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc2,emissionTexture,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness);
result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular;
result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$5]) {
ShaderStore.IncludesShadersStore[name$5] = shader$5;
}
/** @internal */
const pbrDirectLightingSetupFunctions = { name: name$5, shader: shader$5 };
// Do not edit.
const name$4 = "pbrDirectLightingFalloffFunctions";
const shader$4 = `float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)
{return max(0.,1.0-length(lightOffset)/range);}
float computeDistanceLightFalloff_Physical(float lightDistanceSquared)
{return 1.0/maxEps(lightDistanceSquared);}
float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)
{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}
float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)
{
return computeDistanceLightFalloff_Physical(lightDistanceSquared);
return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);
return computeDistanceLightFalloff_Standard(lightOffset,range);
}
float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)
{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)
{falloff=max(0.,pow(cosAngle,exponent));}
return falloff;}
float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler)
{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)
{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977;
float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}
float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)
{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}
float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)
{
return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);
return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);
return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);
}`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$4]) {
ShaderStore.IncludesShadersStore[name$4] = shader$4;
}
/** @internal */
const pbrDirectLightingFalloffFunctions = { name: name$4, shader: shader$4 };
// Do not edit.
const name$3 = "pbrDirectLightingFunctions";
const shader$3 = `
struct lightingInfo
{vec3 diffuse;
vec3 diffuseTransmission;
vec3 specular;
vec4 clearCoat;
vec3 sheen;
};float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {
float lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;
return roughness;
}
vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}
vec3 computeAreaDiffuseLighting(preLightingInfo info,vec3 lightColor) {return info.areaLightDiffuse*lightColor;}
vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {vec3 diffuseTerm=vec3(1.0/PI);
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
return diffuseTerm*info.attenuation*info.NdotL*lightColor;}
vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return toLinearSpace(textureColor);}
vec3 computeDiffuseTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {vec3 transmittanceNdotL=vec3(0.);float NdotL=absEps(info.NdotLUnclamped);
if (info.NdotLUnclamped<0.0) {
float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);
}
vec3 diffuseTerm=vec3(1.0/PI);
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness));
diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness));
vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo;
float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);
return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}
vec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 fresnel,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);
fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);
float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);
float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);
vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
vec3 computeAreaSpecularLighting(preLightingInfo info,vec3 specularColor,vec3 reflectance0,vec3 reflectance90) {vec3 fresnel=specularColor*info.areaLightFresnel.x*reflectance0+( vec3( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;}
float evalFuzz(vec3 L,float NdotL,float NdotV,vec3 T,vec3 B,vec3 ltcLut)
{if (NdotL<=0.0 || NdotV<=0.0)
return 0.0;mat3 M=mat3(
vec3(ltcLut.r,0.0,0.0),
vec3(ltcLut.g,1.0,0.0),
vec3(0.0,0.0,1.0)
);vec3 Llocal=vec3(dot(L,T),dot(L,B),NdotL);vec3 Lwarp=normalize(M*Llocal);float cosThetaWarp=max(Lwarp.z,0.0);return cosThetaWarp*NdotL;}
vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=vec3(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;}
vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);
fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);
float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}
vec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {float NccdotL=saturateEps(dot(Ncc,info.L));float NccdotH=saturateEps(dot(Ncc,info.H));float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);float kelemenVisibility=visibility_Kelemen(info.VdotH);float clearCoatTerm=fresnel*distribution*kelemenVisibility;return vec4(
clearCoatTerm*info.attenuation*NccdotL*lightColor,
1.0-fresnel
);}
vec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);float NdotLRefract=saturateEps(dot(Ncc,LRefract));vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}
vec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);float fresnel=1.;float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER
float visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);
#else */
float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */
float sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$3]) {
ShaderStore.IncludesShadersStore[name$3] = shader$3;
}
/** @internal */
const pbrDirectLightingFunctions = { name: name$3, shader: shader$3 };
// Do not edit.
const name$2 = "pbrBlockNormalGeometric";
const shader$2 = `vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
vec3 normalW=normalize(vNormalW);
vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
vec3 geometricNormalW=normalW;
geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$2]) {
ShaderStore.IncludesShadersStore[name$2] = shader$2;
}
/** @internal */
const pbrBlockNormalGeometric = { name: name$2, shader: shader$2 };
// Do not edit.
const name$1 = "pbrBlockImageProcessing";
const shader$1 = `
finalColor.rgb=clamp(finalColor.rgb,0.,30.0);
finalColor=applyImageProcessing(finalColor);
finalColor.a*=visibility;
finalColor.rgb*=finalColor.a;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$1]) {
ShaderStore.IncludesShadersStore[name$1] = shader$1;
}
/** @internal */
const pbrBlockImageProcessing = { name: name$1, shader: shader$1 };
// Do not edit.
const name = "pbrDebug";
const shader = `
if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {
gl_FragColor.rgb=vPositionW.rgb;
gl_FragColor.rgb=vNormalW.rgb;
gl_FragColor.rgb=TBN[0];
gl_FragColor.rgb=TBN[1];
gl_FragColor.rgb=normalW;
gl_FragColor.rgb=vec3(vMainUV1,0.0);
gl_FragColor.rgb=vec3(vMainUV2,0.0);
gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];
gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];
gl_FragColor.rgb=clearcoatOut.clearCoatNormalW;
gl_FragColor.rgb=anisotropicOut.anisotropicNormal;
gl_FragColor.rgb=anisotropicOut.anisotropicTangent;
gl_FragColor.rgb=anisotropicOut.anisotropicBitangent;
gl_FragColor.rgb=albedoTexture.rgb;
gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;
gl_FragColor.rgb=opacityMap.rgb;
gl_FragColor.rgb=emissiveColorTex.rgb;
gl_FragColor.rgb=lightmapColor.rgb;
gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;
gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);
gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;
gl_FragColor.rgb=sheenOut.sheenMapData.rgb;
gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;
gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;
gl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;
gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;
gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;
gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;
gl_FragColor.rgb=diffuseBase.rgb;
gl_FragColor.rgb=specularBase.rgb;
gl_FragColor.rgb=clearCoatBase.rgb;
gl_FragColor.rgb=sheenBase.rgb;
gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;
gl_FragColor.rgb=surfaceAlbedo.rgb;
gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;
gl_FragColor.rgb=vec3(reflectivityOut.metallic);
gl_FragColor.rgb=reflectivityOut.metallicF0;
gl_FragColor.rgb=vec3(roughness);
gl_FragColor.rgb=vec3(alphaG);
gl_FragColor.rgb=vec3(NdotV);
gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);
gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);
gl_FragColor.rgb=subSurfaceOut.transmittance;
gl_FragColor.rgb=subSurfaceOut.refractionTransmittance;
gl_FragColor.rgb=vec3(microSurface);
gl_FragColor.rgb=vAlbedoColor.rgb;
gl_FragColor.rgb=vReflectivityColor.rgb;
gl_FragColor.rgb=vEmissiveColor.rgb;
gl_FragColor.rgb=vec3(seo);
gl_FragColor.rgb=vec3(eho);
gl_FragColor.rgb=vec3(energyConservationFactor);
gl_FragColor.rgb=baseSpecularEnvironmentReflectance;
gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;
gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;
gl_FragColor.rgb=vec3(luminanceOverAlpha);
gl_FragColor.rgb=vec3(alpha);
gl_FragColor.rgb=vec3(albedoTexture.a);
gl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb;
float stripeWidth=30.;float stripePos=floor(gl_FragCoord.x/stripeWidth);float whichColor=mod(stripePos,2.);vec3 color1=vec3(.6,.2,.2);vec3 color2=vec3(.3,.1,.1);gl_FragColor.rgb=mix(color1,color2,whichColor);
gl_FragColor.rgb*=vDebugMode.y;
gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;
gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);
gl_FragColor.a=1.0;
gl_FragData[0]=toLinearSpace(gl_FragColor);
gl_FragData[1]=vec4(0.,0.,0.,0.);
return;
}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name]) {
ShaderStore.IncludesShadersStore[name] = shader;
}
/** @internal */
const pbrDebug = { name, shader };
export { pbrHelperFunctions as a, pbrDirectLightingSetupFunctions as b, pbrDirectLightingFalloffFunctions as c, pbrDirectLightingFunctions as d, pbrBlockNormalGeometric as e, pbrBlockImageProcessing as f, pbrDebug as g, pbrFragmentExtraDeclaration as p, subSurfaceScatteringFunctions as s };
//# sourceMappingURL=pbrDebug-D-r1eiut.esm.js.map