@babylonjs/materials 6.15.0 → 6.16.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/cell.fragment.js +8 -5
- package/cell/cell.fragment.js.map +1 -1
- package/cell/cell.vertex.js +41 -19
- package/cell/cell.vertex.js.map +1 -1
- package/gradient/gradient.fragment.js +33 -16
- package/gradient/gradient.fragment.js.map +1 -1
- package/gradient/gradient.vertex.js +34 -17
- package/gradient/gradient.vertex.js.map +1 -1
- package/grid/grid.fragment.js +2 -3
- package/grid/grid.fragment.js.map +1 -1
- package/grid/grid.vertex.js +27 -12
- package/grid/grid.vertex.js.map +1 -1
- package/mix/mix.fragment.js +34 -19
- package/mix/mix.fragment.js.map +1 -1
- package/normal/normal.fragment.js +33 -16
- package/normal/normal.fragment.js.map +1 -1
- package/normal/normal.vertex.js +39 -18
- package/normal/normal.vertex.js.map +1 -1
- package/package.json +2 -2
- package/shadowOnly/shadowOnly.fragment.js +18 -9
- package/shadowOnly/shadowOnly.fragment.js.map +1 -1
- package/shadowOnly/shadowOnly.vertex.js +24 -12
- package/shadowOnly/shadowOnly.vertex.js.map +1 -1
- package/simple/simple.fragment.js +35 -17
- package/simple/simple.fragment.js.map +1 -1
- package/simple/simple.vertex.js +41 -19
- package/simple/simple.vertex.js.map +1 -1
- package/sky/sky.fragment.js +50 -12
- package/sky/sky.fragment.js.map +1 -1
- package/sky/sky.vertex.js +22 -11
- package/sky/sky.vertex.js.map +1 -1
- package/terrain/terrain.fragment.js +40 -19
- package/terrain/terrain.fragment.js.map +1 -1
- package/triPlanar/triplanar.fragment.js +69 -34
- package/triPlanar/triplanar.fragment.js.map +1 -1
- package/triPlanar/triplanar.vertex.js +45 -22
- package/triPlanar/triplanar.vertex.js.map +1 -1
- package/water/water.fragment.js +106 -51
- package/water/water.fragment.js.map +1 -1
- package/water/water.vertex.js +71 -33
- package/water/water.vertex.js.map +1 -1
@@ -13,8 +13,10 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
|
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
|
14
14
|
import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
|
15
15
|
const name = "normalPixelShader";
|
16
|
-
const shader = `precision highp float;
|
17
|
-
|
16
|
+
const shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;
|
17
|
+
#ifdef NORMAL
|
18
|
+
varying vec3 vNormalW;
|
19
|
+
#endif
|
18
20
|
#ifdef LIGHTING
|
19
21
|
#include<helperFunctions>
|
20
22
|
#include<__decl__lightFragment>[0]
|
@@ -25,31 +27,46 @@ varying vec3 vNormalW;
|
|
25
27
|
#include<shadowsFragmentFunctions>
|
26
28
|
#endif
|
27
29
|
#ifdef DIFFUSE
|
28
|
-
varying vec2 vDiffuseUV;
|
30
|
+
varying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;
|
31
|
+
#endif
|
29
32
|
#include<clipPlaneFragmentDeclaration>
|
30
33
|
#include<fogFragmentDeclaration>
|
31
34
|
#define CUSTOM_FRAGMENT_DEFINITIONS
|
32
|
-
void main(void) {
|
35
|
+
void main(void) {
|
36
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
33
37
|
#include<clipPlaneFragment>
|
34
|
-
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
|
35
|
-
|
36
|
-
|
38
|
+
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;
|
39
|
+
#ifdef DIFFUSE
|
40
|
+
baseColor=texture2D(diffuseSampler,vDiffuseUV);
|
41
|
+
#ifdef ALPHATEST
|
42
|
+
if (baseColor.a<0.4)
|
43
|
+
discard;
|
44
|
+
#endif
|
37
45
|
#include<depthPrePass>
|
38
|
-
baseColor.rgb*=vDiffuseInfos.y;
|
46
|
+
baseColor.rgb*=vDiffuseInfos.y;
|
47
|
+
#endif
|
39
48
|
#ifdef NORMAL
|
40
|
-
baseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);
|
49
|
+
baseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);
|
50
|
+
#endif
|
41
51
|
#ifdef NORMAL
|
42
|
-
vec3 normalW=normalize(vNormalW);
|
43
|
-
|
52
|
+
vec3 normalW=normalize(vNormalW);
|
53
|
+
#else
|
54
|
+
vec3 normalW=vec3(1.0,1.0,1.0);
|
55
|
+
#endif
|
44
56
|
#ifdef LIGHTING
|
45
|
-
vec3 diffuseBase=vec3(0.,0.,0.);
|
57
|
+
vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;
|
58
|
+
#include<lightFragment>[0]
|
46
59
|
#include<lightFragment>[1]
|
47
60
|
#include<lightFragment>[2]
|
48
61
|
#include<lightFragment>[3]
|
49
|
-
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
|
50
|
-
|
51
|
-
|
52
|
-
|
62
|
+
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
|
63
|
+
#else
|
64
|
+
vec3 finalDiffuse= baseColor.rgb;
|
65
|
+
#endif
|
66
|
+
vec4 color=vec4(finalDiffuse,alpha);
|
67
|
+
#include<fogFragment>
|
68
|
+
gl_FragColor=color;
|
69
|
+
#include<imageProcessingCompatibility>
|
53
70
|
#define CUSTOM_FRAGMENT_MAIN_END
|
54
71
|
}`;
|
55
72
|
// Sideeffect
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"normal.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normal.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG
|
1
|
+
{"version":3,"file":"normal.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normal.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/helperFunctions\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"normalPixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse= baseColor.rgb;\n#endif\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const normalPixelShader = { name, shader };\n"]}
|
package/normal/normal.vertex.js
CHANGED
@@ -14,46 +14,67 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
|
|
14
14
|
import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
15
15
|
import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
|
16
16
|
const name = "normalVertexShader";
|
17
|
-
const shader = `precision highp float;
|
18
|
-
|
17
|
+
const shader = `precision highp float;attribute vec3 position;
|
18
|
+
#ifdef NORMAL
|
19
|
+
attribute vec3 normal;
|
20
|
+
#endif
|
19
21
|
#ifdef UV1
|
20
|
-
attribute vec2 uv;
|
22
|
+
attribute vec2 uv;
|
23
|
+
#endif
|
21
24
|
#ifdef UV2
|
22
|
-
attribute vec2 uv2;
|
25
|
+
attribute vec2 uv2;
|
26
|
+
#endif
|
23
27
|
#ifdef VERTEXCOLOR
|
24
|
-
attribute vec4 color;
|
28
|
+
attribute vec4 color;
|
29
|
+
#endif
|
25
30
|
#include<bonesDeclaration>
|
26
31
|
#include<bakedVertexAnimationDeclaration>
|
27
32
|
#include<instancesDeclaration>
|
28
|
-
uniform mat4 view;
|
29
|
-
|
33
|
+
uniform mat4 view;uniform mat4 viewProjection;
|
34
|
+
#ifdef DIFFUSE
|
35
|
+
varying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;
|
36
|
+
#endif
|
30
37
|
#ifdef POINTSIZE
|
31
|
-
uniform float pointSize;
|
32
|
-
|
33
|
-
varying vec3
|
38
|
+
uniform float pointSize;
|
39
|
+
#endif
|
40
|
+
varying vec3 vPositionW;
|
41
|
+
#ifdef NORMAL
|
42
|
+
varying vec3 vNormalW;
|
43
|
+
#endif
|
34
44
|
#include<clipPlaneVertexDeclaration>
|
35
45
|
#include<fogVertexDeclaration>
|
36
46
|
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
37
47
|
#define CUSTOM_VERTEX_DEFINITIONS
|
38
|
-
void main(void) {
|
48
|
+
void main(void) {
|
49
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
39
50
|
#include<instancesVertex>
|
40
51
|
#include<bonesVertex>
|
41
52
|
#include<bakedVertexAnimation>
|
42
|
-
vec4 worldPos=finalWorld*vec4(position,1.0);
|
43
|
-
|
53
|
+
vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
|
54
|
+
#ifdef NORMAL
|
55
|
+
vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
|
56
|
+
#endif
|
44
57
|
#ifndef UV1
|
45
|
-
vec2 uv=vec2(0.,0.);
|
58
|
+
vec2 uv=vec2(0.,0.);
|
59
|
+
#endif
|
46
60
|
#ifndef UV2
|
47
|
-
vec2 uv2=vec2(0.,0.);
|
61
|
+
vec2 uv2=vec2(0.,0.);
|
62
|
+
#endif
|
48
63
|
#ifdef DIFFUSE
|
49
|
-
if (vDiffuseInfos.x==0.)
|
64
|
+
if (vDiffuseInfos.x==0.)
|
65
|
+
{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}
|
66
|
+
else
|
67
|
+
{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}
|
68
|
+
#endif
|
50
69
|
#include<clipPlaneVertex>
|
51
70
|
#include<fogVertex>
|
52
71
|
#include<shadowsVertex>[0..maxSimultaneousLights]
|
53
72
|
#if defined(POINTSIZE) && !defined(WEBGPU)
|
54
|
-
gl_PointSize=pointSize;
|
73
|
+
gl_PointSize=pointSize;
|
74
|
+
#endif
|
55
75
|
#define CUSTOM_VERTEX_MAIN_END
|
56
|
-
}
|
76
|
+
}
|
77
|
+
`;
|
57
78
|
// Sideeffect
|
58
79
|
ShaderStore.ShadersStore[name] = shader;
|
59
80
|
/** @internal */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"normal.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normal.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AAEnD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG
|
1
|
+
{"version":3,"file":"normal.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normal.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AAEnD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Dd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/bonesVertex\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"normalVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const normalVertexShader = { name, shader };\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/materials",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.16.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": "^6.
|
21
|
+
"@babylonjs/core": "^6.16.0",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/materials": "^1.0.0"
|
24
24
|
},
|
@@ -12,8 +12,10 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
|
|
12
12
|
import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
|
14
14
|
const name = "shadowOnlyPixelShader";
|
15
|
-
const shader = `precision highp float;
|
16
|
-
|
15
|
+
const shader = `precision highp float;uniform vec4 vEyePosition;uniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;
|
16
|
+
#ifdef NORMAL
|
17
|
+
varying vec3 vNormalW;
|
18
|
+
#endif
|
17
19
|
#include<helperFunctions>
|
18
20
|
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
19
21
|
#include<lightsFragmentFunctions>
|
@@ -21,14 +23,21 @@ varying vec3 vNormalW;
|
|
21
23
|
#include<clipPlaneFragmentDeclaration>
|
22
24
|
#include<fogFragmentDeclaration>
|
23
25
|
#define CUSTOM_FRAGMENT_DEFINITIONS
|
24
|
-
void main(void) {
|
26
|
+
void main(void) {
|
27
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
25
28
|
#include<clipPlaneFragment>
|
26
|
-
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
|
27
|
-
|
28
|
-
vec3 normalW=
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
|
30
|
+
#ifdef NORMAL
|
31
|
+
vec3 normalW=normalize(vNormalW);
|
32
|
+
#else
|
33
|
+
vec3 normalW=vec3(1.0,1.0,1.0);
|
34
|
+
#endif
|
35
|
+
vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;
|
36
|
+
#include<lightFragment>[0..1]
|
37
|
+
vec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);
|
38
|
+
#include<fogFragment>
|
39
|
+
gl_FragColor=color;
|
40
|
+
#include<imageProcessingCompatibility>
|
32
41
|
#define CUSTOM_FRAGMENT_MAIN_END
|
33
42
|
}`;
|
34
43
|
// Sideeffect
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shadowOnly.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/shadowOnly/shadowOnly.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG
|
1
|
+
{"version":3,"file":"shadowOnly.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/shadowOnly/shadowOnly.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2Bb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/helperFunctions\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"shadowOnlyPixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;uniform float alpha;uniform vec3 shadowColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const shadowOnlyPixelShader = { name, shader };\n"]}
|
@@ -14,34 +14,46 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
|
|
14
14
|
import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
15
15
|
import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
|
16
16
|
const name = "shadowOnlyVertexShader";
|
17
|
-
const shader = `precision highp float;
|
18
|
-
|
17
|
+
const shader = `precision highp float;attribute vec3 position;
|
18
|
+
#ifdef NORMAL
|
19
|
+
attribute vec3 normal;
|
20
|
+
#endif
|
19
21
|
#include<bonesDeclaration>
|
20
22
|
#include<bakedVertexAnimationDeclaration>
|
21
23
|
#include<instancesDeclaration>
|
22
|
-
uniform mat4 view;
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
uniform mat4 view;uniform mat4 viewProjection;
|
25
|
+
#ifdef POINTSIZE
|
26
|
+
uniform float pointSize;
|
27
|
+
#endif
|
28
|
+
varying vec3 vPositionW;
|
29
|
+
#ifdef NORMAL
|
30
|
+
varying vec3 vNormalW;
|
31
|
+
#endif
|
26
32
|
#ifdef VERTEXCOLOR
|
27
|
-
varying vec4 vColor;
|
33
|
+
varying vec4 vColor;
|
34
|
+
#endif
|
28
35
|
#include<clipPlaneVertexDeclaration>
|
29
36
|
#include<fogVertexDeclaration>
|
30
37
|
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
31
38
|
#define CUSTOM_VERTEX_DEFINITIONS
|
32
|
-
void main(void) {
|
39
|
+
void main(void) {
|
40
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
33
41
|
#include<instancesVertex>
|
34
42
|
#include<bonesVertex>
|
35
43
|
#include<bakedVertexAnimation>
|
36
|
-
vec4 worldPos=finalWorld*vec4(position,1.0);
|
37
|
-
|
44
|
+
vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
|
45
|
+
#ifdef NORMAL
|
46
|
+
vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
|
47
|
+
#endif
|
38
48
|
#include<clipPlaneVertex>
|
39
49
|
#include<fogVertex>
|
40
50
|
#include<shadowsVertex>[0..maxSimultaneousLights]
|
41
51
|
#if defined(POINTSIZE) && !defined(WEBGPU)
|
42
|
-
gl_PointSize=pointSize;
|
52
|
+
gl_PointSize=pointSize;
|
53
|
+
#endif
|
43
54
|
#define CUSTOM_VERTEX_MAIN_END
|
44
|
-
}
|
55
|
+
}
|
56
|
+
`;
|
45
57
|
// Sideeffect
|
46
58
|
ShaderStore.ShadersStore[name] = shader;
|
47
59
|
/** @internal */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shadowOnly.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/shadowOnly/shadowOnly.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AAEnD,MAAM,IAAI,GAAG,wBAAwB,CAAC;AACtC,MAAM,MAAM,GAAG
|
1
|
+
{"version":3,"file":"shadowOnly.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/shadowOnly/shadowOnly.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AAEnD,MAAM,IAAI,GAAG,wBAAwB,CAAC;AACtC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/bonesVertex\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"shadowOnlyVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const shadowOnlyVertexShader = { name, shader };\n"]}
|
@@ -13,38 +13,56 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
|
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
|
14
14
|
import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
|
15
15
|
const name = "simplePixelShader";
|
16
|
-
const shader = `precision highp float;
|
17
|
-
|
16
|
+
const shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;
|
17
|
+
#ifdef NORMAL
|
18
|
+
varying vec3 vNormalW;
|
19
|
+
#endif
|
18
20
|
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
19
|
-
varying vec4 vColor;
|
21
|
+
varying vec4 vColor;
|
22
|
+
#endif
|
20
23
|
#include<helperFunctions>
|
21
24
|
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
22
25
|
#include<lightsFragmentFunctions>
|
23
26
|
#include<shadowsFragmentFunctions>
|
24
27
|
#ifdef DIFFUSE
|
25
|
-
varying vec2 vDiffuseUV;
|
28
|
+
varying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;
|
29
|
+
#endif
|
26
30
|
#include<clipPlaneFragmentDeclaration>
|
27
31
|
#include<fogFragmentDeclaration>
|
28
32
|
#define CUSTOM_FRAGMENT_DEFINITIONS
|
29
|
-
void main(void) {
|
33
|
+
void main(void) {
|
34
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
30
35
|
#include<clipPlaneFragment>
|
31
|
-
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
|
32
|
-
|
33
|
-
|
36
|
+
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;
|
37
|
+
#ifdef DIFFUSE
|
38
|
+
baseColor=texture2D(diffuseSampler,vDiffuseUV);
|
39
|
+
#ifdef ALPHATEST
|
40
|
+
if (baseColor.a<0.4)
|
41
|
+
discard;
|
42
|
+
#endif
|
34
43
|
#include<depthPrePass>
|
35
|
-
baseColor.rgb*=vDiffuseInfos.y;
|
44
|
+
baseColor.rgb*=vDiffuseInfos.y;
|
45
|
+
#endif
|
36
46
|
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
37
|
-
baseColor.rgb*=vColor.rgb;
|
47
|
+
baseColor.rgb*=vColor.rgb;
|
48
|
+
#endif
|
38
49
|
#ifdef NORMAL
|
39
|
-
vec3 normalW=normalize(vNormalW);
|
40
|
-
|
41
|
-
vec3
|
42
|
-
|
50
|
+
vec3 normalW=normalize(vNormalW);
|
51
|
+
#else
|
52
|
+
vec3 normalW=vec3(1.0,1.0,1.0);
|
53
|
+
#endif
|
54
|
+
vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;
|
55
|
+
#ifdef SPECULARTERM
|
56
|
+
vec3 specularBase=vec3(0.,0.,0.);
|
57
|
+
#endif
|
43
58
|
#include<lightFragment>[0..maxSimultaneousLights]
|
44
59
|
#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
45
|
-
alpha*=vColor.a;
|
46
|
-
|
47
|
-
|
60
|
+
alpha*=vColor.a;
|
61
|
+
#endif
|
62
|
+
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);
|
63
|
+
#include<fogFragment>
|
64
|
+
gl_FragColor=color;
|
65
|
+
#include<imageProcessingCompatibility>
|
48
66
|
#define CUSTOM_FRAGMENT_MAIN_END
|
49
67
|
}`;
|
50
68
|
// Sideeffect
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"simple.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/simple/simple.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG
|
1
|
+
{"version":3,"file":"simple.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/simple/simple.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/helperFunctions\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"simplePixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const simplePixelShader = { name, shader };\n"]}
|
package/simple/simple.vertex.js
CHANGED
@@ -15,49 +15,71 @@ import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
|
15
15
|
import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
|
16
16
|
import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
|
17
17
|
const name = "simpleVertexShader";
|
18
|
-
const shader = `precision highp float;
|
19
|
-
|
18
|
+
const shader = `precision highp float;attribute vec3 position;
|
19
|
+
#ifdef NORMAL
|
20
|
+
attribute vec3 normal;
|
21
|
+
#endif
|
20
22
|
#ifdef UV1
|
21
|
-
attribute vec2 uv;
|
23
|
+
attribute vec2 uv;
|
24
|
+
#endif
|
22
25
|
#ifdef UV2
|
23
|
-
attribute vec2 uv2;
|
26
|
+
attribute vec2 uv2;
|
27
|
+
#endif
|
24
28
|
#ifdef VERTEXCOLOR
|
25
|
-
attribute vec4 color;
|
29
|
+
attribute vec4 color;
|
30
|
+
#endif
|
26
31
|
#include<bonesDeclaration>
|
27
32
|
#include<bakedVertexAnimationDeclaration>
|
28
33
|
#include<instancesDeclaration>
|
29
|
-
uniform mat4 view;
|
30
|
-
|
34
|
+
uniform mat4 view;uniform mat4 viewProjection;
|
35
|
+
#ifdef DIFFUSE
|
36
|
+
varying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;
|
37
|
+
#endif
|
31
38
|
#ifdef POINTSIZE
|
32
|
-
uniform float pointSize;
|
33
|
-
|
34
|
-
varying vec3
|
39
|
+
uniform float pointSize;
|
40
|
+
#endif
|
41
|
+
varying vec3 vPositionW;
|
42
|
+
#ifdef NORMAL
|
43
|
+
varying vec3 vNormalW;
|
44
|
+
#endif
|
35
45
|
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
36
|
-
varying vec4 vColor;
|
46
|
+
varying vec4 vColor;
|
47
|
+
#endif
|
37
48
|
#include<clipPlaneVertexDeclaration>
|
38
49
|
#include<fogVertexDeclaration>
|
39
50
|
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
40
51
|
#define CUSTOM_VERTEX_DEFINITIONS
|
41
|
-
void main(void) {
|
52
|
+
void main(void) {
|
53
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
42
54
|
#include<instancesVertex>
|
43
55
|
#include<bonesVertex>
|
44
56
|
#include<bakedVertexAnimation>
|
45
|
-
vec4 worldPos=finalWorld*vec4(position,1.0);
|
46
|
-
|
57
|
+
vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
|
58
|
+
#ifdef NORMAL
|
59
|
+
vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
|
60
|
+
#endif
|
47
61
|
#ifndef UV1
|
48
|
-
vec2 uv=vec2(0.,0.);
|
62
|
+
vec2 uv=vec2(0.,0.);
|
63
|
+
#endif
|
49
64
|
#ifndef UV2
|
50
|
-
vec2 uv2=vec2(0.,0.);
|
65
|
+
vec2 uv2=vec2(0.,0.);
|
66
|
+
#endif
|
51
67
|
#ifdef DIFFUSE
|
52
|
-
if (vDiffuseInfos.x==0.)
|
68
|
+
if (vDiffuseInfos.x==0.)
|
69
|
+
{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}
|
70
|
+
else
|
71
|
+
{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}
|
72
|
+
#endif
|
53
73
|
#include<clipPlaneVertex>
|
54
74
|
#include<fogVertex>
|
55
75
|
#include<shadowsVertex>[0..maxSimultaneousLights]
|
56
76
|
#include<vertexColorMixing>
|
57
77
|
#if defined(POINTSIZE) && !defined(WEBGPU)
|
58
|
-
gl_PointSize=pointSize;
|
78
|
+
gl_PointSize=pointSize;
|
79
|
+
#endif
|
59
80
|
#define CUSTOM_VERTEX_MAIN_END
|
60
|
-
}
|
81
|
+
}
|
82
|
+
`;
|
61
83
|
// Sideeffect
|
62
84
|
ShaderStore.ShadersStore[name] = shader;
|
63
85
|
/** @internal */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"simple.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/simple/simple.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AACnD,qEAAuD;AAEvD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG
|
1
|
+
{"version":3,"file":"simple.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/simple/simple.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AACnD,qEAAuD;AAEvD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/bonesVertex\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\nimport \"core/Shaders/ShadersInclude/vertexColorMixing\";\n\nconst name = \"simpleVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const simpleVertexShader = { name, shader };\n"]}
|