@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.
219 lines • 8.94 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import "./ShadersInclude/prePassDeclaration.js";
import "./ShadersInclude/oitDeclaration.js";
import "./ShadersInclude/openpbrFragmentDeclaration.js";
import "./ShadersInclude/openpbrUboDeclaration.js";
import "./ShadersInclude/pbrFragmentExtraDeclaration.js";
import "./ShadersInclude/lightFragmentDeclaration.js";
import "./ShadersInclude/lightUboDeclaration.js";
import "./ShadersInclude/openpbrFragmentSamplersDeclaration.js";
import "./ShadersInclude/imageProcessingDeclaration.js";
import "./ShadersInclude/clipPlaneFragmentDeclaration.js";
import "./ShadersInclude/logDepthDeclaration.js";
import "./ShadersInclude/fogFragmentDeclaration.js";
import "./ShadersInclude/helperFunctions.js";
import "./ShadersInclude/subSurfaceScatteringFunctions.js";
import "./ShadersInclude/importanceSampling.js";
import "./ShadersInclude/pbrHelperFunctions.js";
import "./ShadersInclude/imageProcessingFunctions.js";
import "./ShadersInclude/shadowsFragmentFunctions.js";
import "./ShadersInclude/harmonicsFunctions.js";
import "./ShadersInclude/pbrDirectLightingSetupFunctions.js";
import "./ShadersInclude/pbrDirectLightingFalloffFunctions.js";
import "./ShadersInclude/pbrBRDFFunctions.js";
import "./ShadersInclude/hdrFilteringFunctions.js";
import "./ShadersInclude/pbrDirectLightingFunctions.js";
import "./ShadersInclude/pbrIBLFunctions.js";
import "./ShadersInclude/openpbrNormalMapFragmentMainFunctions.js";
import "./ShadersInclude/openpbrNormalMapFragmentFunctions.js";
import "./ShadersInclude/reflectionFunction.js";
import "./ShadersInclude/openpbrDielectricReflectance.js";
import "./ShadersInclude/openpbrConductorReflectance.js";
import "./ShadersInclude/openpbrBlockAmbientOcclusion.js";
import "./ShadersInclude/openpbrGeometryInfo.js";
import "./ShadersInclude/openpbrIblFunctions.js";
import "./ShadersInclude/clipPlaneFragment.js";
import "./ShadersInclude/pbrBlockNormalGeometric.js";
import "./ShadersInclude/openpbrNormalMapFragment.js";
import "./ShadersInclude/openpbrBlockNormalFinal.js";
import "./ShadersInclude/openpbrBaseLayerData.js";
import "./ShadersInclude/openpbrCoatLayerData.js";
import "./ShadersInclude/openpbrThinFilmLayerData.js";
import "./ShadersInclude/openpbrFuzzLayerData.js";
import "./ShadersInclude/depthPrePass.js";
import "./ShadersInclude/openpbrEnvironmentLighting.js";
import "./ShadersInclude/openpbrDirectLightingInit.js";
import "./ShadersInclude/openpbrDirectLighting.js";
import "./ShadersInclude/logDepthFragment.js";
import "./ShadersInclude/fogFragment.js";
import "./ShadersInclude/pbrBlockImageProcessing.js";
import "./ShadersInclude/pbrBlockPrePass.js";
import "./ShadersInclude/oitFragment.js";
import "./ShadersInclude/pbrDebug.js";
const name = "openpbrPixelShader";
const shader = `
precision highp float;
vec3 layer(vec3 slab_bottom,vec3 slab_top,float lerp_factor,vec3 bottom_multiplier,vec3 top_multiplier) {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);}
void main(void) {
vec3 coatNormalW=normalW;
float subsurface_weight=0.0;float transmission_weight=0.0;
ambientOcclusionOutParams aoOut;
vec3 ambientOcclusionFromTexture=texture2D(ambientOcclusionSampler,vAmbientOcclusionUV+uvOffset).rgb;
aoOut=ambientOcclusionBlock(
ambientOcclusionFromTexture,
vAmbientOcclusionInfos
);
geometryInfoAnisoOutParams coatGeoInfo=geometryInfoAniso(
coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW
,vec3(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN
);
geometryInfoOutParams coatGeoInfo=geometryInfo(
coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW
);
specular_roughness=mix(specular_roughness,pow(min(1.0,pow(specular_roughness,4.0)+2.0*pow(coat_roughness,4.0)),0.25),coat_weight);
geometryInfoAnisoOutParams baseGeoInfo=geometryInfoAniso(
normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW
,vec3(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN
);
geometryInfoOutParams baseGeoInfo=geometryInfo(
normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW
);
vec3 fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));vec3 fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);vec3 fuzzBitangent=cross(fuzzNormalW,fuzzTangent);geometryInfoOutParams fuzzGeoInfo=geometryInfo(
fuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW
);
ReflectanceParams coatReflectance;coatReflectance=dielectricReflectance(
coat_ior
,1.0
,vec3(1.0)
,coat_weight
);
float thin_film_outside_ior=mix(1.0,coat_ior,coat_weight);
ReflectanceParams baseDielectricReflectance;{float effectiveCoatIor=mix(1.0,coat_ior,coat_weight);baseDielectricReflectance=dielectricReflectance(
specular_ior
,effectiveCoatIor
,specular_color
,specular_weight
);}
ReflectanceParams baseConductorReflectance;baseConductorReflectance=conductorReflectance(base_color,specular_color,specular_weight);vec3 material_surface_ibl=vec3(0.,0.,0.);
vec3 material_surface_direct=vec3(0.,0.,0.);
float aggShadow=0.;float numLights=0.;
vec3 material_surface_emission=vEmissionColor;
vec3 emissionColorTex=texture2D(emissionColorSampler,vEmissionColorUV+uvOffset).rgb;
material_surface_emission*=toLinearSpace(emissionColorTex.rgb);
material_surface_emission*=emissionColorTex.rgb;
material_surface_emission*= vEmissionColorInfos.y;
material_surface_emission*=vLightingIntensity.y;
vec4 finalColor=vec4(material_surface_ibl+material_surface_direct+material_surface_emission,alpha);
finalColor=max(finalColor,0.0);
gl_FragColor=finalColor;
if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;}
}
`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
/** @internal */
export const openpbrPixelShader = { name, shader };
//# sourceMappingURL=openpbr.fragment.js.map