@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.
188 lines • 5.25 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../../Engines/shaderStore.js";
const name = "pbrBlockSheen";
const shader = `
struct sheenOutParams
{float sheenIntensity;vec3 sheenColor;float sheenRoughness;
vec3 surfaceAlbedo;
float sheenAlbedoScaling;
vec3 finalSheenRadianceScaled;
vec4 sheenMapData;
vec3 sheenEnvironmentReflectance;
};
sheenOutParams sheenBlock(
in vec4 vSheenColor
,in float vSheenRoughness
,in vec4 sheenMapRoughnessData
,in float roughness
,in vec4 sheenMapData
,in float sheenMapLevel
,in float reflectance
,in vec3 baseColor
,in vec3 surfaceAlbedo
,in float NdotV
,in vec3 environmentBrdf
,in vec2 AARoughnessFactors
,in vec3 vReflectionMicrosurfaceInfos
,in vec2 vReflectionInfos
,in vec3 vReflectionColor
,in vec4 vLightingIntensity
,in samplerCube reflectionSampler
,in vec3 reflectionCoords
,in sampler2D reflectionSampler
,in vec2 reflectionCoords
,in float NdotVUnclamped
,in samplerCube reflectionSamplerLow
,in samplerCube reflectionSamplerHigh
,in sampler2D reflectionSamplerLow
,in sampler2D reflectionSamplerHigh
,in vec2 vReflectionFilteringInfo
,in float seo
,in float eho
)
{sheenOutParams outParams;float sheenIntensity=vSheenColor.a;
outParams.sheenMapData=sheenMapData;
float sheenFactor=pow5(1.0-sheenIntensity);vec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);float sheenRoughness=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;
sheenIntensity*=sheenMapData.a;
vec3 sheenColor=vSheenColor.rgb;
sheenColor.rgb*=toLinearSpace(sheenMapData.rgb);
sheenColor.rgb*=sheenMapData.rgb;
sheenColor.rgb*=sheenMapLevel;
float sheenRoughness=vSheenRoughness;
sheenRoughness*=sheenMapData.a;
sheenRoughness*=sheenMapRoughnessData.a;
float sheenRoughness=roughness;
sheenIntensity*=sheenMapData.a;
sheenIntensity*=(1.-reflectance);
sheenColor*=sheenIntensity;
/*#ifdef SHEEN_SOFTER
vec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));
#else*/
vec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);
vec3 environmentSheenBrdf=environmentBrdf;
/*#endif*/
float sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);
sheenAlphaG+=AARoughnessFactors.y;
vec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);sampleReflectionTexture(
sheenAlphaG,
vReflectionMicrosurfaceInfos,
vReflectionInfos,
vReflectionColor,
NdotVUnclamped,
sheenRoughness,
reflectionSampler,
reflectionCoords,
reflectionSamplerLow,
reflectionSamplerHigh,
vReflectionFilteringInfo,
environmentSheenRadiance
);vec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);
sheenEnvironmentReflectance*=seo;
sheenEnvironmentReflectance*=eho;
outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;
outParams.finalSheenRadianceScaled=
environmentSheenRadiance.rgb *
sheenEnvironmentReflectance *
vLightingIntensity.z;
outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;
outParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;return outParams;}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name]) {
ShaderStore.IncludesShadersStore[name] = shader;
}
/** @internal */
export const pbrBlockSheen = { name, shader };
//# sourceMappingURL=pbrBlockSheen.js.map