@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.31 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../../Engines/shaderStore.js";
import "./decalFragment.js";
const name = "pbrBlockAlbedoOpacity";
const shader = `struct albedoOpacityOutParams
{surfaceAlbedo: vec3f,
alpha: f32};
fn albedoOpacityBlock(
vAlbedoColor: vec4f
,albedoTexture: vec4f
,albedoInfos: vec2f
,baseWeight: f32
,baseWeightTexture: vec4f
,vBaseWeightInfos: vec2f
,opacityMap: vec4f
,vOpacityInfos: vec2f
,detailColor: vec4f
,vDetailInfos: vec4f
,decalColor: vec4f
,vDecalInfos: vec4f
)->albedoOpacityOutParams
{var outParams: albedoOpacityOutParams;var surfaceAlbedo: vec3f=vAlbedoColor.rgb;var alpha: f32=vAlbedoColor.a;
alpha*=albedoTexture.a;
surfaceAlbedo*=toLinearSpaceVec3(albedoTexture.rgb);
surfaceAlbedo*=albedoTexture.rgb;
surfaceAlbedo*=albedoInfos.y;
surfaceAlbedo*=fragmentInputs.vColor.rgb;
var detailAlbedo: f32=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;
surfaceAlbedo*=baseWeight;
surfaceAlbedo*=baseWeightTexture.r;
alpha=getLuminance(opacityMap.rgb);
alpha*=opacityMap.a;
alpha*=vOpacityInfos.y;
alpha*=fragmentInputs.vColor.a;
if (alpha<ALPHATESTVALUE) {discard;}
alpha=1.0;
outParams.surfaceAlbedo=surfaceAlbedo;outParams.alpha=alpha;return outParams;}
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStoreWGSL[name]) {
ShaderStore.IncludesShadersStoreWGSL[name] = shader;
}
/** @internal */
export const pbrBlockAlbedoOpacityWGSL = { name, shader };
//# sourceMappingURL=pbrBlockAlbedoOpacity.js.map