@graphty/graphty-element 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/basisTextureLoader-BqIvxvNl.js +312 -0
- package/dist/basisTextureLoader-BqIvxvNl.js.map +1 -0
- package/dist/custom-elements.json +1 -0
- package/dist/dds-BlAaKjyJ.js +357 -0
- package/dist/dds-BlAaKjyJ.js.map +1 -0
- package/dist/ddsTextureLoader-D7Jh83wc.js +44 -0
- package/dist/ddsTextureLoader-D7Jh83wc.js.map +1 -0
- package/dist/default.fragment-BNc4beoN.js +452 -0
- package/dist/default.fragment-BNc4beoN.js.map +1 -0
- package/dist/default.fragment-CSeCDRwv.js +512 -0
- package/dist/default.fragment-CSeCDRwv.js.map +1 -0
- package/dist/default.vertex-9pBFrn06.js +202 -0
- package/dist/default.vertex-9pBFrn06.js.map +1 -0
- package/dist/default.vertex-DDjK1DRv.js +185 -0
- package/dist/default.vertex-DDjK1DRv.js.map +1 -0
- package/dist/defaultUboDeclaration-CG47IDRY.js +9 -0
- package/dist/defaultUboDeclaration-CG47IDRY.js.map +1 -0
- package/dist/defaultUboDeclaration-Ct5CiQ-w.js +11 -0
- package/dist/defaultUboDeclaration-Ct5CiQ-w.js.map +1 -0
- package/dist/dumpTools-DA1xMSIZ.js +103 -0
- package/dist/dumpTools-DA1xMSIZ.js.map +1 -0
- package/dist/envTextureLoader-DdCLpySN.js +238 -0
- package/dist/envTextureLoader-DdCLpySN.js.map +1 -0
- package/dist/exrTextureLoader-CnJSRQ9w.js +741 -0
- package/dist/exrTextureLoader-CnJSRQ9w.js.map +1 -0
- package/dist/graphty.js +12 -0
- package/dist/graphty.js.map +1 -0
- package/dist/graphty.umd.cjs +12657 -0
- package/dist/graphty.umd.cjs.map +1 -0
- package/dist/greasedLine.fragment-BZnGGe-r.js +30 -0
- package/dist/greasedLine.fragment-BZnGGe-r.js.map +1 -0
- package/dist/greasedLine.fragment-DixuqXus.js +12 -0
- package/dist/greasedLine.fragment-DixuqXus.js.map +1 -0
- package/dist/greasedLine.vertex-BhhwFKPy.js +33 -0
- package/dist/greasedLine.vertex-BhhwFKPy.js.map +1 -0
- package/dist/greasedLine.vertex-DIhgGSOi.js +49 -0
- package/dist/greasedLine.vertex-DIhgGSOi.js.map +1 -0
- package/dist/harmonicsFunctions-B9jTNKTF.js +197 -0
- package/dist/harmonicsFunctions-B9jTNKTF.js.map +1 -0
- package/dist/harmonicsFunctions-D9ZL5yLA.js +194 -0
- package/dist/harmonicsFunctions-D9ZL5yLA.js.map +1 -0
- package/dist/hdrTextureLoader-DreWCvHD.js +112 -0
- package/dist/hdrTextureLoader-DreWCvHD.js.map +1 -0
- package/dist/helperFunctions-Dh1WD8YN.js +106 -0
- package/dist/helperFunctions-Dh1WD8YN.js.map +1 -0
- package/dist/helperFunctions-ZBnqb-in.js +79 -0
- package/dist/helperFunctions-ZBnqb-in.js.map +1 -0
- package/dist/iesTextureLoader-JdfAyRK-.js +94 -0
- package/dist/iesTextureLoader-JdfAyRK-.js.map +1 -0
- package/dist/index-ChGTkj2q.js +62191 -0
- package/dist/index-ChGTkj2q.js.map +1 -0
- package/dist/instancesVertex-BrWNnWxF.js +46 -0
- package/dist/instancesVertex-BrWNnWxF.js.map +1 -0
- package/dist/instancesVertex-evcSIvCA.js +55 -0
- package/dist/instancesVertex-evcSIvCA.js.map +1 -0
- package/dist/ktxTextureLoader-Dg1h0a-4.js +520 -0
- package/dist/ktxTextureLoader-Dg1h0a-4.js.map +1 -0
- package/dist/logDepthDeclaration-BHUUDd5l.js +12 -0
- package/dist/logDepthDeclaration-BHUUDd5l.js.map +1 -0
- package/dist/logDepthDeclaration-Bou5AJOP.js +28 -0
- package/dist/logDepthDeclaration-Bou5AJOP.js.map +1 -0
- package/dist/logDepthVertex-CCFGLExi.js +496 -0
- package/dist/logDepthVertex-CCFGLExi.js.map +1 -0
- package/dist/logDepthVertex-r_niddz9.js +496 -0
- package/dist/logDepthVertex-r_niddz9.js.map +1 -0
- package/dist/mesh.vertexData.functions-Bc9lJlrU.js +75 -0
- package/dist/mesh.vertexData.functions-Bc9lJlrU.js.map +1 -0
- package/dist/meshUboDeclaration-Dg__Mhmj.js +18 -0
- package/dist/meshUboDeclaration-Dg__Mhmj.js.map +1 -0
- package/dist/oitFragment-Bn29Ggvj.js +1191 -0
- package/dist/oitFragment-Bn29Ggvj.js.map +1 -0
- package/dist/oitFragment-D6JBEGk0.js +1328 -0
- package/dist/oitFragment-D6JBEGk0.js.map +1 -0
- package/dist/pass.fragment-C9O4ZLJL.js +11 -0
- package/dist/pass.fragment-C9O4ZLJL.js.map +1 -0
- package/dist/pass.fragment-Cf0ob1Y3.js +11 -0
- package/dist/pass.fragment-Cf0ob1Y3.js.map +1 -0
- package/dist/passCube.fragment-Mg8Qj5T9.js +30 -0
- package/dist/passCube.fragment-Mg8Qj5T9.js.map +1 -0
- package/dist/passCube.fragment-uM4B7TOI.js +30 -0
- package/dist/passCube.fragment-uM4B7TOI.js.map +1 -0
- package/dist/pbr.fragment-C8Lm3cwF.js +3176 -0
- package/dist/pbr.fragment-C8Lm3cwF.js.map +1 -0
- package/dist/pbr.fragment-siOdCYqI.js +3219 -0
- package/dist/pbr.fragment-siOdCYqI.js.map +1 -0
- package/dist/pbr.vertex-Bw_TrGQv.js +229 -0
- package/dist/pbr.vertex-Bw_TrGQv.js.map +1 -0
- package/dist/pbr.vertex-CmEPCcBW.js +365 -0
- package/dist/pbr.vertex-CmEPCcBW.js.map +1 -0
- package/dist/postprocess.vertex-B086G8mM.js +16 -0
- package/dist/postprocess.vertex-B086G8mM.js.map +1 -0
- package/dist/rgbdDecode.fragment-bNaGtQ-x.js +9 -0
- package/dist/rgbdDecode.fragment-bNaGtQ-x.js.map +1 -0
- package/dist/rgbdDecode.fragment-koAcppx0.js +9 -0
- package/dist/rgbdDecode.fragment-koAcppx0.js.map +1 -0
- package/dist/rgbdEncode.fragment-BDHL2P_i.js +9 -0
- package/dist/rgbdEncode.fragment-BDHL2P_i.js.map +1 -0
- package/dist/rgbdEncode.fragment-Dw0FS9aH.js +9 -0
- package/dist/rgbdEncode.fragment-Dw0FS9aH.js.map +1 -0
- package/dist/tgaTextureLoader-DIfkfgQh.js +199 -0
- package/dist/tgaTextureLoader-DIfkfgQh.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { S as o } from "./index-ChGTkj2q.js";
|
|
2
|
+
const r = "greasedLinePixelShader", l = `var grlColors: texture_2d<f32>;var grlColorsSampler: sampler;uniform grlUseColors: f32;uniform grlUseDash: f32;uniform grlDashArray: f32;uniform grlDashOffset: f32;uniform grlDashRatio: f32;uniform grlVisibility: f32;uniform grlColorsWidth: f32;uniform grl_colorModeAndColorDistributionType: vec2f;uniform grlColor: vec3f;varying grlCounters: f32;varying grlColorPointer: f32;
|
|
3
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
4
|
+
@fragment
|
|
5
|
+
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
6
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
7
|
+
let grlColorMode: f32=uniforms.grl_colorModeAndColorDistributionType.x;let grlColorDistributionType: f32=uniforms.grl_colorModeAndColorDistributionType.y;var outColor=vec4(uniforms.grlColor,1.);outColor.a=step(fragmentInputs.grlCounters,uniforms.grlVisibility);if (outColor.a==0.0) {discard;}
|
|
8
|
+
if (uniforms.grlUseDash==1.0) {let dashPosition=(fragmentInputs.grlCounters+uniforms.grlDashOffset) % uniforms.grlDashArray;outColor.a*=ceil(dashPosition-(uniforms.grlDashArray*uniforms.grlDashRatio));if (outColor.a==0.0) {discard;}}
|
|
9
|
+
if (uniforms.grlUseColors==1.) {
|
|
10
|
+
#ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE
|
|
11
|
+
let grlColor: vec4f=textureSample(grlColors,grlColorsSampler,vec2f(fragmentInputs.grlCounters,0.));
|
|
12
|
+
#else
|
|
13
|
+
let lookup: vec2f=vec2(fract(fragmentInputs.grlColorPointer/uniforms.grlColorsWidth),1.0-floor(fragmentInputs.grlColorPointer/uniforms.grlColorsWidth));let grlColor: vec4f=textureSample(grlColors,grlColorsSampler,lookup);
|
|
14
|
+
#endif
|
|
15
|
+
if (grlColorMode==COLOR_MODE_SET) {outColor=grlColor;} else if (grlColorMode==COLOR_MODE_ADD) {outColor+=grlColor;} else if (grlColorMode==COLOR_MODE_MULTIPLY) {outColor*=grlColor;}}
|
|
16
|
+
#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
|
|
17
|
+
fragmentOutputs.color=outColor;
|
|
18
|
+
#endif
|
|
19
|
+
#if ORDER_INDEPENDENT_TRANSPARENCY
|
|
20
|
+
if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+outColor.rgb*outColor.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-outColor.a));} else {fragmentOutputs.backColor+=outColor;}
|
|
21
|
+
#endif
|
|
22
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
o.ShadersStoreWGSL[r] || (o.ShadersStoreWGSL[r] = l);
|
|
26
|
+
const t = { name: r, shader: l };
|
|
27
|
+
export {
|
|
28
|
+
t as greasedLinePixelShaderWGSL
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=greasedLine.fragment-BZnGGe-r.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greasedLine.fragment-BZnGGe-r.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/greasedLine.fragment.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"greasedLinePixelShader\";\nconst shader = `var grlColors: texture_2d<f32>;var grlColorsSampler: sampler;uniform grlUseColors: f32;uniform grlUseDash: f32;uniform grlDashArray: f32;uniform grlDashOffset: f32;uniform grlDashRatio: f32;uniform grlVisibility: f32;uniform grlColorsWidth: f32;uniform grl_colorModeAndColorDistributionType: vec2f;uniform grlColor: vec3f;varying grlCounters: f32;varying grlColorPointer: f32;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nlet grlColorMode: f32=uniforms.grl_colorModeAndColorDistributionType.x;let grlColorDistributionType: f32=uniforms.grl_colorModeAndColorDistributionType.y;var outColor=vec4(uniforms.grlColor,1.);outColor.a=step(fragmentInputs.grlCounters,uniforms.grlVisibility);if (outColor.a==0.0) {discard;}\nif (uniforms.grlUseDash==1.0) {let dashPosition=(fragmentInputs.grlCounters+uniforms.grlDashOffset) % uniforms.grlDashArray;outColor.a*=ceil(dashPosition-(uniforms.grlDashArray*uniforms.grlDashRatio));if (outColor.a==0.0) {discard;}}\nif (uniforms.grlUseColors==1.) {\n#ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\nlet grlColor: vec4f=textureSample(grlColors,grlColorsSampler,vec2f(fragmentInputs.grlCounters,0.));\n#else\nlet lookup: vec2f=vec2(fract(fragmentInputs.grlColorPointer/uniforms.grlColorsWidth),1.0-floor(fragmentInputs.grlColorPointer/uniforms.grlColorsWidth));let grlColor: vec4f=textureSample(grlColors,grlColorsSampler,lookup);\n#endif\nif (grlColorMode==COLOR_MODE_SET) {outColor=grlColor;} else if (grlColorMode==COLOR_MODE_ADD) {outColor+=grlColor;} else if (grlColorMode==COLOR_MODE_MULTIPLY) {outColor*=grlColor;}}\n#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)\nfragmentOutputs.color=outColor;\n#endif\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+outColor.rgb*outColor.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-outColor.a));} else {fragmentOutputs.backColor+=outColor;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const greasedLinePixelShaderWGSL = { name, shader };\n//# sourceMappingURL=greasedLine.fragment.js.map"],"names":["name","shader","ShaderStore","greasedLinePixelShaderWGSL"],"mappings":";AAEA,MAAMA,IAAO,0BACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBVC,EAAY,iBAAiBF,CAAI,MAClCE,EAAY,iBAAiBF,CAAI,IAAIC;AAG7B,MAACE,IAA6B,EAAE,MAAAH,GAAM,QAAAC,EAAM;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { S as o } from "./index-ChGTkj2q.js";
|
|
2
|
+
const r = "greasedLinePixelShader", l = `precision highp float;uniform sampler2D grlColors;uniform float grlUseColors;uniform float grlUseDash;uniform float grlDashArray;uniform float grlDashOffset;uniform float grlDashRatio;uniform float grlVisibility;uniform float grlColorsWidth;uniform vec2 grl_colorModeAndColorDistributionType;uniform vec3 grlColor;varying float grlCounters;varying float grlColorPointer;void main() {float grlColorMode=grl_colorModeAndColorDistributionType.x;float grlColorDistributionType=grl_colorModeAndColorDistributionType.y;gl_FragColor=vec4(grlColor,1.);gl_FragColor.a=step(grlCounters,grlVisibility);if (gl_FragColor.a==0.) discard;if( grlUseDash==1. ){gl_FragColor.a=ceil(mod(grlCounters+grlDashOffset,grlDashArray)-(grlDashArray*grlDashRatio));if (gl_FragColor.a==0.) discard;}
|
|
3
|
+
if (grlUseColors==1.) {vec4 textureColor;if (grlColorDistributionType==COLOR_DISTRIBUTION_TYPE_LINE) {
|
|
4
|
+
textureColor=texture2D(grlColors,vec2(grlCounters,0.),0.);} else {textureColor=texture2D(grlColors,vec2(grlColorPointer/grlColorsWidth,0.),0.);}
|
|
5
|
+
if (grlColorMode==COLOR_MODE_SET) {gl_FragColor=textureColor;} else if (grlColorMode==COLOR_MODE_ADD) {gl_FragColor+=textureColor;} else if (grlColorMode==COLOR_MODE_MULTIPLY) {gl_FragColor*=textureColor;}}}
|
|
6
|
+
`;
|
|
7
|
+
o.ShadersStore[r] || (o.ShadersStore[r] = l);
|
|
8
|
+
const i = { name: r, shader: l };
|
|
9
|
+
export {
|
|
10
|
+
i as greasedLinePixelShader
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=greasedLine.fragment-DixuqXus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greasedLine.fragment-DixuqXus.js","sources":["../node_modules/@babylonjs/core/Shaders/greasedLine.fragment.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"greasedLinePixelShader\";\nconst shader = `precision highp float;uniform sampler2D grlColors;uniform float grlUseColors;uniform float grlUseDash;uniform float grlDashArray;uniform float grlDashOffset;uniform float grlDashRatio;uniform float grlVisibility;uniform float grlColorsWidth;uniform vec2 grl_colorModeAndColorDistributionType;uniform vec3 grlColor;varying float grlCounters;varying float grlColorPointer;void main() {float grlColorMode=grl_colorModeAndColorDistributionType.x;float grlColorDistributionType=grl_colorModeAndColorDistributionType.y;gl_FragColor=vec4(grlColor,1.);gl_FragColor.a=step(grlCounters,grlVisibility);if (gl_FragColor.a==0.) discard;if( grlUseDash==1. ){gl_FragColor.a=ceil(mod(grlCounters+grlDashOffset,grlDashArray)-(grlDashArray*grlDashRatio));if (gl_FragColor.a==0.) discard;}\nif (grlUseColors==1.) {vec4 textureColor;if (grlColorDistributionType==COLOR_DISTRIBUTION_TYPE_LINE) { \ntextureColor=texture2D(grlColors,vec2(grlCounters,0.),0.);} else {textureColor=texture2D(grlColors,vec2(grlColorPointer/grlColorsWidth,0.),0.);}\nif (grlColorMode==COLOR_MODE_SET) {gl_FragColor=textureColor;} else if (grlColorMode==COLOR_MODE_ADD) {gl_FragColor+=textureColor;} else if (grlColorMode==COLOR_MODE_MULTIPLY) {gl_FragColor*=textureColor;}}}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const greasedLinePixelShader = { name, shader };\n//# sourceMappingURL=greasedLine.fragment.js.map"],"names":["name","shader","ShaderStore","greasedLinePixelShader"],"mappings":";AAEA,MAAMA,IAAO,0BACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAMVC,EAAY,aAAaF,CAAI,MAC9BE,EAAY,aAAaF,CAAI,IAAIC;AAGzB,MAACE,IAAyB,EAAE,MAAAH,GAAM,QAAAC,EAAM;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { S as e } from "./index-ChGTkj2q.js";
|
|
2
|
+
import "./instancesVertex-BrWNnWxF.js";
|
|
3
|
+
const r = "greasedLineVertexShader", i = `precision highp float;
|
|
4
|
+
#include<instancesDeclaration>
|
|
5
|
+
attribute float grl_widths;attribute vec3 grl_offsets;attribute float grl_colorPointers;attribute vec3 position;uniform mat4 viewProjection;uniform mat4 projection;varying float grlCounters;varying float grlColorPointer;
|
|
6
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
7
|
+
attribute vec4 grl_nextAndCounters;attribute vec4 grl_previousAndSide;uniform vec2 grlResolution;uniform float grlAspect;uniform float grlWidth;uniform float grlSizeAttenuation;vec2 grlFix( vec4 i,float aspect ) {vec2 res=i.xy/i.w;res.x*=aspect;return res;}
|
|
8
|
+
#else
|
|
9
|
+
attribute vec3 grl_slopes;attribute float grl_counters;
|
|
10
|
+
#endif
|
|
11
|
+
void main() {
|
|
12
|
+
#include<instancesVertex>
|
|
13
|
+
grlColorPointer=grl_colorPointers;mat4 grlMatrix=viewProjection*finalWorld ;
|
|
14
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
15
|
+
float grlBaseWidth=grlWidth;vec3 grlPrevious=grl_previousAndSide.xyz;float grlSide=grl_previousAndSide.w;vec3 grlNext=grl_nextAndCounters.xyz;grlCounters=grl_nextAndCounters.w;float grlWidth=grlBaseWidth*grl_widths;vec3 positionUpdated=position+grl_offsets;vec3 worldDir=normalize(grlNext-grlPrevious);vec3 nearPosition=positionUpdated+(worldDir*0.001);vec4 grlFinalPosition=grlMatrix*vec4( positionUpdated ,1.0);vec4 screenNearPos=grlMatrix*vec4(nearPosition,1.0);vec2 grlLinePosition=grlFix(grlFinalPosition,grlAspect);vec2 grlLineNearPosition=grlFix(screenNearPos,grlAspect);vec2 grlDir=normalize(grlLineNearPosition-grlLinePosition);vec4 grlNormal=vec4( -grlDir.y,grlDir.x,0.,1. );
|
|
16
|
+
#ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM
|
|
17
|
+
grlNormal.xy*=-.5*grlWidth;
|
|
18
|
+
#else
|
|
19
|
+
grlNormal.xy*=.5*grlWidth;
|
|
20
|
+
#endif
|
|
21
|
+
grlNormal*=projection;if (grlSizeAttenuation==1.) {grlNormal.xy*=grlFinalPosition.w;grlNormal.xy/=( vec4( grlResolution,0.,1. )*projection ).xy;}
|
|
22
|
+
grlFinalPosition.xy+=grlNormal.xy*grlSide;gl_Position=grlFinalPosition;
|
|
23
|
+
#else
|
|
24
|
+
grlCounters=grl_counters;vec4 grlFinalPosition=grlMatrix*vec4( (position+grl_offsets)+grl_slopes*grl_widths ,1.0 ) ;gl_Position=grlFinalPosition;
|
|
25
|
+
#endif
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
e.ShadersStore[r] || (e.ShadersStore[r] = i);
|
|
29
|
+
const l = { name: r, shader: i };
|
|
30
|
+
export {
|
|
31
|
+
l as greasedLineVertexShader
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=greasedLine.vertex-BhhwFKPy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greasedLine.vertex-BhhwFKPy.js","sources":["../node_modules/@babylonjs/core/Shaders/greasedLine.vertex.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nconst name = \"greasedLineVertexShader\";\nconst shader = `precision highp float;\n#include<instancesDeclaration>\nattribute float grl_widths;attribute vec3 grl_offsets;attribute float grl_colorPointers;attribute vec3 position;uniform mat4 viewProjection;uniform mat4 projection;varying float grlCounters;varying float grlColorPointer;\n#ifdef GREASED_LINE_CAMERA_FACING\nattribute vec4 grl_nextAndCounters;attribute vec4 grl_previousAndSide;uniform vec2 grlResolution;uniform float grlAspect;uniform float grlWidth;uniform float grlSizeAttenuation;vec2 grlFix( vec4 i,float aspect ) {vec2 res=i.xy/i.w;res.x*=aspect;return res;}\n#else\nattribute vec3 grl_slopes;attribute float grl_counters;\n#endif\nvoid main() {\n#include<instancesVertex>\ngrlColorPointer=grl_colorPointers;mat4 grlMatrix=viewProjection*finalWorld ;\n#ifdef GREASED_LINE_CAMERA_FACING\nfloat grlBaseWidth=grlWidth;vec3 grlPrevious=grl_previousAndSide.xyz;float grlSide=grl_previousAndSide.w;vec3 grlNext=grl_nextAndCounters.xyz;grlCounters=grl_nextAndCounters.w;float grlWidth=grlBaseWidth*grl_widths;vec3 positionUpdated=position+grl_offsets;vec3 worldDir=normalize(grlNext-grlPrevious);vec3 nearPosition=positionUpdated+(worldDir*0.001);vec4 grlFinalPosition=grlMatrix*vec4( positionUpdated ,1.0);vec4 screenNearPos=grlMatrix*vec4(nearPosition,1.0);vec2 grlLinePosition=grlFix(grlFinalPosition,grlAspect);vec2 grlLineNearPosition=grlFix(screenNearPos,grlAspect);vec2 grlDir=normalize(grlLineNearPosition-grlLinePosition);vec4 grlNormal=vec4( -grlDir.y,grlDir.x,0.,1. );\n#ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\ngrlNormal.xy*=-.5*grlWidth;\n#else\ngrlNormal.xy*=.5*grlWidth;\n#endif\ngrlNormal*=projection;if (grlSizeAttenuation==1.) {grlNormal.xy*=grlFinalPosition.w;grlNormal.xy/=( vec4( grlResolution,0.,1. )*projection ).xy;}\ngrlFinalPosition.xy+=grlNormal.xy*grlSide;gl_Position=grlFinalPosition;\n#else\ngrlCounters=grl_counters;vec4 grlFinalPosition=grlMatrix*vec4( (position+grl_offsets)+grl_slopes*grl_widths ,1.0 ) ;gl_Position=grlFinalPosition;\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const greasedLineVertexShader = { name, shader };\n//# sourceMappingURL=greasedLine.vertex.js.map"],"names":["name","shader","ShaderStore","greasedLineVertexShader"],"mappings":";;AAIA,MAAMA,IAAO,2BACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BVC,EAAY,aAAaF,CAAI,MAC9BE,EAAY,aAAaF,CAAI,IAAIC;AAGzB,MAACE,IAA0B,EAAE,MAAAH,GAAM,QAAAC,EAAM;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { S as r } from "./index-ChGTkj2q.js";
|
|
2
|
+
import "./instancesVertex-evcSIvCA.js";
|
|
3
|
+
import "./meshUboDeclaration-Dg__Mhmj.js";
|
|
4
|
+
const e = "greasedLineVertexShader", t = `#include<instancesDeclaration>
|
|
5
|
+
#include<sceneUboDeclaration>
|
|
6
|
+
#include<meshUboDeclaration>
|
|
7
|
+
attribute grl_widths: f32;
|
|
8
|
+
#ifdef GREASED_LINE_USE_OFFSETS
|
|
9
|
+
attribute grl_offsets: vec3f;
|
|
10
|
+
#endif
|
|
11
|
+
attribute grl_colorPointers: f32;attribute position: vec3f;varying grlCounters: f32;varying grlColorPointer: f32;
|
|
12
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
13
|
+
attribute grl_nextAndCounters: vec4f;attribute grl_previousAndSide: vec4f;uniform grlResolution: vec2f;uniform grlAspect: f32;uniform grlWidth: f32;uniform grlSizeAttenuation: f32;fn grlFix(i: vec4f,aspect: f32)->vec2f {var res=i.xy/i.w;res.x*=aspect;return res;}
|
|
14
|
+
#else
|
|
15
|
+
attribute grl_slopes: vec3f;attribute grl_counters: f32;
|
|
16
|
+
#endif
|
|
17
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
18
|
+
@vertex
|
|
19
|
+
fn main(input : VertexInputs)->FragmentInputs {
|
|
20
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
|
21
|
+
#include<instancesVertex>
|
|
22
|
+
vertexOutputs.grlColorPointer=input.grl_colorPointers;let grlMatrix: mat4x4f=scene.viewProjection*mesh.world ;
|
|
23
|
+
#ifdef GREASED_LINE_CAMERA_FACING
|
|
24
|
+
let grlBaseWidth: f32=uniforms.grlWidth;let grlPrevious: vec3f=input.grl_previousAndSide.xyz;let grlSide: f32=input.grl_previousAndSide.w;let grlNext: vec3f=input.grl_nextAndCounters.xyz;vertexOutputs.grlCounters=input.grl_nextAndCounters.w;let grlWidth:f32=grlBaseWidth*input.grl_widths;
|
|
25
|
+
#ifdef GREASED_LINE_USE_OFFSETS
|
|
26
|
+
var grlPositionOffset: vec3f=input.grl_offsets;
|
|
27
|
+
#else
|
|
28
|
+
var grlPositionOffset=vec3f(0.);
|
|
29
|
+
#endif
|
|
30
|
+
let positionUpdated: vec3f=vertexInputs.position+grlPositionOffset;let worldDir: vec3f=normalize(grlNext-grlPrevious);let nearPosition: vec3f=positionUpdated+(worldDir*0.001);let grlFinalPosition: vec4f=grlMatrix*vec4f(positionUpdated,1.0);let screenNearPos: vec4f=grlMatrix*vec4(nearPosition,1.0);let grlLinePosition: vec2f=grlFix(grlFinalPosition,uniforms.grlAspect);let grlLineNearPosition: vec2f=grlFix(screenNearPos,uniforms.grlAspect);let grlDir: vec2f=normalize(grlLineNearPosition-grlLinePosition);var grlNormal: vec4f=vec4f(-grlDir.y,grlDir.x,0.0,1.0);let grlHalfWidth: f32=0.5*grlWidth;
|
|
31
|
+
#if defined(GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM)
|
|
32
|
+
grlNormal.x*=-grlHalfWidth;grlNormal.y*=-grlHalfWidth;
|
|
33
|
+
#else
|
|
34
|
+
grlNormal.x*=grlHalfWidth;grlNormal.y*=grlHalfWidth;
|
|
35
|
+
#endif
|
|
36
|
+
grlNormal*=scene.projection;if (uniforms.grlSizeAttenuation==1.) {grlNormal.x*=grlFinalPosition.w;grlNormal.y*=grlFinalPosition.w;let pr=vec4f(uniforms.grlResolution,0.0,1.0)*scene.projection;grlNormal.x/=pr.x;grlNormal.y/=pr.y;}
|
|
37
|
+
vertexOutputs.position=vec4f(grlFinalPosition.xy+grlNormal.xy*grlSide,grlFinalPosition.z,grlFinalPosition.w);
|
|
38
|
+
#else
|
|
39
|
+
vertexOutputs.grlCounters=input.grl_counters;vertexOutputs.position=grlMatrix*vec4f((vertexInputs.position+input.grl_offsets)+input.grl_slopes*input.grl_widths,1.0) ;
|
|
40
|
+
#endif
|
|
41
|
+
#define CUSTOM_VERTEX_MAIN_END
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
r.ShadersStoreWGSL[e] || (r.ShadersStoreWGSL[e] = t);
|
|
45
|
+
const o = { name: e, shader: t };
|
|
46
|
+
export {
|
|
47
|
+
o as greasedLineVertexShaderWGSL
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=greasedLine.vertex-DIhgGSOi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greasedLine.vertex-DIhgGSOi.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/greasedLine.vertex.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/sceneUboDeclaration.js\";\nimport \"./ShadersInclude/meshUboDeclaration.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nconst name = \"greasedLineVertexShader\";\nconst shader = `#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\nattribute grl_widths: f32;\n#ifdef GREASED_LINE_USE_OFFSETS\nattribute grl_offsets: vec3f; \n#endif\nattribute grl_colorPointers: f32;attribute position: vec3f;varying grlCounters: f32;varying grlColorPointer: f32;\n#ifdef GREASED_LINE_CAMERA_FACING\nattribute grl_nextAndCounters: vec4f;attribute grl_previousAndSide: vec4f;uniform grlResolution: vec2f;uniform grlAspect: f32;uniform grlWidth: f32;uniform grlSizeAttenuation: f32;fn grlFix(i: vec4f,aspect: f32)->vec2f {var res=i.xy/i.w;res.x*=aspect;return res;}\n#else\nattribute grl_slopes: vec3f;attribute grl_counters: f32;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvertexOutputs.grlColorPointer=input.grl_colorPointers;let grlMatrix: mat4x4f=scene.viewProjection*mesh.world ;\n#ifdef GREASED_LINE_CAMERA_FACING\nlet grlBaseWidth: f32=uniforms.grlWidth;let grlPrevious: vec3f=input.grl_previousAndSide.xyz;let grlSide: f32=input.grl_previousAndSide.w;let grlNext: vec3f=input.grl_nextAndCounters.xyz;vertexOutputs.grlCounters=input.grl_nextAndCounters.w;let grlWidth:f32=grlBaseWidth*input.grl_widths;\n#ifdef GREASED_LINE_USE_OFFSETS\nvar grlPositionOffset: vec3f=input.grl_offsets;\n#else\nvar grlPositionOffset=vec3f(0.);\n#endif\nlet positionUpdated: vec3f=vertexInputs.position+grlPositionOffset;let worldDir: vec3f=normalize(grlNext-grlPrevious);let nearPosition: vec3f=positionUpdated+(worldDir*0.001);let grlFinalPosition: vec4f=grlMatrix*vec4f(positionUpdated,1.0);let screenNearPos: vec4f=grlMatrix*vec4(nearPosition,1.0);let grlLinePosition: vec2f=grlFix(grlFinalPosition,uniforms.grlAspect);let grlLineNearPosition: vec2f=grlFix(screenNearPos,uniforms.grlAspect);let grlDir: vec2f=normalize(grlLineNearPosition-grlLinePosition);var grlNormal: vec4f=vec4f(-grlDir.y,grlDir.x,0.0,1.0);let grlHalfWidth: f32=0.5*grlWidth;\n#if defined(GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM)\ngrlNormal.x*=-grlHalfWidth;grlNormal.y*=-grlHalfWidth;\n#else\ngrlNormal.x*=grlHalfWidth;grlNormal.y*=grlHalfWidth;\n#endif\ngrlNormal*=scene.projection;if (uniforms.grlSizeAttenuation==1.) {grlNormal.x*=grlFinalPosition.w;grlNormal.y*=grlFinalPosition.w;let pr=vec4f(uniforms.grlResolution,0.0,1.0)*scene.projection;grlNormal.x/=pr.x;grlNormal.y/=pr.y;}\nvertexOutputs.position=vec4f(grlFinalPosition.xy+grlNormal.xy*grlSide,grlFinalPosition.z,grlFinalPosition.w);\n#else\nvertexOutputs.grlCounters=input.grl_counters;vertexOutputs.position=grlMatrix*vec4f((vertexInputs.position+input.grl_offsets)+input.grl_slopes*input.grl_widths,1.0) ;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const greasedLineVertexShaderWGSL = { name, shader };\n//# sourceMappingURL=greasedLine.vertex.js.map"],"names":["name","shader","ShaderStore","greasedLineVertexShaderWGSL"],"mappings":";;;AAMA,MAAMA,IAAO,2BACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCVC,EAAY,iBAAiBF,CAAI,MAClCE,EAAY,iBAAiBF,CAAI,IAAIC;AAG7B,MAACE,IAA8B,EAAE,MAAAH,GAAM,QAAAC,EAAM;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { S as e } from "./index-ChGTkj2q.js";
|
|
2
|
+
import "./meshUboDeclaration-Dg__Mhmj.js";
|
|
3
|
+
const f = "pbrUboDeclaration", n = `uniform vAlbedoInfos: vec2f;uniform vBaseWeightInfos: vec2f;uniform vBaseDiffuseRoughnessInfos: vec2f;uniform vAmbientInfos: vec4f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vReflectivityInfos: vec3f;uniform vMicroSurfaceSamplerInfos: vec2f;uniform vReflectionInfos: vec2f;uniform vReflectionFilteringInfo: vec2f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;uniform vBumpInfos: vec3f;uniform albedoMatrix: mat4x4f;uniform baseWeightMatrix: mat4x4f;uniform baseDiffuseRoughnessMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform reflectivityMatrix: mat4x4f;uniform microSurfaceSamplerMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionColor: vec3f;uniform vAlbedoColor: vec4f;uniform baseWeight: f32;uniform baseDiffuseRoughness: f32;uniform vLightingIntensity: vec4f;uniform vReflectionMicrosurfaceInfos: vec3f;uniform vReflectionDominantDirection: vec3f;uniform pointSize: f32;uniform vReflectivityColor: vec4f;uniform vEmissiveColor: vec3f;uniform vAmbientColor: vec3f;uniform vDebugMode: vec2f;uniform vMetallicReflectanceFactors: vec4f;uniform vMetallicReflectanceInfos: vec2f;uniform metallicReflectanceMatrix: mat4x4f;uniform vReflectanceInfos: vec2f;uniform reflectanceMatrix: mat4x4f;uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f;uniform cameraInfo: vec4f;
|
|
4
|
+
#define ADDITIONAL_UBO_DECLARATION
|
|
5
|
+
#include<sceneUboDeclaration>
|
|
6
|
+
#include<meshUboDeclaration>
|
|
7
|
+
`;
|
|
8
|
+
e.IncludesShadersStoreWGSL[f] || (e.IncludesShadersStoreWGSL[f] = n);
|
|
9
|
+
const r = "pbrBRDFFunctions", i = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
|
|
10
|
+
#define BRDF_DIFFUSE_MODEL_EON 0
|
|
11
|
+
#define BRDF_DIFFUSE_MODEL_BURLEY 1
|
|
12
|
+
#define BRDF_DIFFUSE_MODEL_LAMBERT 2
|
|
13
|
+
#define BRDF_DIFFUSE_MODEL_LEGACY 3
|
|
14
|
+
#define DIELECTRIC_SPECULAR_MODEL_GLTF 0
|
|
15
|
+
#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1
|
|
16
|
+
#define CONDUCTOR_SPECULAR_MODEL_GLTF 0
|
|
17
|
+
#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1
|
|
18
|
+
#ifndef PBR_VERTEX_SHADER
|
|
19
|
+
#ifdef MS_BRDF_ENERGY_CONSERVATION
|
|
20
|
+
fn getEnergyConservationFactor(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}
|
|
21
|
+
#endif
|
|
22
|
+
#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR
|
|
23
|
+
fn getF82Specular(NdotV: f32,F0: vec3f,edgeTint: vec3f,roughness: f32)->vec3f {const cos_theta_max: f32=0.142857143;
|
|
24
|
+
const one_minus_cos_theta_max_to_the_fifth: f32=0.462664366;
|
|
25
|
+
const one_minus_cos_theta_max_to_the_sixth: f32=0.396569457;
|
|
26
|
+
let white_minus_F0: vec3f=vec3f(1.0f)-F0;let b_numerator: vec3f=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3f(1.0)-edgeTint);const b_denominator: f32=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const b_denominator_reciprocal: f32=1.0f/b_denominator;let b: vec3f=b_numerator*b_denominator_reciprocal;
|
|
27
|
+
let cos_theta: f32=max(roughness,NdotV);let one_minus_cos_theta: f32=1.0-cos_theta;let offset_from_F0: vec3f=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0f);return clamp(F0+offset_from_F0,vec3f(0.0f),vec3f(1.0f));}
|
|
28
|
+
#endif
|
|
29
|
+
#ifdef ENVIRONMENTBRDF
|
|
30
|
+
fn getBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {var UV: vec2f= vec2f(NdotV,perceptualRoughness);var brdfLookup: vec4f= textureSample(environmentBrdfSampler,environmentBrdfSamplerSampler,UV);
|
|
31
|
+
#ifdef ENVIRONMENTBRDF_RGBD
|
|
32
|
+
brdfLookup=vec4f(fromRGBD(brdfLookup.rgba),brdfLookup.a);
|
|
33
|
+
#endif
|
|
34
|
+
return brdfLookup.rgb;}
|
|
35
|
+
fn getReflectanceFromBRDFWithEnvLookup(specularEnvironmentR0: vec3f,specularEnvironmentR90: vec3f,environmentBrdf: vec3f)->vec3f {
|
|
36
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
37
|
+
var reflectance: vec3f=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
|
|
38
|
+
#else
|
|
39
|
+
var reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
|
|
40
|
+
#endif
|
|
41
|
+
return reflectance;}
|
|
42
|
+
fn getReflectanceFromBRDFLookup(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {
|
|
43
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
44
|
+
var reflectance: vec3f=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
|
|
45
|
+
#else
|
|
46
|
+
var reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
|
|
47
|
+
#endif
|
|
48
|
+
return reflectance;}
|
|
49
|
+
#endif
|
|
50
|
+
/* NOT USED
|
|
51
|
+
#if defined(SHEEN) && defined(SHEEN_SOFTER)
|
|
52
|
+
fn getBRDFLookupCharlieSheen(NdotV: f32,perceptualRoughness: f32)->f32
|
|
53
|
+
{var c: f32=1.0-NdotV;var c3: f32=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}
|
|
54
|
+
#endif
|
|
55
|
+
*/
|
|
56
|
+
#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
|
|
57
|
+
fn getReflectanceFromAnalyticalBRDFLookup_Jones(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f
|
|
58
|
+
{var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}
|
|
59
|
+
#endif
|
|
60
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
|
|
61
|
+
/**
|
|
62
|
+
* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.
|
|
63
|
+
* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table
|
|
64
|
+
*/
|
|
65
|
+
fn getSheenReflectanceFromBRDFLookup(reflectance0: vec3f,environmentBrdf: vec3f)->vec3f {var sheenEnvironmentReflectance: vec3f=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}
|
|
66
|
+
#endif
|
|
67
|
+
fn fresnelSchlickGGXVec3(VdotH: f32,reflectance0: vec3f,reflectance90: vec3f)->vec3f
|
|
68
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
69
|
+
fn fresnelSchlickGGX(VdotH: f32,reflectance0: f32,reflectance90: f32)->f32
|
|
70
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
71
|
+
#ifdef CLEARCOAT
|
|
72
|
+
fn getR0RemappedForClearCoat(f0: vec3f)->vec3f {
|
|
73
|
+
#ifdef CLEARCOAT_DEFAULTIOR
|
|
74
|
+
#ifdef MOBILE
|
|
75
|
+
return saturateVec3(f0*(f0*0.526868+0.529324)-0.0482256);
|
|
76
|
+
#else
|
|
77
|
+
return saturateVec3(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
|
|
78
|
+
#endif
|
|
79
|
+
#else
|
|
80
|
+
var s: vec3f=sqrt(f0);var t: vec3f=(uniforms.vClearCoatRefractionParams.z+uniforms.vClearCoatRefractionParams.w*s)/(uniforms.vClearCoatRefractionParams.w+uniforms.vClearCoatRefractionParams.z*s);return squareVec3(t);
|
|
81
|
+
#endif
|
|
82
|
+
}
|
|
83
|
+
#endif
|
|
84
|
+
#ifdef IRIDESCENCE
|
|
85
|
+
const XYZ_TO_REC709: mat3x3f= mat3x3f(
|
|
86
|
+
3.2404542,-0.9692660, 0.0556434,
|
|
87
|
+
-1.5371385, 1.8760108,-0.2040259,
|
|
88
|
+
-0.4985314, 0.0415560, 1.0572252
|
|
89
|
+
);fn getIORTfromAirToSurfaceR0(f0: vec3f)->vec3f {var sqrtF0: vec3f=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}
|
|
90
|
+
fn getR0fromIORsVec3(iorT: vec3f,iorI: f32)->vec3f {return squareVec3((iorT- vec3f(iorI))/(iorT+ vec3f(iorI)));}
|
|
91
|
+
fn getR0fromIORs(iorT: f32,iorI: f32)->f32 {return square((iorT-iorI)/(iorT+iorI));}
|
|
92
|
+
fn evalSensitivity(opd: f32,shift: vec3f)->vec3f {var phase: f32=2.0*PI*opd*1.0e-9;const val: vec3f= vec3f(5.4856e-13,4.4201e-13,5.2481e-13);const pos: vec3f= vec3f(1.6810e+06,1.7953e+06,2.2084e+06);const vr: vec3f= vec3f(4.3278e+09,9.3046e+09,6.6121e+09);var xyz: vec3f=val*sqrt(2.0*PI*vr)*cos(pos*phase+shift)*exp(-square(phase)*vr);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;var srgb: vec3f=XYZ_TO_REC709*xyz;return srgb;}
|
|
93
|
+
fn evalIridescence(outsideIOR: f32,eta2: f32,cosTheta1: f32,thinFilmThickness: f32,baseF0: vec3f)->vec3f {var I: vec3f= vec3f(1.0);var iridescenceIOR: f32=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));var sinTheta2Sq: f32=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));var cosTheta2Sq: f32=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}
|
|
94
|
+
var cosTheta2: f32=sqrt(cosTheta2Sq);var R0: f32=getR0fromIORs(iridescenceIOR,outsideIOR);var R12: f32=fresnelSchlickGGX(cosTheta1,R0,1.);var R21: f32=R12;var T121: f32=1.0-R12;var phi12: f32=0.0;if (iridescenceIOR<outsideIOR) {phi12=PI;}
|
|
95
|
+
var phi21: f32=PI-phi12;var baseIOR: vec3f=getIORTfromAirToSurfaceR0(clamp(baseF0,vec3f(0.0),vec3f(0.9999)));
|
|
96
|
+
var R1: vec3f=getR0fromIORsVec3(baseIOR,iridescenceIOR);var R23: vec3f=fresnelSchlickGGXVec3(cosTheta2,R1, vec3f(1.));var phi23: vec3f= vec3f(0.0);if (baseIOR[0]<iridescenceIOR) {phi23[0]=PI;}
|
|
97
|
+
if (baseIOR[1]<iridescenceIOR) {phi23[1]=PI;}
|
|
98
|
+
if (baseIOR[2]<iridescenceIOR) {phi23[2]=PI;}
|
|
99
|
+
var opd: f32=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;var phi: vec3f= vec3f(phi21)+phi23;var R123: vec3f=clamp(R12*R23,vec3f(1e-5),vec3f(0.9999));var r123: vec3f=sqrt(R123);var Rs: vec3f=(T121*T121)*R23/( vec3f(1.0)-R123);var C0: vec3f=R12+Rs;I=C0;var Cm: vec3f=Rs-T121;for (var m: i32=1; m<=2; m++)
|
|
100
|
+
{Cm*=r123;var Sm: vec3f=2.0*evalSensitivity( f32(m)*opd, f32(m)*phi);I+=Cm*Sm;}
|
|
101
|
+
return max(I, vec3f(0.0));}
|
|
102
|
+
#endif
|
|
103
|
+
fn normalDistributionFunction_TrowbridgeReitzGGX(NdotH: f32,alphaG: f32)->f32
|
|
104
|
+
{var a2: f32=alphaG*alphaG;var d: f32=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}
|
|
105
|
+
#ifdef SHEEN
|
|
106
|
+
fn normalDistributionFunction_CharlieSheen(NdotH: f32,alphaG: f32)->f32
|
|
107
|
+
{var invR: f32=1./alphaG;var cos2h: f32=NdotH*NdotH;var sin2h: f32=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}
|
|
108
|
+
#endif
|
|
109
|
+
#ifdef ANISOTROPIC
|
|
110
|
+
fn normalDistributionFunction_BurleyGGX_Anisotropic(NdotH: f32,TdotH: f32,BdotH: f32,alphaTB: vec2f)->f32 {var a2: f32=alphaTB.x*alphaTB.y;var v: vec3f= vec3f(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);var v2: f32=dot(v,v);var w2: f32=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}
|
|
111
|
+
#endif
|
|
112
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
113
|
+
fn smithVisibility_GGXCorrelated(NdotL: f32,NdotV: f32,alphaG: f32)->f32 {
|
|
114
|
+
#ifdef MOBILE
|
|
115
|
+
var GGXV: f32=NdotL*(NdotV*(1.0-alphaG)+alphaG);var GGXL: f32=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);
|
|
116
|
+
#else
|
|
117
|
+
var a2: f32=alphaG*alphaG;var GGXV: f32=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);var GGXL: f32=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);
|
|
118
|
+
#endif
|
|
119
|
+
}
|
|
120
|
+
#else
|
|
121
|
+
fn smithVisibilityG1_TrowbridgeReitzGGXFast(dot: f32,alphaG: f32)->f32
|
|
122
|
+
{
|
|
123
|
+
#ifdef MOBILE
|
|
124
|
+
return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
|
|
125
|
+
#else
|
|
126
|
+
var alphaSquared: f32=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
|
|
127
|
+
#endif
|
|
128
|
+
}
|
|
129
|
+
fn smithVisibility_TrowbridgeReitzGGXFast(NdotL: f32,NdotV: f32,alphaG: f32)->f32
|
|
130
|
+
{var visibility: f32=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}
|
|
131
|
+
#endif
|
|
132
|
+
#ifdef ANISOTROPIC
|
|
133
|
+
fn smithVisibility_GGXCorrelated_Anisotropic(NdotL: f32,NdotV: f32,TdotV: f32,BdotV: f32,TdotL: f32,BdotL: f32,alphaTB: vec2f)->f32 {var lambdaV: f32=NdotL*length( vec3f(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));var lambdaL: f32=NdotV*length( vec3f(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));var v: f32=0.5/(lambdaV+lambdaL);return v;}
|
|
134
|
+
#endif
|
|
135
|
+
#ifdef CLEARCOAT
|
|
136
|
+
fn visibility_Kelemen(VdotH: f32)->f32 {return 0.25/(VdotH*VdotH); }
|
|
137
|
+
#endif
|
|
138
|
+
#ifdef SHEEN
|
|
139
|
+
fn visibility_Ashikhmin(NdotL: f32,NdotV: f32)->f32
|
|
140
|
+
{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}
|
|
141
|
+
/* NOT USED
|
|
142
|
+
#ifdef SHEEN_SOFTER
|
|
143
|
+
fn l(x: f32,alphaG: f32)->f32
|
|
144
|
+
{var oneMinusAlphaSq: f32=(1.0-alphaG)*(1.0-alphaG);var a: f32=mix(21.5473,25.3245,oneMinusAlphaSq);var b: f32=mix(3.82987,3.32435,oneMinusAlphaSq);var c: f32=mix(0.19823,0.16801,oneMinusAlphaSq);var d: f32=mix(-1.97760,-1.27393,oneMinusAlphaSq);var e: f32=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}
|
|
145
|
+
fn lambdaSheen(cosTheta: f32,alphaG: f32)->f32
|
|
146
|
+
{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}
|
|
147
|
+
fn visibility_CharlieSheen(NdotL: f32,NdotV: f32,alphaG: f32)->f32
|
|
148
|
+
{var G: f32=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}
|
|
149
|
+
#endif
|
|
150
|
+
*/
|
|
151
|
+
#endif
|
|
152
|
+
const constant1_FON: f32=0.5f-2.0f/(3.0f*PI);const constant2_FON: f32=2.0f/3.0f-28.0f/(15.0f*PI);fn E_FON_approx(mu: f32,roughness: f32)->f32
|
|
153
|
+
{var sigma: f32=roughness;
|
|
154
|
+
var mucomp: f32=1.0f-mu;var mucomp2: f32=mucomp*mucomp;const Gcoeffs: mat2x2f=mat2x2f(0.0571085289f,-0.332181442f,
|
|
155
|
+
0.491881867f,0.0714429953f);var GoverPi: f32=dot(Gcoeffs*vec2f(mucomp,mucomp2),vec2f(1.0f,mucomp2));return (1.0f+sigma*GoverPi)/(1.0f+constant1_FON*sigma);}
|
|
156
|
+
fn diffuseBRDF_EON(albedo: vec3f,roughness: f32,NdotL: f32,NdotV: f32,LdotV: f32)->vec3f
|
|
157
|
+
{var rho: vec3f=albedo;var sigma: f32=roughness;
|
|
158
|
+
var mu_i: f32=NdotL;
|
|
159
|
+
var mu_o: f32=NdotV;
|
|
160
|
+
var s: f32=LdotV-mu_i*mu_o;
|
|
161
|
+
var sovertF: f32=select(s,s/max(mu_i,mu_o),s>0.0f);
|
|
162
|
+
var AF: f32=1.0f/(1.0f+constant1_FON*sigma);
|
|
163
|
+
var f_ss: vec3f=(rho*RECIPROCAL_PI)*AF*(1.0f+sigma*sovertF);
|
|
164
|
+
var EFo: f32=E_FON_approx(mu_o,sigma);
|
|
165
|
+
var EFi: f32=E_FON_approx(mu_i,sigma);
|
|
166
|
+
var avgEF: f32=AF*(1.0f+constant2_FON*sigma);
|
|
167
|
+
var rho_ms: vec3f=(rho*rho)*avgEF/(vec3f(1.0f)-rho*(1.0f-avgEF));const eps: f32=1.0e-7f;var f_ms: vec3f=(rho_ms*RECIPROCAL_PI)*max(eps,1.0f-EFo)
|
|
168
|
+
* max(eps,1.0f-EFi)
|
|
169
|
+
/ max(eps,1.0f-avgEF);return (f_ss+f_ms);}
|
|
170
|
+
fn diffuseBRDF_Burley(NdotL: f32,NdotV: f32,VdotH: f32,roughness: f32)->f32 {var diffuseFresnelNV: f32=pow5(saturateEps(1.0-NdotL));var diffuseFresnelNL: f32=pow5(saturateEps(1.0-NdotV));var diffuseFresnel90: f32=0.5+2.0*VdotH*VdotH*roughness;var fresnel: f32 =
|
|
171
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
|
|
172
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}
|
|
173
|
+
#ifdef SS_TRANSLUCENCY
|
|
174
|
+
fn transmittanceBRDF_Burley(tintColor: vec3f,diffusionDistance: vec3f,thickness: f32)->vec3f {var S: vec3f=1./maxEpsVec3(diffusionDistance);var temp: vec3f=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}
|
|
175
|
+
fn computeWrappedDiffuseNdotL(NdotL: f32,w: f32)->f32 {var t: f32=1.0+w;var invt2: f32=1.0/(t*t);return saturate((NdotL+w)*invt2);}
|
|
176
|
+
#endif
|
|
177
|
+
#endif
|
|
178
|
+
`;
|
|
179
|
+
e.IncludesShadersStoreWGSL[r] || (e.IncludesShadersStoreWGSL[r] = i);
|
|
180
|
+
const a = "harmonicsFunctions", o = `#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
181
|
+
#ifdef SPHERICAL_HARMONICS
|
|
182
|
+
fn computeEnvironmentIrradiance(normal: vec3f)->vec3f {return uniforms.vSphericalL00
|
|
183
|
+
+ uniforms.vSphericalL1_1*(normal.y)
|
|
184
|
+
+ uniforms.vSphericalL10*(normal.z)
|
|
185
|
+
+ uniforms.vSphericalL11*(normal.x)
|
|
186
|
+
+ uniforms.vSphericalL2_2*(normal.y*normal.x)
|
|
187
|
+
+ uniforms.vSphericalL2_1*(normal.y*normal.z)
|
|
188
|
+
+ uniforms.vSphericalL20*((3.0*normal.z*normal.z)-1.0)
|
|
189
|
+
+ uniforms.vSphericalL21*(normal.z*normal.x)
|
|
190
|
+
+ uniforms.vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}
|
|
191
|
+
#else
|
|
192
|
+
fn computeEnvironmentIrradiance(normal: vec3f)->vec3f {var Nx: f32=normal.x;var Ny: f32=normal.y;var Nz: f32=normal.z;var C1: vec3f=uniforms.vSphericalZZ.rgb;var Cx: vec3f=uniforms.vSphericalX.rgb;var Cy: vec3f=uniforms.vSphericalY.rgb;var Cz: vec3f=uniforms.vSphericalZ.rgb;var Cxx_zz: vec3f=uniforms.vSphericalXX_ZZ.rgb;var Cyy_zz: vec3f=uniforms.vSphericalYY_ZZ.rgb;var Cxy: vec3f=uniforms.vSphericalXY.rgb;var Cyz: vec3f=uniforms.vSphericalYZ.rgb;var Czx: vec3f=uniforms.vSphericalZX.rgb;var a1: vec3f=Cyy_zz*Ny+Cy;var a2: vec3f=Cyz*Nz+a1;var b1: vec3f=Czx*Nz+Cx;var b2: vec3f=Cxy*Ny+b1;var b3: vec3f=Cxx_zz*Nx+b2;var t1: vec3f=Cz *Nz+C1;var t2: vec3f=a2 *Ny+t1;var t3: vec3f=b3 *Nx+t2;return t3;}
|
|
193
|
+
#endif
|
|
194
|
+
#endif
|
|
195
|
+
`;
|
|
196
|
+
e.IncludesShadersStoreWGSL[a] || (e.IncludesShadersStoreWGSL[a] = o);
|
|
197
|
+
//# sourceMappingURL=harmonicsFunctions-B9jTNKTF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harmonicsFunctions-B9jTNKTF.js","sources":["../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js","../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js","../node_modules/@babylonjs/core/ShadersWGSL/ShadersInclude/harmonicsFunctions.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./sceneUboDeclaration.js\";\nimport \"./meshUboDeclaration.js\";\nconst name = \"pbrUboDeclaration\";\nconst shader = `uniform vAlbedoInfos: vec2f;uniform vBaseWeightInfos: vec2f;uniform vBaseDiffuseRoughnessInfos: vec2f;uniform vAmbientInfos: vec4f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vReflectivityInfos: vec3f;uniform vMicroSurfaceSamplerInfos: vec2f;uniform vReflectionInfos: vec2f;uniform vReflectionFilteringInfo: vec2f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;uniform vBumpInfos: vec3f;uniform albedoMatrix: mat4x4f;uniform baseWeightMatrix: mat4x4f;uniform baseDiffuseRoughnessMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform reflectivityMatrix: mat4x4f;uniform microSurfaceSamplerMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionColor: vec3f;uniform vAlbedoColor: vec4f;uniform baseWeight: f32;uniform baseDiffuseRoughness: f32;uniform vLightingIntensity: vec4f;uniform vReflectionMicrosurfaceInfos: vec3f;uniform vReflectionDominantDirection: vec3f;uniform pointSize: f32;uniform vReflectivityColor: vec4f;uniform vEmissiveColor: vec3f;uniform vAmbientColor: vec3f;uniform vDebugMode: vec2f;uniform vMetallicReflectanceFactors: vec4f;uniform vMetallicReflectanceInfos: vec2f;uniform metallicReflectanceMatrix: mat4x4f;uniform vReflectanceInfos: vec2f;uniform reflectanceMatrix: mat4x4f;uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f;uniform cameraInfo: vec4f;\n#define ADDITIONAL_UBO_DECLARATION\n#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const pbrUboDeclarationWGSL = { name, shader };\n//# sourceMappingURL=pbrUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBRDFFunctions\";\nconst shader = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n#define BRDF_DIFFUSE_MODEL_EON 0\n#define BRDF_DIFFUSE_MODEL_BURLEY 1\n#define BRDF_DIFFUSE_MODEL_LAMBERT 2\n#define BRDF_DIFFUSE_MODEL_LEGACY 3\n#define DIELECTRIC_SPECULAR_MODEL_GLTF 0\n#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1\n#define CONDUCTOR_SPECULAR_MODEL_GLTF 0\n#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1\n#ifndef PBR_VERTEX_SHADER\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nfn getEnergyConservationFactor(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}\n#endif\n#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR \nfn getF82Specular(NdotV: f32,F0: vec3f,edgeTint: vec3f,roughness: f32)->vec3f {const cos_theta_max: f32=0.142857143; \nconst one_minus_cos_theta_max_to_the_fifth: f32=0.462664366; \nconst one_minus_cos_theta_max_to_the_sixth: f32=0.396569457; \nlet white_minus_F0: vec3f=vec3f(1.0f)-F0;let b_numerator: vec3f=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3f(1.0)-edgeTint);const b_denominator: f32=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const b_denominator_reciprocal: f32=1.0f/b_denominator;let b: vec3f=b_numerator*b_denominator_reciprocal; \nlet cos_theta: f32=max(roughness,NdotV);let one_minus_cos_theta: f32=1.0-cos_theta;let offset_from_F0: vec3f=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0f);return clamp(F0+offset_from_F0,vec3f(0.0f),vec3f(1.0f));}\n#endif\n#ifdef ENVIRONMENTBRDF\nfn getBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {var UV: vec2f= vec2f(NdotV,perceptualRoughness);var brdfLookup: vec4f= textureSample(environmentBrdfSampler,environmentBrdfSamplerSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup=vec4f(fromRGBD(brdfLookup.rgba),brdfLookup.a);\n#endif\nreturn brdfLookup.rgb;}\nfn getReflectanceFromBRDFWithEnvLookup(specularEnvironmentR0: vec3f,specularEnvironmentR90: vec3f,environmentBrdf: vec3f)->vec3f {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvar reflectance: vec3f=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\n#else\nvar reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\n#endif\nreturn reflectance;}\nfn getReflectanceFromBRDFLookup(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvar reflectance: vec3f=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvar reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;}\n#endif\n/* NOT USED\n#if defined(SHEEN) && defined(SHEEN_SOFTER)\nfn getBRDFLookupCharlieSheen(NdotV: f32,perceptualRoughness: f32)->f32\n{var c: f32=1.0-NdotV;var c3: f32=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}\n#endif\n*/\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nfn getReflectanceFromAnalyticalBRDFLookup_Jones(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f\n{var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\n/**\n* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.\n* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table\n*/\nfn getSheenReflectanceFromBRDFLookup(reflectance0: vec3f,environmentBrdf: vec3f)->vec3f {var sheenEnvironmentReflectance: vec3f=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}\n#endif\nfn fresnelSchlickGGXVec3(VdotH: f32,reflectance0: vec3f,reflectance90: vec3f)->vec3f\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\nfn fresnelSchlickGGX(VdotH: f32,reflectance0: f32,reflectance90: f32)->f32\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\n#ifdef CLEARCOAT\nfn getR0RemappedForClearCoat(f0: vec3f)->vec3f {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturateVec3(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturateVec3(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvar s: vec3f=sqrt(f0);var t: vec3f=(uniforms.vClearCoatRefractionParams.z+uniforms.vClearCoatRefractionParams.w*s)/(uniforms.vClearCoatRefractionParams.w+uniforms.vClearCoatRefractionParams.z*s);return squareVec3(t);\n#endif\n}\n#endif\n#ifdef IRIDESCENCE\nconst XYZ_TO_REC709: mat3x3f= mat3x3f(\n3.2404542,-0.9692660, 0.0556434,\n-1.5371385, 1.8760108,-0.2040259,\n-0.4985314, 0.0415560, 1.0572252\n);fn getIORTfromAirToSurfaceR0(f0: vec3f)->vec3f {var sqrtF0: vec3f=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}\nfn getR0fromIORsVec3(iorT: vec3f,iorI: f32)->vec3f {return squareVec3((iorT- vec3f(iorI))/(iorT+ vec3f(iorI)));}\nfn getR0fromIORs(iorT: f32,iorI: f32)->f32 {return square((iorT-iorI)/(iorT+iorI));}\nfn evalSensitivity(opd: f32,shift: vec3f)->vec3f {var phase: f32=2.0*PI*opd*1.0e-9;const val: vec3f= vec3f(5.4856e-13,4.4201e-13,5.2481e-13);const pos: vec3f= vec3f(1.6810e+06,1.7953e+06,2.2084e+06);const vr: vec3f= vec3f(4.3278e+09,9.3046e+09,6.6121e+09);var xyz: vec3f=val*sqrt(2.0*PI*vr)*cos(pos*phase+shift)*exp(-square(phase)*vr);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;var srgb: vec3f=XYZ_TO_REC709*xyz;return srgb;}\nfn evalIridescence(outsideIOR: f32,eta2: f32,cosTheta1: f32,thinFilmThickness: f32,baseF0: vec3f)->vec3f {var I: vec3f= vec3f(1.0);var iridescenceIOR: f32=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));var sinTheta2Sq: f32=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));var cosTheta2Sq: f32=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}\nvar cosTheta2: f32=sqrt(cosTheta2Sq);var R0: f32=getR0fromIORs(iridescenceIOR,outsideIOR);var R12: f32=fresnelSchlickGGX(cosTheta1,R0,1.);var R21: f32=R12;var T121: f32=1.0-R12;var phi12: f32=0.0;if (iridescenceIOR<outsideIOR) {phi12=PI;}\nvar phi21: f32=PI-phi12;var baseIOR: vec3f=getIORTfromAirToSurfaceR0(clamp(baseF0,vec3f(0.0),vec3f(0.9999))); \nvar R1: vec3f=getR0fromIORsVec3(baseIOR,iridescenceIOR);var R23: vec3f=fresnelSchlickGGXVec3(cosTheta2,R1, vec3f(1.));var phi23: vec3f= vec3f(0.0);if (baseIOR[0]<iridescenceIOR) {phi23[0]=PI;}\nif (baseIOR[1]<iridescenceIOR) {phi23[1]=PI;}\nif (baseIOR[2]<iridescenceIOR) {phi23[2]=PI;}\nvar opd: f32=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;var phi: vec3f= vec3f(phi21)+phi23;var R123: vec3f=clamp(R12*R23,vec3f(1e-5),vec3f(0.9999));var r123: vec3f=sqrt(R123);var Rs: vec3f=(T121*T121)*R23/( vec3f(1.0)-R123);var C0: vec3f=R12+Rs;I=C0;var Cm: vec3f=Rs-T121;for (var m: i32=1; m<=2; m++)\n{Cm*=r123;var Sm: vec3f=2.0*evalSensitivity( f32(m)*opd, f32(m)*phi);I+=Cm*Sm;}\nreturn max(I, vec3f(0.0));}\n#endif\nfn normalDistributionFunction_TrowbridgeReitzGGX(NdotH: f32,alphaG: f32)->f32\n{var a2: f32=alphaG*alphaG;var d: f32=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}\n#ifdef SHEEN\nfn normalDistributionFunction_CharlieSheen(NdotH: f32,alphaG: f32)->f32\n{var invR: f32=1./alphaG;var cos2h: f32=NdotH*NdotH;var sin2h: f32=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}\n#endif\n#ifdef ANISOTROPIC\nfn normalDistributionFunction_BurleyGGX_Anisotropic(NdotH: f32,TdotH: f32,BdotH: f32,alphaTB: vec2f)->f32 {var a2: f32=alphaTB.x*alphaTB.y;var v: vec3f= vec3f(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);var v2: f32=dot(v,v);var w2: f32=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}\n#endif\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfn smithVisibility_GGXCorrelated(NdotL: f32,NdotV: f32,alphaG: f32)->f32 {\n#ifdef MOBILE\nvar GGXV: f32=NdotL*(NdotV*(1.0-alphaG)+alphaG);var GGXL: f32=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);\n#else\nvar a2: f32=alphaG*alphaG;var GGXV: f32=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);var GGXL: f32=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);\n#endif\n}\n#else\nfn smithVisibilityG1_TrowbridgeReitzGGXFast(dot: f32,alphaG: f32)->f32\n{\n#ifdef MOBILE\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nvar alphaSquared: f32=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfn smithVisibility_TrowbridgeReitzGGXFast(NdotL: f32,NdotV: f32,alphaG: f32)->f32\n{var visibility: f32=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}\n#endif\n#ifdef ANISOTROPIC\nfn smithVisibility_GGXCorrelated_Anisotropic(NdotL: f32,NdotV: f32,TdotV: f32,BdotV: f32,TdotL: f32,BdotL: f32,alphaTB: vec2f)->f32 {var lambdaV: f32=NdotL*length( vec3f(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));var lambdaL: f32=NdotV*length( vec3f(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));var v: f32=0.5/(lambdaV+lambdaL);return v;}\n#endif\n#ifdef CLEARCOAT\nfn visibility_Kelemen(VdotH: f32)->f32 {return 0.25/(VdotH*VdotH); }\n#endif\n#ifdef SHEEN\nfn visibility_Ashikhmin(NdotL: f32,NdotV: f32)->f32\n{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}\n/* NOT USED\n#ifdef SHEEN_SOFTER\nfn l(x: f32,alphaG: f32)->f32\n{var oneMinusAlphaSq: f32=(1.0-alphaG)*(1.0-alphaG);var a: f32=mix(21.5473,25.3245,oneMinusAlphaSq);var b: f32=mix(3.82987,3.32435,oneMinusAlphaSq);var c: f32=mix(0.19823,0.16801,oneMinusAlphaSq);var d: f32=mix(-1.97760,-1.27393,oneMinusAlphaSq);var e: f32=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}\nfn lambdaSheen(cosTheta: f32,alphaG: f32)->f32\n{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}\nfn visibility_CharlieSheen(NdotL: f32,NdotV: f32,alphaG: f32)->f32\n{var G: f32=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}\n#endif\n*/\n#endif\nconst constant1_FON: f32=0.5f-2.0f/(3.0f*PI);const constant2_FON: f32=2.0f/3.0f-28.0f/(15.0f*PI);fn E_FON_approx(mu: f32,roughness: f32)->f32\n{var sigma: f32=roughness; \nvar mucomp: f32=1.0f-mu;var mucomp2: f32=mucomp*mucomp;const Gcoeffs: mat2x2f=mat2x2f(0.0571085289f,-0.332181442f,\n0.491881867f,0.0714429953f);var GoverPi: f32=dot(Gcoeffs*vec2f(mucomp,mucomp2),vec2f(1.0f,mucomp2));return (1.0f+sigma*GoverPi)/(1.0f+constant1_FON*sigma);}\nfn diffuseBRDF_EON(albedo: vec3f,roughness: f32,NdotL: f32,NdotV: f32,LdotV: f32)->vec3f\n{var rho: vec3f=albedo;var sigma: f32=roughness; \nvar mu_i: f32=NdotL; \nvar mu_o: f32=NdotV; \nvar s: f32=LdotV-mu_i*mu_o; \nvar sovertF: f32=select(s,s/max(mu_i,mu_o),s>0.0f); \nvar AF: f32=1.0f/(1.0f+constant1_FON*sigma); \nvar f_ss: vec3f=(rho*RECIPROCAL_PI)*AF*(1.0f+sigma*sovertF); \nvar EFo: f32=E_FON_approx(mu_o,sigma); \nvar EFi: f32=E_FON_approx(mu_i,sigma); \nvar avgEF: f32=AF*(1.0f+constant2_FON*sigma); \nvar rho_ms: vec3f=(rho*rho)*avgEF/(vec3f(1.0f)-rho*(1.0f-avgEF));const eps: f32=1.0e-7f;var f_ms: vec3f=(rho_ms*RECIPROCAL_PI)*max(eps,1.0f-EFo) \n* max(eps,1.0f-EFi)\n/ max(eps,1.0f-avgEF);return (f_ss+f_ms);}\nfn diffuseBRDF_Burley(NdotL: f32,NdotV: f32,VdotH: f32,roughness: f32)->f32 {var diffuseFresnelNV: f32=pow5(saturateEps(1.0-NdotL));var diffuseFresnelNL: f32=pow5(saturateEps(1.0-NdotV));var diffuseFresnel90: f32=0.5+2.0*VdotH*VdotH*roughness;var fresnel: f32 =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}\n#ifdef SS_TRANSLUCENCY\nfn transmittanceBRDF_Burley(tintColor: vec3f,diffusionDistance: vec3f,thickness: f32)->vec3f {var S: vec3f=1./maxEpsVec3(diffusionDistance);var temp: vec3f=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}\nfn computeWrappedDiffuseNdotL(NdotL: f32,w: f32)->f32 {var t: f32=1.0+w;var invt2: f32=1.0/(t*t);return saturate((NdotL+w)*invt2);}\n#endif\n#endif \n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const pbrBRDFFunctionsWGSL = { name, shader };\n//# sourceMappingURL=pbrBRDFFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"harmonicsFunctions\";\nconst shader = `#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nfn computeEnvironmentIrradiance(normal: vec3f)->vec3f {return uniforms.vSphericalL00\n+ uniforms.vSphericalL1_1*(normal.y)\n+ uniforms.vSphericalL10*(normal.z)\n+ uniforms.vSphericalL11*(normal.x)\n+ uniforms.vSphericalL2_2*(normal.y*normal.x)\n+ uniforms.vSphericalL2_1*(normal.y*normal.z)\n+ uniforms.vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+ uniforms.vSphericalL21*(normal.z*normal.x)\n+ uniforms.vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}\n#else\nfn computeEnvironmentIrradiance(normal: vec3f)->vec3f {var Nx: f32=normal.x;var Ny: f32=normal.y;var Nz: f32=normal.z;var C1: vec3f=uniforms.vSphericalZZ.rgb;var Cx: vec3f=uniforms.vSphericalX.rgb;var Cy: vec3f=uniforms.vSphericalY.rgb;var Cz: vec3f=uniforms.vSphericalZ.rgb;var Cxx_zz: vec3f=uniforms.vSphericalXX_ZZ.rgb;var Cyy_zz: vec3f=uniforms.vSphericalYY_ZZ.rgb;var Cxy: vec3f=uniforms.vSphericalXY.rgb;var Cyz: vec3f=uniforms.vSphericalYZ.rgb;var Czx: vec3f=uniforms.vSphericalZX.rgb;var a1: vec3f=Cyy_zz*Ny+Cy;var a2: vec3f=Cyz*Nz+a1;var b1: vec3f=Czx*Nz+Cx;var b2: vec3f=Cxy*Ny+b1;var b3: vec3f=Cxx_zz*Nx+b2;var t1: vec3f=Cz *Nz+C1;var t2: vec3f=a2 *Ny+t1;var t3: vec3f=b3 *Nx+t2;return t3;}\n#endif\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const harmonicsFunctionsWGSL = { name, shader };\n//# sourceMappingURL=harmonicsFunctions.js.map"],"names":["name","shader","ShaderStore"],"mappings":";;AAIA,MAAMA,IAAO,qBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAMVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;ACVjD,MAAMD,IAAO,oBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2KVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;AC7KjD,MAAMD,IAAO,sBACPC,IAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBVC,EAAY,yBAAyBF,CAAI,MAC1CE,EAAY,yBAAyBF,CAAI,IAAIC;","x_google_ignoreList":[0,1,2]}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { S as e } from "./index-ChGTkj2q.js";
|
|
2
|
+
import "./logDepthDeclaration-Bou5AJOP.js";
|
|
3
|
+
const t = "pbrUboDeclaration", n = `layout(std140,column_major) uniform;uniform Material {vec2 vAlbedoInfos;vec2 vBaseWeightInfos;vec2 vBaseDiffuseRoughnessInfos;vec4 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec3 vReflectivityInfos;vec2 vMicroSurfaceSamplerInfos;vec2 vReflectionInfos;vec2 vReflectionFilteringInfo;vec3 vReflectionPosition;vec3 vReflectionSize;vec3 vBumpInfos;mat4 albedoMatrix;mat4 baseWeightMatrix;mat4 baseDiffuseRoughnessMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 reflectivityMatrix;mat4 microSurfaceSamplerMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;mat4 reflectionMatrix;vec3 vReflectionColor;vec4 vAlbedoColor;float baseWeight;float baseDiffuseRoughness;vec4 vLightingIntensity;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionDominantDirection;float pointSize;vec4 vReflectivityColor;vec3 vEmissiveColor;vec3 vAmbientColor;vec2 vDebugMode;vec4 vMetallicReflectanceFactors;vec2 vMetallicReflectanceInfos;mat4 metallicReflectanceMatrix;vec2 vReflectanceInfos;mat4 reflectanceMatrix;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;vec4 cameraInfo;
|
|
4
|
+
#define ADDITIONAL_UBO_DECLARATION
|
|
5
|
+
};
|
|
6
|
+
#include<sceneUboDeclaration>
|
|
7
|
+
#include<meshUboDeclaration>
|
|
8
|
+
`;
|
|
9
|
+
e.IncludesShadersStore[t] || (e.IncludesShadersStore[t] = n);
|
|
10
|
+
const a = "pbrBRDFFunctions", r = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25
|
|
11
|
+
#define BRDF_DIFFUSE_MODEL_EON 0
|
|
12
|
+
#define BRDF_DIFFUSE_MODEL_BURLEY 1
|
|
13
|
+
#define BRDF_DIFFUSE_MODEL_LAMBERT 2
|
|
14
|
+
#define BRDF_DIFFUSE_MODEL_LEGACY 3
|
|
15
|
+
#define DIELECTRIC_SPECULAR_MODEL_GLTF 0
|
|
16
|
+
#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1
|
|
17
|
+
#define CONDUCTOR_SPECULAR_MODEL_GLTF 0
|
|
18
|
+
#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1
|
|
19
|
+
#ifndef PBR_VERTEX_SHADER
|
|
20
|
+
#ifdef MS_BRDF_ENERGY_CONSERVATION
|
|
21
|
+
vec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}
|
|
22
|
+
#endif
|
|
23
|
+
#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR
|
|
24
|
+
vec3 getF82Specular(float NdotV,vec3 F0,vec3 edgeTint,float roughness) {const float cos_theta_max=0.142857143;
|
|
25
|
+
const float one_minus_cos_theta_max_to_the_fifth=0.462664366;
|
|
26
|
+
const float one_minus_cos_theta_max_to_the_sixth=0.396569457;
|
|
27
|
+
vec3 white_minus_F0=vec3(1.0)-F0;vec3 b_numerator=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3(1.0)-edgeTint);const float b_denominator=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const float b_denominator_reciprocal=1.0/b_denominator;vec3 b=b_numerator*b_denominator_reciprocal;
|
|
28
|
+
float cos_theta=max(roughness,NdotV);float one_minus_cos_theta=1.0-cos_theta;vec3 offset_from_F0=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0);return clamp(F0+offset_from_F0,0.0,1.0);}
|
|
29
|
+
#endif
|
|
30
|
+
#ifdef ENVIRONMENTBRDF
|
|
31
|
+
vec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);
|
|
32
|
+
#ifdef ENVIRONMENTBRDF_RGBD
|
|
33
|
+
brdfLookup.rgb=fromRGBD(brdfLookup.rgba);
|
|
34
|
+
#endif
|
|
35
|
+
return brdfLookup.rgb;}
|
|
36
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {
|
|
37
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
38
|
+
vec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;
|
|
39
|
+
#else
|
|
40
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;
|
|
41
|
+
#endif
|
|
42
|
+
return reflectance;}
|
|
43
|
+
vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {
|
|
44
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
45
|
+
vec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);
|
|
46
|
+
#else
|
|
47
|
+
vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;
|
|
48
|
+
#endif
|
|
49
|
+
return reflectance;}
|
|
50
|
+
#endif
|
|
51
|
+
/* NOT USED
|
|
52
|
+
#if defined(SHEEN) && defined(SHEEN_SOFTER)
|
|
53
|
+
float getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)
|
|
54
|
+
{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}
|
|
55
|
+
#endif
|
|
56
|
+
*/
|
|
57
|
+
#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
|
|
58
|
+
vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)
|
|
59
|
+
{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}
|
|
60
|
+
#endif
|
|
61
|
+
#if defined(SHEEN) && defined(ENVIRONMENTBRDF)
|
|
62
|
+
/**
|
|
63
|
+
* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.
|
|
64
|
+
* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table
|
|
65
|
+
*/
|
|
66
|
+
vec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}
|
|
67
|
+
#endif
|
|
68
|
+
vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)
|
|
69
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
70
|
+
float fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)
|
|
71
|
+
{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}
|
|
72
|
+
#ifdef CLEARCOAT
|
|
73
|
+
vec3 getR0RemappedForClearCoat(vec3 f0) {
|
|
74
|
+
#ifdef CLEARCOAT_DEFAULTIOR
|
|
75
|
+
#ifdef MOBILE
|
|
76
|
+
return saturate(f0*(f0*0.526868+0.529324)-0.0482256);
|
|
77
|
+
#else
|
|
78
|
+
return saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);
|
|
79
|
+
#endif
|
|
80
|
+
#else
|
|
81
|
+
vec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t);
|
|
82
|
+
#endif
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
85
|
+
#ifdef IRIDESCENCE
|
|
86
|
+
const mat3 XYZ_TO_REC709=mat3(
|
|
87
|
+
3.2404542,-0.9692660, 0.0556434,
|
|
88
|
+
-1.5371385, 1.8760108,-0.2040259,
|
|
89
|
+
-0.4985314, 0.0415560, 1.0572252
|
|
90
|
+
);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}
|
|
91
|
+
vec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));}
|
|
92
|
+
float getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));}
|
|
93
|
+
vec3 evalSensitivity(float opd,vec3 shift) {float phase=2.0*PI*opd*1.0e-9;const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);vec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}
|
|
94
|
+
vec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {vec3 I=vec3(1.0);float iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));float sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));float cosTheta2Sq=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}
|
|
95
|
+
float cosTheta2=sqrt(cosTheta2Sq);float R0=getR0fromIORs(iridescenceIOR,outsideIOR);float R12=fresnelSchlickGGX(cosTheta1,R0,1.);float R21=R12;float T121=1.0-R12;float phi12=0.0;if (iridescenceIOR<outsideIOR) phi12=PI;float phi21=PI-phi12;vec3 baseIOR=getIORTfromAirToSurfaceR0(clamp(baseF0,0.0,0.9999));
|
|
96
|
+
vec3 R1=getR0fromIORs(baseIOR,iridescenceIOR);vec3 R23=fresnelSchlickGGX(cosTheta2,R1,vec3(1.));vec3 phi23=vec3(0.0);if (baseIOR[0]<iridescenceIOR) phi23[0]=PI;if (baseIOR[1]<iridescenceIOR) phi23[1]=PI;if (baseIOR[2]<iridescenceIOR) phi23[2]=PI;float opd=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;vec3 phi=vec3(phi21)+phi23;vec3 R123=clamp(R12*R23,1e-5,0.9999);vec3 r123=sqrt(R123);vec3 Rs=square(T121)*R23/(vec3(1.0)-R123);vec3 C0=R12+Rs;I=C0;vec3 Cm=Rs-T121;for (int m=1; m<=2; ++m)
|
|
97
|
+
{Cm*=r123;vec3 Sm=2.0*evalSensitivity(float(m)*opd,float(m)*phi);I+=Cm*Sm;}
|
|
98
|
+
return max(I,vec3(0.0));}
|
|
99
|
+
#endif
|
|
100
|
+
float normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)
|
|
101
|
+
{float a2=square(alphaG);float d=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);}
|
|
102
|
+
#ifdef SHEEN
|
|
103
|
+
float normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)
|
|
104
|
+
{float invR=1./alphaG;float cos2h=NdotH*NdotH;float sin2h=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);}
|
|
105
|
+
#endif
|
|
106
|
+
#ifdef ANISOTROPIC
|
|
107
|
+
float normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {float a2=alphaTB.x*alphaTB.y;vec3 v=vec3(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);float v2=dot(v,v);float w2=a2/v2;return a2*w2*w2*RECIPROCAL_PI;}
|
|
108
|
+
#endif
|
|
109
|
+
#ifdef BRDF_V_HEIGHT_CORRELATED
|
|
110
|
+
float smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {
|
|
111
|
+
#ifdef MOBILE
|
|
112
|
+
float GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);float GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL);
|
|
113
|
+
#else
|
|
114
|
+
float a2=alphaG*alphaG;float GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);float GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL);
|
|
115
|
+
#endif
|
|
116
|
+
}
|
|
117
|
+
#else
|
|
118
|
+
float smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)
|
|
119
|
+
{
|
|
120
|
+
#ifdef MOBILE
|
|
121
|
+
return 1.0/(dot+alphaG+(1.0-alphaG)*dot ));
|
|
122
|
+
#else
|
|
123
|
+
float alphaSquared=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));
|
|
124
|
+
#endif
|
|
125
|
+
}
|
|
126
|
+
float smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)
|
|
127
|
+
{float visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;}
|
|
128
|
+
#endif
|
|
129
|
+
#ifdef ANISOTROPIC
|
|
130
|
+
float smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {float lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));float lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));float v=0.5/(lambdaV+lambdaL);return v;}
|
|
131
|
+
#endif
|
|
132
|
+
#ifdef CLEARCOAT
|
|
133
|
+
float visibility_Kelemen(float VdotH) {return 0.25/(VdotH*VdotH); }
|
|
134
|
+
#endif
|
|
135
|
+
#ifdef SHEEN
|
|
136
|
+
float visibility_Ashikhmin(float NdotL,float NdotV)
|
|
137
|
+
{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));}
|
|
138
|
+
/* NOT USED
|
|
139
|
+
#ifdef SHEEN_SOFTER
|
|
140
|
+
float l(float x,float alphaG)
|
|
141
|
+
{float oneMinusAlphaSq=(1.0-alphaG)*(1.0-alphaG);float a=mix(21.5473,25.3245,oneMinusAlphaSq);float b=mix(3.82987,3.32435,oneMinusAlphaSq);float c=mix(0.19823,0.16801,oneMinusAlphaSq);float d=mix(-1.97760,-1.27393,oneMinusAlphaSq);float e=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;}
|
|
142
|
+
float lambdaSheen(float cosTheta,float alphaG)
|
|
143
|
+
{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));}
|
|
144
|
+
float visibility_CharlieSheen(float NdotL,float NdotV,float alphaG)
|
|
145
|
+
{float G=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);}
|
|
146
|
+
#endif
|
|
147
|
+
*/
|
|
148
|
+
#endif
|
|
149
|
+
float diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {float diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));float diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));float diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;float fresnel =
|
|
150
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *
|
|
151
|
+
(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;}
|
|
152
|
+
const float constant1_FON=0.5-2.0/(3.0*PI);const float constant2_FON=2.0/3.0-28.0/(15.0*PI);float E_FON_approx(float mu,float roughness)
|
|
153
|
+
{float sigma=roughness;
|
|
154
|
+
float mucomp=1.0-mu;float mucomp2=mucomp*mucomp;const mat2 Gcoeffs=mat2(0.0571085289,-0.332181442,
|
|
155
|
+
0.491881867,0.0714429953);float GoverPi=dot(Gcoeffs*vec2(mucomp,mucomp2),vec2(1.0,mucomp2));return (1.0+sigma*GoverPi)/(1.0+constant1_FON*sigma);}
|
|
156
|
+
vec3 diffuseBRDF_EON(vec3 albedo,float roughness,float NdotL,float NdotV,float LdotV)
|
|
157
|
+
{vec3 rho=albedo;float sigma=roughness;
|
|
158
|
+
float mu_i=NdotL;
|
|
159
|
+
float mu_o=NdotV;
|
|
160
|
+
float s=LdotV-mu_i*mu_o;
|
|
161
|
+
float sovertF=s>0.0 ? s/max(mu_i,mu_o) : s;
|
|
162
|
+
float AF=1.0/(1.0+constant1_FON*sigma);
|
|
163
|
+
vec3 f_ss=(rho*RECIPROCAL_PI)*AF*(1.0+sigma*sovertF);
|
|
164
|
+
float EFo=E_FON_approx(mu_o,sigma);
|
|
165
|
+
float EFi=E_FON_approx(mu_i,sigma);
|
|
166
|
+
float avgEF=AF*(1.0+constant2_FON*sigma);
|
|
167
|
+
vec3 rho_ms=(rho*rho)*avgEF/(vec3(1.0)-rho*(1.0-avgEF));const float eps=1.0e-7;vec3 f_ms=(rho_ms*RECIPROCAL_PI)*max(eps,1.0-EFo)
|
|
168
|
+
* max(eps,1.0-EFi)
|
|
169
|
+
/ max(eps,1.0-avgEF);return (f_ss+f_ms);}
|
|
170
|
+
#ifdef SS_TRANSLUCENCY
|
|
171
|
+
vec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {vec3 S=1./maxEps(diffusionDistance);vec3 temp=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);}
|
|
172
|
+
float computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);}
|
|
173
|
+
#endif
|
|
174
|
+
#endif
|
|
175
|
+
`;
|
|
176
|
+
e.IncludesShadersStore[a] || (e.IncludesShadersStore[a] = r);
|
|
177
|
+
const o = "harmonicsFunctions", i = `#ifdef USESPHERICALFROMREFLECTIONMAP
|
|
178
|
+
#ifdef SPHERICAL_HARMONICS
|
|
179
|
+
vec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00
|
|
180
|
+
+ vSphericalL1_1*(normal.y)
|
|
181
|
+
+ vSphericalL10*(normal.z)
|
|
182
|
+
+ vSphericalL11*(normal.x)
|
|
183
|
+
+ vSphericalL2_2*(normal.y*normal.x)
|
|
184
|
+
+ vSphericalL2_1*(normal.y*normal.z)
|
|
185
|
+
+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)
|
|
186
|
+
+ vSphericalL21*(normal.z*normal.x)
|
|
187
|
+
+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}
|
|
188
|
+
#else
|
|
189
|
+
vec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;}
|
|
190
|
+
#endif
|
|
191
|
+
#endif
|
|
192
|
+
`;
|
|
193
|
+
e.IncludesShadersStore[o] || (e.IncludesShadersStore[o] = i);
|
|
194
|
+
//# sourceMappingURL=harmonicsFunctions-D9ZL5yLA.js.map
|