@babylonjs/materials 9.17.1 → 9.18.0
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/cell/wgsl/cell.fragment.js +5 -0
- package/cell/wgsl/cell.fragment.js.map +1 -1
- package/fire/wgsl/fire.fragment.js +5 -0
- package/fire/wgsl/fire.fragment.js.map +1 -1
- package/fur/wgsl/fur.fragment.js +5 -0
- package/fur/wgsl/fur.fragment.js.map +1 -1
- package/gradient/wgsl/gradient.fragment.js +3 -0
- package/gradient/wgsl/gradient.fragment.js.map +1 -1
- package/lava/wgsl/lava.fragment.js +5 -0
- package/lava/wgsl/lava.fragment.js.map +1 -1
- package/mix/wgsl/mix.fragment.js +5 -0
- package/mix/wgsl/mix.fragment.js.map +1 -1
- package/normal/wgsl/normal.fragment.js +5 -0
- package/normal/wgsl/normal.fragment.js.map +1 -1
- package/package.json +2 -2
- package/simple/wgsl/simple.fragment.js +5 -0
- package/simple/wgsl/simple.fragment.js.map +1 -1
- package/terrain/wgsl/terrain.fragment.js +5 -0
- package/terrain/wgsl/terrain.fragment.js.map +1 -1
- package/triPlanar/wgsl/triplanar.fragment.js +3 -0
- package/triPlanar/wgsl/triplanar.fragment.js.map +1 -1
|
@@ -63,9 +63,13 @@ baseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDif
|
|
|
63
63
|
#ifdef ALPHATEST
|
|
64
64
|
if (baseColor.a<0.4) {discard;}
|
|
65
65
|
#endif
|
|
66
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
66
67
|
#include<depthPrePass>
|
|
68
|
+
#ifndef DEPTHPREPASS
|
|
67
69
|
baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
68
70
|
#endif
|
|
71
|
+
#endif
|
|
72
|
+
#ifndef DEPTHPREPASS
|
|
69
73
|
#ifdef VERTEXCOLOR
|
|
70
74
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
71
75
|
#endif
|
|
@@ -88,6 +92,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*ba
|
|
|
88
92
|
fragmentOutputs.color=color;
|
|
89
93
|
#include<imageProcessingCompatibility>
|
|
90
94
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
95
|
+
#endif
|
|
91
96
|
}
|
|
92
97
|
`;
|
|
93
98
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/cell/wgsl/cell.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MA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E,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AACvV,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"cellPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn computeCustomDiffuseLighting(info: lightingInfo,diffuseBaseIn: vec3f,shadow: f32)->vec3f\n{var diffuseBase: vec3f=info.diffuse*shadow;\n#ifdef CELLBASIC\nvar level: f32=1.0;if (info.ndl<0.5) {level=0.5;}\ndiffuseBase=diffuseBase.rgb* vec3f(level,level,level);\n#else\nvar ToonThresholds: array<f32,4>;ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;var ToonBrightnessLevels: array<f32,5>;ToonBrightnessLevels[0]=1.0;ToonBrightnessLevels[1]=0.8;ToonBrightnessLevels[2]=0.6;ToonBrightnessLevels[3]=0.35;ToonBrightnessLevels[4]=0.2;if (info.ndl>ToonThresholds[0])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[3];}\nelse\n{diffuseBase=diffuseBase.rgb*ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase, vec3f(0.2));}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar info: lightingInfo;var diffuseBase: vec3f= vec3f(0.,0.,0.);var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const cellPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -36,9 +36,13 @@ let distortionAmount0: f32=0.092;let distortionAmount1: f32=0.092;let distortion
|
|
|
36
36
|
#ifdef ALPHATEST
|
|
37
37
|
if (opacityColor.r<0.1) {discard;}
|
|
38
38
|
#endif
|
|
39
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
39
40
|
#include<depthPrePass>
|
|
41
|
+
#ifndef DEPTHPREPASS
|
|
40
42
|
baseColor=textureSample(diffuseSampler,diffuseSamplerSampler,perturbedBaseCoords.xy)*2.0;baseColor=baseColor*opacityColor;baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
41
43
|
#endif
|
|
44
|
+
#endif
|
|
45
|
+
#ifndef DEPTHPREPASS
|
|
42
46
|
#ifdef VERTEXCOLOR
|
|
43
47
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
44
48
|
#endif
|
|
@@ -52,6 +56,7 @@ var color: vec4f= vec4f(baseColor.rgb,alpha);
|
|
|
52
56
|
fragmentOutputs.color=color;
|
|
53
57
|
#include<imageProcessingCompatibility>
|
|
54
58
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
59
|
+
#endif
|
|
55
60
|
}
|
|
56
61
|
`;
|
|
57
62
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fire.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/fire/wgsl/fire.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"fire.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/fire/wgsl/fire.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,gCAAgC,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AAC3N,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"firePixelShader\";\nconst shader = `uniform vEyePosition: vec4f;varying vPositionW: vec3f;\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\nvar distortionSamplerSampler: sampler;var distortionSampler: texture_2d<f32>;var opacitySamplerSampler: sampler;var opacitySampler: texture_2d<f32>;\n#ifdef DIFFUSE\nvarying vDistortionCoords1: vec2f;varying vDistortionCoords2: vec2f;varying vDistortionCoords3: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn bx2(x: vec4f)->vec4f\n{return vec4f(2.0)*x- vec4f(1.0);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var alpha: f32=1.0;\n#ifdef DIFFUSE\nlet distortionAmount0: f32=0.092;let distortionAmount1: f32=0.092;let distortionAmount2: f32=0.092;var heightAttenuation: vec2f= vec2f(0.3,0.39);var noise0: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords1);var noise1: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords2);var noise2: vec4f=textureSample(distortionSampler,distortionSamplerSampler,fragmentInputs.vDistortionCoords3);var noiseSum: vec4f=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;var perturbedBaseCoords: vec4f= vec4f(fragmentInputs.vDiffuseUV,0.0,1.0)+noiseSum*(fragmentInputs.vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);var opacityColor: vec4f=textureSample(opacitySampler,opacitySamplerSampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,perturbedBaseCoords.xy)*2.0;baseColor=baseColor*opacityColor;baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar color: vec4f= vec4f(baseColor.rgb,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const firePixelShaderWGSL = { name, shader };\n"]}
|
package/fur/wgsl/fur.fragment.js
CHANGED
|
@@ -49,9 +49,13 @@ baseColor=baseColor*textureSample(diffuseSampler,diffuseSamplerSampler,fragmentI
|
|
|
49
49
|
#ifdef ALPHATEST
|
|
50
50
|
if (baseColor.a<0.4) {discard;}
|
|
51
51
|
#endif
|
|
52
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
52
53
|
#include<depthPrePass>
|
|
54
|
+
#ifndef DEPTHPREPASS
|
|
53
55
|
baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
54
56
|
#endif
|
|
57
|
+
#endif
|
|
58
|
+
#ifndef DEPTHPREPASS
|
|
55
59
|
#ifdef VERTEXCOLOR
|
|
56
60
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
57
61
|
#endif
|
|
@@ -83,6 +87,7 @@ var rr: f32=fragmentInputs.vfur_length/uniforms.furLength*0.5;var color: vec4f=
|
|
|
83
87
|
fragmentOutputs.color=color;
|
|
84
88
|
#include<imageProcessingCompatibility>
|
|
85
89
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
90
|
+
#endif
|
|
86
91
|
}
|
|
87
92
|
`;
|
|
88
93
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fur.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/fur/wgsl/fur.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MA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nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"furPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;uniform furColor: vec4f;uniform furLength: f32;varying vPositionW: vec3f;varying vfur_length: f32;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#ifdef HIGHLEVEL\nuniform furOffset: f32;uniform furOcclusion: f32;var furTextureSampler: sampler;var furTexture: texture_2d<f32>;varying vFurUV: vec2f;\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfn Rand(rv: vec3f)->f32 {var x: f32=dot(rv, vec3f(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f=uniforms.furColor;var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=baseColor*textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\nvar furTextureColor: vec4f=textureSample(furTexture,furTextureSampler, vec2f(fragmentInputs.vFurUV.x,fragmentInputs.vFurUV.y));if (furTextureColor.a<=0.0 || furTextureColor.g<uniforms.furOffset) {discard;}\nvar occlusion: f32=mix(0.0,furTextureColor.b*1.2,uniforms.furOffset);baseColor= vec4f(baseColor.xyz*max(occlusion,uniforms.furOcclusion),1.1-uniforms.furOffset);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase.rgb*baseColor.rgb,vec3f(0.0),vec3f(1.0));\n#ifdef HIGHLEVEL\nvar color: vec4f= vec4f(finalDiffuse,alpha);\n#else\nvar rr: f32=fragmentInputs.vfur_length/uniforms.furLength*0.5;var color: vec4f= vec4f(finalDiffuse*(0.5+rr),alpha);\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, logDepthDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const furPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -43,7 +43,9 @@ var viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPo
|
|
|
43
43
|
#ifdef ALPHATEST
|
|
44
44
|
if (baseColor.a<0.4) {discard;}
|
|
45
45
|
#endif
|
|
46
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
46
47
|
#include<depthPrePass>
|
|
48
|
+
#ifndef DEPTHPREPASS
|
|
47
49
|
#ifdef VERTEXCOLOR
|
|
48
50
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
49
51
|
#endif
|
|
@@ -68,6 +70,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*ba
|
|
|
68
70
|
fragmentOutputs.color=color;
|
|
69
71
|
#include<imageProcessingCompatibility>
|
|
70
72
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
73
|
+
#endif
|
|
71
74
|
}
|
|
72
75
|
`;
|
|
73
76
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/gradient/wgsl/gradient.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAm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C;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Dd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,mBAAmB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AACvV,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"gradientPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform topColor: vec4f;uniform bottomColor: vec4f;uniform offset: f32;uniform scale: f32;uniform smoothness: f32;varying vPositionW: vec3f;varying vPosition: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var h: f32=fragmentInputs.vPosition.y*uniforms.scale+uniforms.offset;var mysmoothness: f32=clamp(uniforms.smoothness,0.01,max(uniforms.smoothness,10.));var baseColor: vec4f=mix(uniforms.bottomColor,uniforms.topColor,vec4f(max(pow(max(h,0.0),mysmoothness),0.0)));var diffuseColor: vec3f=baseColor.rgb;var alpha: f32=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef EMISSIVE\nvar diffuseBase: vec3f=baseColor.rgb;\n#else\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);\n#endif\nvar info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const gradientPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -49,9 +49,13 @@ var noiseTex: vec4f=textureSample(noiseTexture,noiseTextureSampler,fragmentInput
|
|
|
49
49
|
#ifdef ALPHATEST
|
|
50
50
|
if (baseColor.a<0.4) {discard;}
|
|
51
51
|
#endif
|
|
52
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
52
53
|
#include<depthPrePass>
|
|
54
|
+
#ifndef DEPTHPREPASS
|
|
53
55
|
baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
54
56
|
#endif
|
|
57
|
+
#endif
|
|
58
|
+
#ifndef DEPTHPREPASS
|
|
55
59
|
#ifdef VERTEXCOLOR
|
|
56
60
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
57
61
|
#endif
|
|
@@ -78,6 +82,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*ba
|
|
|
78
82
|
fragmentOutputs.color=color;
|
|
79
83
|
#include<imageProcessingCompatibility>
|
|
80
84
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
85
|
+
#endif
|
|
81
86
|
}
|
|
82
87
|
`;
|
|
83
88
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lava.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/lava/wgsl/lava.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OA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C1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,mBAAmB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AACvV,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"lavaPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;uniform time: f32;uniform speed: f32;uniform movingSpeed: f32;uniform fogColor: vec3f;var noiseTextureSampler: sampler;var noiseTexture: texture_2d<f32>;uniform fogDensity: f32;varying noise: f32;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nfn random(scale: vec3f,seed: f32)->f32 {return fract(sin(dot(fragmentInputs.position.xyz+seed,scale))*43758.5453+seed);}\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nvar noiseTex: vec4f=textureSample(noiseTexture,noiseTextureSampler,fragmentInputs.vDiffuseUV);var T1: vec2f=fragmentInputs.vDiffuseUV+ vec2f(1.5,-1.5)*uniforms.time*0.02;var T2: vec2f=fragmentInputs.vDiffuseUV+ vec2f(-0.5,2.0)*uniforms.time*0.01*uniforms.speed;T1=vec2f(T1.x+noiseTex.x*2.0,T1.y+noiseTex.y*2.0);T2=vec2f(T2.x-noiseTex.y*0.2-uniforms.time*0.001*uniforms.movingSpeed,T2.y+noiseTex.z*0.2+uniforms.time*0.002*uniforms.movingSpeed);var p: f32=textureSample(noiseTexture,noiseTextureSampler,T1*3.0).a;var lavaColor: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,T2*4.0);var temp: vec4f=lavaColor*( vec4f(p,p,p,p)*2.)+(lavaColor*lavaColor-0.1);baseColor=temp;var depth: f32=fragmentInputs.position.z*4.0;let LOG2: f32=1.442695;var fogFactor: f32=exp2(-uniforms.fogDensity*uniforms.fogDensity*depth*depth*LOG2);fogFactor=1.0-clamp(fogFactor,0.0,1.0);baseColor=mix(baseColor, vec4f(uniforms.fogColor,baseColor.w), vec4f(fogFactor));diffuseColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#ifdef VERTEXCOLOR\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvar diffuseBase: vec3f= vec3f(1.,1.,1.);\n#else\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const lavaPixelShaderWGSL = { name, shader };\n"]}
|
package/mix/wgsl/mix.fragment.js
CHANGED
|
@@ -67,12 +67,16 @@ var normalW: vec3f= vec3f(1.0,1.0,1.0);
|
|
|
67
67
|
#endif
|
|
68
68
|
#ifdef DIFFUSE
|
|
69
69
|
var mixColor: vec4f=textureSample(mixMap1Sampler,mixMap1SamplerSampler,fragmentInputs.vTextureUV);
|
|
70
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
70
71
|
#include<depthPrePass>
|
|
72
|
+
#ifndef DEPTHPREPASS
|
|
71
73
|
mixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);var diffuse4Color: vec4f=textureSample(diffuse4Sampler,diffuse4SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse4Infos);diffuse1Color=vec4f(diffuse1Color.rgb*mixColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(mixColor.g)),diffuse2Color.a);diffuse3Color=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(mixColor.b)),diffuse3Color.a);finalMixColor=vec4f(mix(diffuse3Color.rgb,diffuse4Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);
|
|
72
74
|
#ifdef MIXMAP2
|
|
73
75
|
mixColor=textureSample(mixMap2Sampler,mixMap2SamplerSampler,fragmentInputs.vTextureUV);mixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse5Color: vec4f=textureSample(diffuse5Sampler,diffuse5SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse5Infos);var diffuse6Color: vec4f=textureSample(diffuse6Sampler,diffuse6SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse6Infos);var diffuse7Color: vec4f=textureSample(diffuse7Sampler,diffuse7SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse7Infos);var diffuse8Color: vec4f=textureSample(diffuse8Sampler,diffuse8SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse8Infos);diffuse5Color=vec4f(mix(finalMixColor.rgb,diffuse5Color.rgb,vec3f(mixColor.r)),diffuse5Color.a);diffuse6Color=vec4f(mix(diffuse5Color.rgb,diffuse6Color.rgb,vec3f(mixColor.g)),diffuse6Color.a);diffuse7Color=vec4f(mix(diffuse6Color.rgb,diffuse7Color.rgb,vec3f(mixColor.b)),diffuse7Color.a);finalMixColor=vec4f(mix(diffuse7Color.rgb,diffuse8Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);
|
|
74
76
|
#endif
|
|
75
77
|
#endif
|
|
78
|
+
#endif
|
|
79
|
+
#ifndef DEPTHPREPASS
|
|
76
80
|
#ifdef VERTEXCOLOR
|
|
77
81
|
finalMixColor=vec4f(finalMixColor.rgb*fragmentInputs.vColor.rgb,finalMixColor.a);
|
|
78
82
|
#endif
|
|
@@ -95,6 +99,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,vec3f(0
|
|
|
95
99
|
fragmentOutputs.color=color;
|
|
96
100
|
#include<imageProcessingCompatibility>
|
|
97
101
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
102
|
+
#endif
|
|
98
103
|
}
|
|
99
104
|
`;
|
|
100
105
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mix.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/mix/wgsl/mix.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"mix.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/mix/wgsl/mix.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EA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WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"mixPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var mixMap1SamplerSampler: sampler;var mixMap1Sampler: texture_2d<f32>;uniform vTextureInfos: vec2f;\n#ifdef MIXMAP2\nvar mixMap2SamplerSampler: sampler;var mixMap2Sampler: texture_2d<f32>;\n#endif\nvar diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;var diffuse4SamplerSampler: sampler;var diffuse4Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;uniform diffuse4Infos: vec2f;\n#ifdef MIXMAP2\nvar diffuse5SamplerSampler: sampler;var diffuse5Sampler: texture_2d<f32>;var diffuse6SamplerSampler: sampler;var diffuse6Sampler: texture_2d<f32>;var diffuse7SamplerSampler: sampler;var diffuse7Sampler: texture_2d<f32>;var diffuse8SamplerSampler: sampler;var diffuse8Sampler: texture_2d<f32>;uniform diffuse5Infos: vec2f;uniform diffuse6Infos: vec2f;uniform diffuse7Infos: vec2f;uniform diffuse8Infos: vec2f;\n#endif\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var finalMixColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvar mixColor2: vec4f= vec4f(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvar mixColor: vec4f=textureSample(mixMap1Sampler,mixMap1SamplerSampler,fragmentInputs.vTextureUV);\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nmixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);var diffuse4Color: vec4f=textureSample(diffuse4Sampler,diffuse4SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse4Infos);diffuse1Color=vec4f(diffuse1Color.rgb*mixColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(mixColor.g)),diffuse2Color.a);diffuse3Color=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(mixColor.b)),diffuse3Color.a);finalMixColor=vec4f(mix(diffuse3Color.rgb,diffuse4Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);\n#ifdef MIXMAP2\nmixColor=textureSample(mixMap2Sampler,mixMap2SamplerSampler,fragmentInputs.vTextureUV);mixColor=vec4f(mixColor.rgb*uniforms.vTextureInfos.y,mixColor.a);var diffuse5Color: vec4f=textureSample(diffuse5Sampler,diffuse5SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse5Infos);var diffuse6Color: vec4f=textureSample(diffuse6Sampler,diffuse6SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse6Infos);var diffuse7Color: vec4f=textureSample(diffuse7Sampler,diffuse7SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse7Infos);var diffuse8Color: vec4f=textureSample(diffuse8Sampler,diffuse8SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse8Infos);diffuse5Color=vec4f(mix(finalMixColor.rgb,diffuse5Color.rgb,vec3f(mixColor.r)),diffuse5Color.a);diffuse6Color=vec4f(mix(diffuse5Color.rgb,diffuse6Color.rgb,vec3f(mixColor.g)),diffuse6Color.a);diffuse7Color=vec4f(mix(diffuse6Color.rgb,diffuse7Color.rgb,vec3f(mixColor.b)),diffuse7Color.a);finalMixColor=vec4f(mix(diffuse7Color.rgb,diffuse8Color.rgb,vec3f(1.0-mixColor.a)),finalMixColor.a);\n#endif\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#ifdef VERTEXCOLOR\nfinalMixColor=vec4f(finalMixColor.rgb*fragmentInputs.vColor.rgb,finalMixColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const mixPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -47,9 +47,13 @@ baseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDif
|
|
|
47
47
|
#ifdef ALPHATEST
|
|
48
48
|
if (baseColor.a<0.4) {discard;}
|
|
49
49
|
#endif
|
|
50
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
50
51
|
#include<depthPrePass>
|
|
52
|
+
#ifndef DEPTHPREPASS
|
|
51
53
|
baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
52
54
|
#endif
|
|
55
|
+
#endif
|
|
56
|
+
#ifndef DEPTHPREPASS
|
|
53
57
|
#ifdef NORMAL
|
|
54
58
|
baseColor=mix(baseColor, vec4f(fragmentInputs.vNormalW,1.0),0.5);
|
|
55
59
|
#endif
|
|
@@ -74,6 +78,7 @@ var color: vec4f= vec4f(finalDiffuse,alpha);
|
|
|
74
78
|
fragmentOutputs.color=color;
|
|
75
79
|
#include<imageProcessingCompatibility>
|
|
76
80
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
81
|
+
#endif
|
|
77
82
|
}
|
|
78
83
|
`;
|
|
79
84
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normal.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/normal/wgsl/normal.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAEhH,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"normal.fragment.js","sourceRoot":"","sources":["../../../../../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AAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AACvV,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"normalPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<lightUboDeclaration>[0]\n#include<lightUboDeclaration>[1]\n#include<lightUboDeclaration>[2]\n#include<lightUboDeclaration>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#ifdef NORMAL\nbaseColor=mix(baseColor, vec4f(fragmentInputs.vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;\n#else\nvar finalDiffuse: vec3f= baseColor.rgb;\n#endif\nvar color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const normalPixelShaderWGSL = { name, shader };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/materials",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babylonjs/core": "9.
|
|
21
|
+
"@babylonjs/core": "9.18.0",
|
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
|
23
23
|
"@dev/materials": "^1.0.0"
|
|
24
24
|
},
|
|
@@ -45,9 +45,13 @@ baseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDif
|
|
|
45
45
|
#ifdef ALPHATEST
|
|
46
46
|
if (baseColor.a<0.4) {discard;}
|
|
47
47
|
#endif
|
|
48
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
48
49
|
#include<depthPrePass>
|
|
50
|
+
#ifndef DEPTHPREPASS
|
|
49
51
|
baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
50
52
|
#endif
|
|
53
|
+
#endif
|
|
54
|
+
#ifndef DEPTHPREPASS
|
|
51
55
|
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
52
56
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
53
57
|
#endif
|
|
@@ -70,6 +74,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*ba
|
|
|
70
74
|
fragmentOutputs.color=color;
|
|
71
75
|
#include<imageProcessingCompatibility>
|
|
72
76
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
77
|
+
#endif
|
|
73
78
|
}
|
|
74
79
|
`;
|
|
75
80
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/simple/wgsl/simple.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;A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esContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"simplePixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;varying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#ifdef VERTEXCOLOR\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vDiffuseUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;uniform vDiffuseInfos: vec2f;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var glossiness: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const simplePixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -72,9 +72,13 @@ normalW=perturbNormal(viewDirectionW,baseColor.rgb);
|
|
|
72
72
|
#ifdef ALPHATEST
|
|
73
73
|
if (baseColor.a<0.4) {discard;}
|
|
74
74
|
#endif
|
|
75
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
75
76
|
#include<depthPrePass>
|
|
77
|
+
#ifndef DEPTHPREPASS
|
|
76
78
|
baseColor=vec4f(baseColor.rgb*uniforms.vTextureInfos.y,baseColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);diffuse1Color=vec4f(diffuse1Color.rgb*baseColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(baseColor.g)),diffuse2Color.a);baseColor=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(baseColor.b)),baseColor.a);
|
|
77
79
|
#endif
|
|
80
|
+
#endif
|
|
81
|
+
#ifndef DEPTHPREPASS
|
|
78
82
|
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
79
83
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
80
84
|
#endif
|
|
@@ -97,6 +101,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*baseColor.rgb,vec3f(0.0),
|
|
|
97
101
|
fragmentOutputs.color=color;
|
|
98
102
|
#include<imageProcessingCompatibility>
|
|
99
103
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
104
|
+
#endif
|
|
100
105
|
}
|
|
101
106
|
`;
|
|
102
107
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terrain.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/terrain/wgsl/terrain.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE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AM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,mBAAmB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AACvV,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"terrainPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#ifdef NORMAL\nvarying vNormalW: vec3f;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vTextureUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>;uniform vTextureInfos: vec2f;var diffuse1SamplerSampler: sampler;var diffuse1Sampler: texture_2d<f32>;var diffuse2SamplerSampler: sampler;var diffuse2Sampler: texture_2d<f32>;var diffuse3SamplerSampler: sampler;var diffuse3Sampler: texture_2d<f32>;uniform diffuse1Infos: vec2f;uniform diffuse2Infos: vec2f;uniform diffuse3Infos: vec2f;\n#endif\n#ifdef BUMP\nvar bump1SamplerSampler: sampler;var bump1Sampler: texture_2d<f32>;var bump2SamplerSampler: sampler;var bump2Sampler: texture_2d<f32>;var bump3SamplerSampler: sampler;var bump3Sampler: texture_2d<f32>;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\nfn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f)->mat3x3f\n{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var binormal: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;var invmax: f32=inverseSqrt(max(dot(tangent,tangent),dot(binormal,binormal)));return mat3x3f(tangent*invmax,binormal*invmax,normal);}\nfn perturbNormal(viewDir: vec3f,mixColor: vec3f)->vec3f\n{var bump1Color: vec3f=textureSample(bump1Sampler,bump1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos).xyz;var bump2Color: vec3f=textureSample(bump2Sampler,bump2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos).xyz;var bump3Color: vec3f=textureSample(bump3Sampler,bump3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos).xyz;bump1Color=bump1Color.rgb*mixColor.r;bump2Color=mix(bump1Color.rgb,bump2Color.rgb,vec3f(mixColor.g));var map: vec3f=mix(bump2Color.rgb,bump3Color.rgb,vec3f(mixColor.b));map=map*255./127.-128./127.;var TBN: mat3x3f=cotangent_frame(fragmentInputs.vNormalW*uniforms.vTextureInfos.y,-viewDir,fragmentInputs.vTextureUV);return normalize(TBN*map);}\n#endif\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\nvar alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=normalize(fragmentInputs.vNormalW);\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vTextureInfos.y,baseColor.a);var diffuse1Color: vec4f=textureSample(diffuse1Sampler,diffuse1SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse1Infos);var diffuse2Color: vec4f=textureSample(diffuse2Sampler,diffuse2SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse2Infos);var diffuse3Color: vec4f=textureSample(diffuse3Sampler,diffuse3SamplerSampler,fragmentInputs.vTextureUV*uniforms.diffuse3Infos);diffuse1Color=vec4f(diffuse1Color.rgb*baseColor.r,diffuse1Color.a);diffuse2Color=vec4f(mix(diffuse1Color.rgb,diffuse2Color.rgb,vec3f(baseColor.g)),diffuse2Color.a);baseColor=vec4f(mix(diffuse2Color.rgb,diffuse3Color.rgb,vec3f(baseColor.b)),baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar specularBase: vec3f= vec3f(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor*baseColor.rgb,vec3f(0.0),vec3f(1.0));var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, logDepthDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const terrainPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -89,7 +89,9 @@ var tangentSpace: mat3x3f=mat3x3f(fragmentInputs.tangentSpace0,fragmentInputs.ta
|
|
|
89
89
|
#ifdef ALPHATEST
|
|
90
90
|
if (baseColor.a<0.4) {discard;}
|
|
91
91
|
#endif
|
|
92
|
+
#define DEPTHPREPASS_SKIP_EARLY_RETURN
|
|
92
93
|
#include<depthPrePass>
|
|
94
|
+
#ifndef DEPTHPREPASS
|
|
93
95
|
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
94
96
|
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
95
97
|
#endif
|
|
@@ -114,6 +116,7 @@ var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*ba
|
|
|
114
116
|
fragmentOutputs.color=color;
|
|
115
117
|
#include<imageProcessingCompatibility>
|
|
116
118
|
#define CUSTOM_FRAGMENT_MAIN_END
|
|
119
|
+
#endif
|
|
117
120
|
}
|
|
118
121
|
`;
|
|
119
122
|
// Sideeffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triplanar.fragment.js","sourceRoot":"","sources":["../../../../../dev/materials/src/triPlanar/wgsl/triplanar.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8DAA8D,CAAC;AAChH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,mBAAmB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,EAAE,gCAAgC,CAAC,CAAC;AACvV,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport { helperFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/helperFunctions\";\nimport { lightUboDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/lightUboDeclaration\";\nimport { logDepthDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthDeclaration\";\nimport { lightsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\nimport { shadowsFragmentFunctionsWGSL } from \"core/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { fogFragmentDeclarationWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/clipPlaneFragment\";\nimport { depthPrePassWGSL } from \"core/ShadersWGSL/ShadersInclude/depthPrePass\";\nimport { lightFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/lightFragment\";\nimport { logDepthFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"core/ShadersWGSL/ShadersInclude/fogFragment\";\nimport { imageProcessingCompatibilityWGSL } from \"core/ShadersWGSL/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"triplanarPixelShader\";\nconst shader = `uniform vEyePosition: vec4f;uniform vDiffuseColor: vec4f;\n#ifdef SPECULARTERM\nuniform vSpecularColor: vec4f;\n#endif\nvarying vPositionW: vec3f;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vColor: vec4f;\n#endif\n#include<helperFunctions>\n#include<lightUboDeclaration>[0..maxSimultaneousLights]\n#ifdef DIFFUSEX\nvarying vTextureUVX: vec2f;var diffuseSamplerXSampler: sampler;var diffuseSamplerX: texture_2d<f32>;\n#ifdef BUMPX\nvar normalSamplerXSampler: sampler;var normalSamplerX: texture_2d<f32>;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vTextureUVY: vec2f;var diffuseSamplerYSampler: sampler;var diffuseSamplerY: texture_2d<f32>;\n#ifdef BUMPY\nvar normalSamplerYSampler: sampler;var normalSamplerY: texture_2d<f32>;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vTextureUVZ: vec2f;var diffuseSamplerZSampler: sampler;var diffuseSamplerZ: texture_2d<f32>;\n#ifdef BUMPZ\nvar normalSamplerZSampler: sampler;var normalSamplerZ: texture_2d<f32>;\n#endif\n#endif\n#ifdef NORMAL\nvarying tangentSpace0: vec3f;varying tangentSpace1: vec3f;varying tangentSpace2: vec3f;\n#endif\n#include<logDepthDeclaration>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0\nvarying vViewDepth: f32;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvar viewDirectionW: vec3f=normalize(uniforms.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(0.,0.,0.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;\n#ifdef NORMAL\nvar normalW: vec3f=fragmentInputs.tangentSpace2;\n#else\nvar normalW: vec3f= vec3f(1.0,1.0,1.0);\n#endif\nvar baseNormal: vec4f= vec4f(0.0,0.0,0.0,1.0);normalW=normalW*normalW;\n#ifdef DIFFUSEX\nbaseColor=baseColor+textureSample(diffuseSamplerX,diffuseSamplerXSampler,fragmentInputs.vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal=baseNormal+textureSample(normalSamplerX,normalSamplerXSampler,fragmentInputs.vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor=baseColor+textureSample(diffuseSamplerY,diffuseSamplerYSampler,fragmentInputs.vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal=baseNormal+textureSample(normalSamplerY,normalSamplerYSampler,fragmentInputs.vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor=baseColor+textureSample(diffuseSamplerZ,diffuseSamplerZSampler,fragmentInputs.vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal=baseNormal+textureSample(normalSamplerZ,normalSamplerZSampler,fragmentInputs.vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nvar tangentSpace: mat3x3f=mat3x3f(fragmentInputs.tangentSpace0,fragmentInputs.tangentSpace1,fragmentInputs.tangentSpace2);normalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4) {discard;}\n#endif\n#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);\n#endif\nvar diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;\n#ifdef SPECULARTERM\nvar glossiness: f32=uniforms.vSpecularColor.a;var specularBase: vec3f= vec3f(0.,0.,0.);var specularColor: vec3f=uniforms.vSpecularColor.rgb;\n#else\nvar glossiness: f32=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=fragmentInputs.vColor.a;\n#endif\n#ifdef SPECULARTERM\nvar finalSpecular: vec3f=specularBase*specularColor;\n#else\nvar finalSpecular: vec3f= vec3f(0.0);\n#endif\nvar finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;var color: vec4f= vec4f(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\nfragmentOutputs.color=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [helperFunctionsWGSL, lightUboDeclarationWGSL, logDepthDeclarationWGSL, lightsFragmentFunctionsWGSL, shadowsFragmentFunctionsWGSL, clipPlaneFragmentDeclarationWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, depthPrePassWGSL, lightFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL, imageProcessingCompatibilityWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const triplanarPixelShaderWGSL = { name, shader };\n"]}
|