@babylonjs/materials 6.32.1 → 6.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. package/cell/cell.fragment.d.ts +2 -0
  2. package/cell/cell.fragment.js +7 -0
  3. package/cell/cell.fragment.js.map +1 -1
  4. package/cell/cell.vertex.d.ts +2 -0
  5. package/cell/cell.vertex.js +4 -0
  6. package/cell/cell.vertex.js.map +1 -1
  7. package/cell/cellMaterial.js +7 -1
  8. package/cell/cellMaterial.js.map +1 -1
  9. package/custom/pbrCustomMaterial.js +1 -1
  10. package/custom/pbrCustomMaterial.js.map +1 -1
  11. package/fire/fire.fragment.d.ts +2 -0
  12. package/fire/fire.fragment.js +7 -0
  13. package/fire/fire.fragment.js.map +1 -1
  14. package/fire/fire.vertex.d.ts +2 -0
  15. package/fire/fire.vertex.js +4 -0
  16. package/fire/fire.vertex.js.map +1 -1
  17. package/fire/fireMaterial.js +7 -0
  18. package/fire/fireMaterial.js.map +1 -1
  19. package/fur/fur.fragment.d.ts +2 -0
  20. package/fur/fur.fragment.js +7 -0
  21. package/fur/fur.fragment.js.map +1 -1
  22. package/fur/fur.vertex.d.ts +2 -0
  23. package/fur/fur.vertex.js +4 -0
  24. package/fur/fur.vertex.js.map +1 -1
  25. package/fur/furMaterial.js +7 -1
  26. package/fur/furMaterial.js.map +1 -1
  27. package/gradient/gradient.fragment.d.ts +2 -0
  28. package/gradient/gradient.fragment.js +7 -0
  29. package/gradient/gradient.fragment.js.map +1 -1
  30. package/gradient/gradient.vertex.d.ts +2 -0
  31. package/gradient/gradient.vertex.js +4 -0
  32. package/gradient/gradient.vertex.js.map +1 -1
  33. package/gradient/gradientMaterial.js +7 -1
  34. package/gradient/gradientMaterial.js.map +1 -1
  35. package/grid/grid.fragment.d.ts +2 -0
  36. package/grid/grid.fragment.js +7 -0
  37. package/grid/grid.fragment.js.map +1 -1
  38. package/grid/grid.vertex.d.ts +2 -0
  39. package/grid/grid.vertex.js +4 -0
  40. package/grid/grid.vertex.js.map +1 -1
  41. package/grid/gridMaterial.js +7 -1
  42. package/grid/gridMaterial.js.map +1 -1
  43. package/lava/lava.fragment.d.ts +2 -0
  44. package/lava/lava.fragment.js +7 -0
  45. package/lava/lava.fragment.js.map +1 -1
  46. package/lava/lava.vertex.d.ts +2 -0
  47. package/lava/lava.vertex.js +4 -0
  48. package/lava/lava.vertex.js.map +1 -1
  49. package/lava/lavaMaterial.js +7 -1
  50. package/lava/lavaMaterial.js.map +1 -1
  51. package/mix/mix.fragment.d.ts +2 -0
  52. package/mix/mix.fragment.js +7 -0
  53. package/mix/mix.fragment.js.map +1 -1
  54. package/mix/mix.vertex.d.ts +2 -0
  55. package/mix/mix.vertex.js +4 -0
  56. package/mix/mix.vertex.js.map +1 -1
  57. package/mix/mixMaterial.js +7 -1
  58. package/mix/mixMaterial.js.map +1 -1
  59. package/normal/normal.fragment.d.ts +2 -0
  60. package/normal/normal.fragment.js +7 -0
  61. package/normal/normal.fragment.js.map +1 -1
  62. package/normal/normal.vertex.d.ts +2 -0
  63. package/normal/normal.vertex.js +4 -0
  64. package/normal/normal.vertex.js.map +1 -1
  65. package/normal/normalMaterial.js +7 -1
  66. package/normal/normalMaterial.js.map +1 -1
  67. package/package.json +2 -2
  68. package/shadowOnly/shadowOnly.fragment.d.ts +2 -0
  69. package/shadowOnly/shadowOnly.fragment.js +7 -0
  70. package/shadowOnly/shadowOnly.fragment.js.map +1 -1
  71. package/shadowOnly/shadowOnly.vertex.d.ts +2 -0
  72. package/shadowOnly/shadowOnly.vertex.js +4 -0
  73. package/shadowOnly/shadowOnly.vertex.js.map +1 -1
  74. package/shadowOnly/shadowOnlyMaterial.js +20 -2
  75. package/shadowOnly/shadowOnlyMaterial.js.map +1 -1
  76. package/simple/simple.fragment.d.ts +2 -0
  77. package/simple/simple.fragment.js +7 -0
  78. package/simple/simple.fragment.js.map +1 -1
  79. package/simple/simple.vertex.d.ts +2 -0
  80. package/simple/simple.vertex.js +4 -0
  81. package/simple/simple.vertex.js.map +1 -1
  82. package/simple/simpleMaterial.js +7 -1
  83. package/simple/simpleMaterial.js.map +1 -1
  84. package/sky/sky.fragment.d.ts +2 -0
  85. package/sky/sky.fragment.js +7 -0
  86. package/sky/sky.fragment.js.map +1 -1
  87. package/sky/sky.vertex.d.ts +2 -0
  88. package/sky/sky.vertex.js +4 -0
  89. package/sky/sky.vertex.js.map +1 -1
  90. package/sky/skyMaterial.js +7 -1
  91. package/sky/skyMaterial.js.map +1 -1
  92. package/terrain/terrain.fragment.d.ts +2 -0
  93. package/terrain/terrain.fragment.js +7 -0
  94. package/terrain/terrain.fragment.js.map +1 -1
  95. package/terrain/terrain.vertex.d.ts +2 -0
  96. package/terrain/terrain.vertex.js +4 -0
  97. package/terrain/terrain.vertex.js.map +1 -1
  98. package/terrain/terrainMaterial.js +16 -2
  99. package/terrain/terrainMaterial.js.map +1 -1
  100. package/triPlanar/triPlanarMaterial.js +7 -2
  101. package/triPlanar/triPlanarMaterial.js.map +1 -1
  102. package/triPlanar/triplanar.fragment.d.ts +2 -0
  103. package/triPlanar/triplanar.fragment.js +7 -0
  104. package/triPlanar/triplanar.fragment.js.map +1 -1
  105. package/triPlanar/triplanar.vertex.d.ts +2 -0
  106. package/triPlanar/triplanar.vertex.js +4 -0
  107. package/triPlanar/triplanar.vertex.js.map +1 -1
  108. package/water/waterMaterial.d.ts +0 -3
  109. package/water/waterMaterial.js +4 -10
  110. package/water/waterMaterial.js.map +1 -1
@@ -4,10 +4,12 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
4
4
  import "@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js";
5
5
  import "@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js";
6
6
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
7
8
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
8
9
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
9
10
  import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
10
11
  import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
12
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
11
13
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
12
14
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
13
15
  /** @internal */
@@ -6,10 +6,12 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
6
6
  import "@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js";
7
7
  import "@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js";
8
8
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
9
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
9
10
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
10
11
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
11
12
  import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
12
13
  import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
14
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
13
15
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
14
16
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
15
17
  const name = "cellPixelShader";
@@ -28,6 +30,10 @@ varying vec4 vColor;
28
30
  varying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;
29
31
  #endif
30
32
  #include<clipPlaneFragmentDeclaration>
33
+ #ifdef LOGARITHMICDEPTH
34
+ #extension GL_EXT_frag_depth : enable
35
+ #endif
36
+ #include<logDepthDeclaration>
31
37
  #include<fogFragmentDeclaration>
32
38
  vec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)
33
39
  {diffuseBase=info.diffuse*shadow;
@@ -79,6 +85,7 @@ vec3 specularBase=vec3(0.,0.,0.);
79
85
  alpha*=vColor.a;
80
86
  #endif
81
87
  vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);
88
+ #include<logDepthFragment>
82
89
  #include<fogFragment>
83
90
  gl_FragColor=color;
84
91
  #include<imageProcessingCompatibility>
@@ -1 +1 @@
1
- {"version":3,"file":"cell.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cell.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,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,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 = \"cellPixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\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>\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{diffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;if (info.ndl<0.5)\nlevel=0.5;diffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;float ToonBrightnessLevels[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.rgb*=ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase.rgb*=ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase.rgb*=ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase.rgb*=ToonBrightnessLevels[3];}\nelse\n{diffuseBase.rgb*=ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase,vec3(0.2));}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\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 VERTEXCOLOR\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\nlightingInfo info;vec3 diffuseBase=vec3(0.,0.,0.);float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=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 cellPixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"cell.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cell.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,uEAAyD;AACzD,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,oEAAsD;AACtD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2Eb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,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/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"cellPixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\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#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{diffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;if (info.ndl<0.5)\nlevel=0.5;diffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];ToonThresholds[0]=0.95;ToonThresholds[1]=0.5;ToonThresholds[2]=0.2;ToonThresholds[3]=0.03;float ToonBrightnessLevels[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.rgb*=ToonBrightnessLevels[0];}\nelse if (info.ndl>ToonThresholds[1])\n{diffuseBase.rgb*=ToonBrightnessLevels[1];}\nelse if (info.ndl>ToonThresholds[2])\n{diffuseBase.rgb*=ToonBrightnessLevels[2];}\nelse if (info.ndl>ToonThresholds[3])\n{diffuseBase.rgb*=ToonBrightnessLevels[3];}\nelse\n{diffuseBase.rgb*=ToonBrightnessLevels[4];}\n#endif\nreturn max(diffuseBase,vec3(0.2));}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\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 VERTEXCOLOR\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\nlightingInfo info;vec3 diffuseBase=vec3(0.,0.,0.);float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=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<logDepthFragment>\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 cellPixelShader = { name, shader };\n"]}
@@ -2,6 +2,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
2
2
  import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
3
3
  import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
4
4
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
5
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
5
6
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
6
7
  import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
7
8
  import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
@@ -12,6 +13,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
12
13
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
13
14
  import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
14
15
  import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
16
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
15
17
  /** @internal */
16
18
  export declare const cellVertexShader: {
17
19
  name: string;
@@ -4,6 +4,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
4
4
  import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
5
5
  import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
6
6
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
7
8
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
8
9
  import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
9
10
  import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
@@ -14,6 +15,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
14
15
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
15
16
  import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
16
17
  import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
18
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
17
19
  const name = "cellVertexShader";
18
20
  const shader = `precision highp float;attribute vec3 position;
19
21
  #ifdef NORMAL
@@ -46,6 +48,7 @@ varying vec3 vNormalW;
46
48
  varying vec4 vColor;
47
49
  #endif
48
50
  #include<clipPlaneVertexDeclaration>
51
+ #include<logDepthDeclaration>
49
52
  #include<fogVertexDeclaration>
50
53
  #include<__decl__lightFragment>[0..maxSimultaneousLights]
51
54
  #define CUSTOM_VERTEX_DEFINITIONS
@@ -77,6 +80,7 @@ else
77
80
  #if defined(POINTSIZE) && !defined(WEBGPU)
78
81
  gl_PointSize=pointSize;
79
82
  #endif
83
+ #include<logDepthVertex>
80
84
  #define CUSTOM_VERTEX_MAIN_END
81
85
  }
82
86
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"cell.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cell.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,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,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 = \"cellVertexShader\";\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#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#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 cellVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"cell.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cell.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,uEAAyD;AACzD,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AACnD,qEAAuD;AACvD,kEAAoD;AAEpD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,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/logDepthDeclaration\";\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\";\nimport \"core/Shaders/ShadersInclude/logDepthVertex\";\n\nconst name = \"cellVertexShader\";\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#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\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#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const cellVertexShader = { name, shader };\n"]}
@@ -40,6 +40,7 @@ class CellMaterialDefines extends MaterialDefines {
40
40
  this.DEPTHPREPASS = false;
41
41
  this.IMAGEPROCESSINGPOSTPROCESS = false;
42
42
  this.SKIPFINALCOLORCLAMP = false;
43
+ this.LOGARITHMICDEPTH = false;
43
44
  this.rebuild();
44
45
  }
45
46
  }
@@ -94,7 +95,7 @@ export class CellMaterial extends PushMaterial {
94
95
  // High level
95
96
  defines.CELLBASIC = !this.computeHighLevel;
96
97
  // Misc.
97
- MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
98
+ MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
98
99
  // Lights
99
100
  defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
100
101
  // Values that need to be evaluated on every frame
@@ -146,6 +147,7 @@ export class CellMaterial extends PushMaterial {
146
147
  "vDiffuseInfos",
147
148
  "mBones",
148
149
  "diffuseMatrix",
150
+ "logarithmicDepthConstant",
149
151
  ];
150
152
  const samplers = ["diffuseSampler"];
151
153
  const uniformBuffers = [];
@@ -206,6 +208,10 @@ export class CellMaterial extends PushMaterial {
206
208
  if (this.pointsCloud) {
207
209
  this._activeEffect.setFloat("pointSize", this.pointSize);
208
210
  }
211
+ // Log. depth
212
+ if (this._useLogarithmicDepth) {
213
+ MaterialHelper.BindLogDepth(defines, effect, scene);
214
+ }
209
215
  scene.bindEyePosition(effect);
210
216
  }
211
217
  this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
@@ -1 +1 @@
1
- {"version":3,"file":"cellMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cellMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAG/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,cAAc,EAAE,oDAAsC;AAC/D,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAE7F,MAAM,mBAAoB,SAAQ,eAAe;IA2B7C;QACI,KAAK,EAAE,CAAC;QA3BL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GA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AAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACxG,CAAC;IAEM,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACJ;AA7SW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AAG5B;IADN,iBAAiB,CAAC,SAAS,CAAC;kDACa;AAGnC;IADN,SAAS,CAAC,kBAAkB,CAAC;uDACY;AAEnC;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDACpB;AAGzB;IADP,SAAS,CAAC,iBAAiB,CAAC;sDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;qDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;4DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;2DACd;AA2RzC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"core/Materials/materialHelper\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\n\r\nimport \"./cell.fragment\";\r\nimport \"./cell.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\n\r\nclass CellMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public ALPHATEST = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public NDOTL = true;\r\n public CUSTOMUSERLIGHTING = true;\r\n public CELLBASIC = true;\r\n public DEPTHPREPASS = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class CellMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"computeHighLevel\")\r\n public _computeHighLevel: boolean = false;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public computeHighLevel: boolean;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (subMesh.effect && subMesh.effect._wasPreviouslyReady && subMesh.effect._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new CellMaterialDefines();\r\n }\r\n\r\n const defines = <CellMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n defines.CELLBASIC = !this.computeHighLevel;\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"cell\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n MaterialHelper.PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights,\r\n });\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights - 1 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n subMesh.effect._wasPreviouslyReady = true;\r\n subMesh.effect._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <CellMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.CellMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial {\r\n return SerializationHelper.Parse(() => new CellMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CellMaterial\", CellMaterial);\r\n"]}
1
+ {"version":3,"file":"cellMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/cell/cellMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/H,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAG/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,cAAc,EAAE,oDAAsC;AAC/D,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAE7F,MAAM,mBAAoB,SAAQ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2DACd;AAiSzC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { MaterialHelper } from \"core/Materials/materialHelper\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\n\r\nimport \"./cell.fragment\";\r\nimport \"./cell.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\n\r\nclass CellMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public ALPHATEST = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public NDOTL = true;\r\n public CUSTOMUSERLIGHTING = true;\r\n public CELLBASIC = true;\r\n public DEPTHPREPASS = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class CellMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize(\"computeHighLevel\")\r\n public _computeHighLevel: boolean = false;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public computeHighLevel: boolean;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n if (this.isFrozen) {\r\n if (subMesh.effect && subMesh.effect._wasPreviouslyReady && subMesh.effect._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new CellMaterialDefines();\r\n }\r\n\r\n const defines = <CellMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n defines.CELLBASIC = !this.computeHighLevel;\r\n\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"cell\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n MaterialHelper.PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this.maxSimultaneousLights,\r\n });\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights - 1 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n subMesh.effect._wasPreviouslyReady = true;\r\n subMesh.effect._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <CellMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n MaterialHelper.BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect);\r\n }\r\n\r\n public getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return this._diffuseTexture === texture;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n if (this._diffuseTexture) {\r\n this._diffuseTexture.dispose();\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public getClassName(): string {\r\n return \"CellMaterial\";\r\n }\r\n\r\n public clone(name: string): CellMaterial {\r\n return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.CellMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial {\r\n return SerializationHelper.Parse(() => new CellMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CellMaterial\", CellMaterial);\r\n"]}
@@ -126,7 +126,7 @@ export class PBRCustomMaterial extends PBRMaterial {
126
126
  this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore["pbrBlockReflectivity"]);
127
127
  this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore["pbrBlockFinalColorComposition"]);
128
128
  PBRCustomMaterial.ShaderIndexer++;
129
- this._createdShaderName = "custom_" + PBRCustomMaterial.ShaderIndexer;
129
+ this._createdShaderName = "custompbr_" + PBRCustomMaterial.ShaderIndexer;
130
130
  }
131
131
  _afterBind(mesh, effect = null) {
132
132
  if (!effect) {
@@ -1 +1 @@
1
- {"version":3,"file":"pbrCustomMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/custom/pbrCustomMaterial.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAG7D,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,iBAAiB,EAAE,gEAAkD;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAGvD,MAAM,OAAO,iBAAiB;IAC1B,gBAAe,CAAC;CAuCnB;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAEnD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAavC,eAAe,CAAC,IAAsB,EAAE,MAAc;QACzD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE;gBACxC,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;oBACjB,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;iBAC3D;qBAAM,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE;oBACxB,IAAI,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,YAAY,MAAM,EAAE;w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CAAC;IAChB,CAAC;IAEM,gBAAgB,CAAC,UAAkB;QACtC,IAAI,CAAC,WAAW,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,2BAA2B,CAAC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,cAAc,CAAC,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;;AA7Sa,+BAAa,GAAG,CAAC,CAAC;AAgTpC,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport type { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { ShaderCodeInliner } from \"core/Engines/Processors/shaderCodeInliner\";\r\nimport type { ICustomShaderNameResolveOptions } from \"core/Materials/material\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nexport class ShaderAlbedoParts {\r\n constructor() {}\r\n\r\n public Fragment_Begin: string;\r\n public Fragment_Definitions: string;\r\n public Fragment_MainBegin: string;\r\n public Fragment_MainEnd: string;\r\n\r\n // albedoColor\r\n public Fragment_Custom_Albedo: string;\r\n // lights\r\n public Fragment_Before_Lights: string;\r\n // roughness\r\n public Fragment_Custom_MetallicRoughness: string;\r\n // microsurface\r\n public Fragment_Custom_MicroSurface: string;\r\n // fog\r\n public Fragment_Before_Fog: string;\r\n // alpha\r\n public Fragment_Custom_Alpha: string;\r\n // color composition\r\n public Fragment_Before_FinalColorComposition: string;\r\n // frag color\r\n public Fragment_Before_FragColor: string;\r\n\r\n public Vertex_Begin: string;\r\n public Vertex_Definitions: string;\r\n public Vertex_MainBegin: string;\r\n\r\n // positionUpdated\r\n public Vertex_Before_PositionUpdated: string;\r\n\r\n // normalUpdated\r\n public Vertex_Before_NormalUpdated: string;\r\n\r\n // worldPosComputed\r\n public Vertex_After_WorldPosComputed: string;\r\n\r\n // mainEnd\r\n public Vertex_MainEnd: string;\r\n}\r\n\r\n/**\r\n * @deprecated use ShaderAlbedoParts instead.\r\n */\r\nexport const ShaderAlebdoParts = ShaderAlbedoParts;\r\n\r\nexport class PBRCustomMaterial extends PBRMaterial {\r\n public static ShaderIndexer = 1;\r\n public CustomParts: ShaderAlbedoParts;\r\n _createdShaderName: string;\r\n _customUniform: string[];\r\n _newUniforms: string[];\r\n _newUniformInstances: { [name: string]: any };\r\n _newSamplerInstances: { [name: string]: Texture };\r\n _customAttributes: string[];\r\n\r\n public FragmentShader: string;\r\n public VertexShader: string;\r\n\r\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\r\n if (this._newUniformInstances) {\r\n for (const el in this._newUniformInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"vec2\") {\r\n effect.setVector2(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"vec3\") {\r\n if (this._newUniformInstances[el] instanceof Color3) {\r\n effect.setColor3(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector3(ea[1], this._newUniformInstances[el]);\r\n }\r\n } else if (ea[0] == \"vec4\") {\r\n if (this._newUniformInstances[el] instanceof Color4) {\r\n effect.setDirectColor4(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n }\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"mat4\") {\r\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"float\") {\r\n effect.setFloat(ea[1], this._newUniformInstances[el]);\r\n }\r\n }\r\n }\r\n if (this._newSamplerInstances) {\r\n for (const el in this._newSamplerInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"sampler2D\" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\r\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n public ReviewUniform(name: string, arr: string[]): string[] {\r\n if (name == \"uniform\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") == -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n if (name == \"sampler\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") != -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n public Builder(\r\n shaderName: string,\r\n uniforms: string[],\r\n uniformBuffers: string[],\r\n samplers: string[],\r\n defines: MaterialDefines | string[],\r\n attributes?: string[],\r\n options?: ICustomShaderNameResolveOptions\r\n ): string {\r\n if (options) {\r\n const currentProcessing = options.processFinalCode;\r\n options.processFinalCode = (type: string, code: string) => {\r\n if (type === \"vertex\") {\r\n return currentProcessing ? currentProcessing(type, code) : code;\r\n }\r\n const sci = new ShaderCodeInliner(code);\r\n sci.inlineToken = \"#define pbr_inline\";\r\n sci.processCode();\r\n return currentProcessing ? currentProcessing(type, sci.code) : sci.code;\r\n };\r\n }\r\n\r\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\r\n attributes.push(...this._customAttributes);\r\n }\r\n\r\n this.ReviewUniform(\"uniform\", uniforms);\r\n this.ReviewUniform(\"sampler\", samplers);\r\n\r\n const name = this._createdShaderName;\r\n\r\n if (Effect.ShadersStore[name + \"VertexShader\"] && Effect.ShadersStore[name + \"PixelShader\"]) {\r\n return name;\r\n }\r\n\r\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader.replace(\"#define CUSTOM_VERTEX_BEGIN\", this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\")\r\n .replace(\r\n \"#define CUSTOM_VERTEX_DEFINITIONS\",\r\n (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\")\r\n )\r\n .replace(\"#define CUSTOM_VERTEX_MAIN_BEGIN\", this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\")\r\n .replace(\"#define CUSTOM_VERTEX_UPDATE_POSITION\", this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\")\r\n .replace(\"#define CUSTOM_VERTEX_UPDATE_NORMAL\", this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\")\r\n .replace(\"#define CUSTOM_VERTEX_MAIN_END\", this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\");\r\n\r\n if (this.CustomParts.Vertex_After_WorldPosComputed) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = Effect.ShadersStore[name + \"VertexShader\"].replace(\r\n \"#define CUSTOM_VERTEX_UPDATE_WORLDPOS\",\r\n this.CustomParts.Vertex_After_WorldPosComputed\r\n );\r\n }\r\n\r\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader.replace(\r\n \"#define CUSTOM_FRAGMENT_BEGIN\",\r\n this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_MAIN_BEGIN\", this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\")\r\n .replace(\r\n \"#define CUSTOM_FRAGMENT_DEFINITIONS\",\r\n (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\")\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\", this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : \"\")\r\n .replace(\"#define CUSTOM_FRAGMENT_UPDATE_ALPHA\", this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\")\r\n .replace(\"#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\", this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\")\r\n .replace(\r\n \"#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\",\r\n this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : \"\"\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\", this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : \"\")\r\n .replace(\r\n \"#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\",\r\n this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : \"\"\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\", this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\")\r\n .replace(\"#define CUSTOM_FRAGMENT_MAIN_END\", this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : \"\");\r\n\r\n if (this.CustomParts.Fragment_Before_Fog) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = Effect.ShadersStore[name + \"PixelShader\"].replace(\r\n \"#define CUSTOM_FRAGMENT_BEFORE_FOG\",\r\n this.CustomParts.Fragment_Before_Fog\r\n );\r\n }\r\n\r\n return name;\r\n }\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.CustomParts = new ShaderAlbedoParts();\r\n this.customShaderNameResolve = this.Builder;\r\n\r\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\r\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\r\n\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore[\"pbrBlockAlbedoOpacity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore[\"pbrBlockReflectivity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore[\"pbrBlockFinalColorComposition\"]);\r\n\r\n PBRCustomMaterial.ShaderIndexer++;\r\n this._createdShaderName = \"custom_\" + PBRCustomMaterial.ShaderIndexer;\r\n }\r\n\r\n protected _afterBind(mesh?: Mesh, effect: Nullable<Effect> = null): void {\r\n if (!effect) {\r\n return;\r\n }\r\n this.AttachAfterBind(mesh, effect);\r\n try {\r\n super._afterBind(mesh, effect);\r\n } catch (e) {}\r\n }\r\n\r\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\r\n if (!this._customUniform) {\r\n this._customUniform = new Array();\r\n this._newUniforms = new Array();\r\n this._newSamplerInstances = {};\r\n this._newUniformInstances = {};\r\n }\r\n if (param) {\r\n if (kind.indexOf(\"sampler\") != -1) {\r\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\r\n } else {\r\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\r\n }\r\n }\r\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\r\n this._newUniforms.push(name);\r\n\r\n return this;\r\n }\r\n\r\n public AddAttribute(name: string): PBRCustomMaterial {\r\n if (!this._customAttributes) {\r\n this._customAttributes = [];\r\n }\r\n\r\n this._customAttributes.push(name);\r\n\r\n return this;\r\n }\r\n\r\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\r\n return this;\r\n }\r\n\r\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Lights = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Fog = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\r\n return this;\r\n }\r\n\r\n public Fragment_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainEnd = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\r\n return this;\r\n }\r\n\r\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\r\n return this;\r\n }\r\n\r\n public Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainEnd = shaderPart;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PBRCustomMaterial\", PBRCustomMaterial);\r\n"]}
1
+ {"version":3,"file":"pbrCustomMater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;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,2BAA2B,CAAC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,6BAA6B,CAAC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,cAAc,CAAC,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;;AA7Sa,+BAAa,GAAG,CAAC,CAAC;AAgTpC,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Effect } from \"core/Materials/effect\";\r\nimport type { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PBRMaterial } from \"core/Materials/PBR/pbrMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { ShaderCodeInliner } from \"core/Engines/Processors/shaderCodeInliner\";\r\nimport type { ICustomShaderNameResolveOptions } from \"core/Materials/material\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nexport class ShaderAlbedoParts {\r\n constructor() {}\r\n\r\n public Fragment_Begin: string;\r\n public Fragment_Definitions: string;\r\n public Fragment_MainBegin: string;\r\n public Fragment_MainEnd: string;\r\n\r\n // albedoColor\r\n public Fragment_Custom_Albedo: string;\r\n // lights\r\n public Fragment_Before_Lights: string;\r\n // roughness\r\n public Fragment_Custom_MetallicRoughness: string;\r\n // microsurface\r\n public Fragment_Custom_MicroSurface: string;\r\n // fog\r\n public Fragment_Before_Fog: string;\r\n // alpha\r\n public Fragment_Custom_Alpha: string;\r\n // color composition\r\n public Fragment_Before_FinalColorComposition: string;\r\n // frag color\r\n public Fragment_Before_FragColor: string;\r\n\r\n public Vertex_Begin: string;\r\n public Vertex_Definitions: string;\r\n public Vertex_MainBegin: string;\r\n\r\n // positionUpdated\r\n public Vertex_Before_PositionUpdated: string;\r\n\r\n // normalUpdated\r\n public Vertex_Before_NormalUpdated: string;\r\n\r\n // worldPosComputed\r\n public Vertex_After_WorldPosComputed: string;\r\n\r\n // mainEnd\r\n public Vertex_MainEnd: string;\r\n}\r\n\r\n/**\r\n * @deprecated use ShaderAlbedoParts instead.\r\n */\r\nexport const ShaderAlebdoParts = ShaderAlbedoParts;\r\n\r\nexport class PBRCustomMaterial extends PBRMaterial {\r\n public static ShaderIndexer = 1;\r\n public CustomParts: ShaderAlbedoParts;\r\n _createdShaderName: string;\r\n _customUniform: string[];\r\n _newUniforms: string[];\r\n _newUniformInstances: { [name: string]: any };\r\n _newSamplerInstances: { [name: string]: Texture };\r\n _customAttributes: string[];\r\n\r\n public FragmentShader: string;\r\n public VertexShader: string;\r\n\r\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\r\n if (this._newUniformInstances) {\r\n for (const el in this._newUniformInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"vec2\") {\r\n effect.setVector2(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"vec3\") {\r\n if (this._newUniformInstances[el] instanceof Color3) {\r\n effect.setColor3(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector3(ea[1], this._newUniformInstances[el]);\r\n }\r\n } else if (ea[0] == \"vec4\") {\r\n if (this._newUniformInstances[el] instanceof Color4) {\r\n effect.setDirectColor4(ea[1], this._newUniformInstances[el]);\r\n } else {\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n }\r\n effect.setVector4(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"mat4\") {\r\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\r\n } else if (ea[0] == \"float\") {\r\n effect.setFloat(ea[1], this._newUniformInstances[el]);\r\n }\r\n }\r\n }\r\n if (this._newSamplerInstances) {\r\n for (const el in this._newSamplerInstances) {\r\n const ea = el.toString().split(\"-\");\r\n if (ea[0] == \"sampler2D\" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\r\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\r\n }\r\n }\r\n }\r\n }\r\n\r\n public ReviewUniform(name: string, arr: string[]): string[] {\r\n if (name == \"uniform\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") == -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n if (name == \"sampler\" && this._newUniforms) {\r\n for (let ind = 0; ind < this._newUniforms.length; ind++) {\r\n if (this._customUniform[ind].indexOf(\"sampler\") != -1) {\r\n arr.push(this._newUniforms[ind].replace(/\\[\\d*\\]/g, \"\"));\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n public Builder(\r\n shaderName: string,\r\n uniforms: string[],\r\n uniformBuffers: string[],\r\n samplers: string[],\r\n defines: MaterialDefines | string[],\r\n attributes?: string[],\r\n options?: ICustomShaderNameResolveOptions\r\n ): string {\r\n if (options) {\r\n const currentProcessing = options.processFinalCode;\r\n options.processFinalCode = (type: string, code: string) => {\r\n if (type === \"vertex\") {\r\n return currentProcessing ? currentProcessing(type, code) : code;\r\n }\r\n const sci = new ShaderCodeInliner(code);\r\n sci.inlineToken = \"#define pbr_inline\";\r\n sci.processCode();\r\n return currentProcessing ? currentProcessing(type, sci.code) : sci.code;\r\n };\r\n }\r\n\r\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\r\n attributes.push(...this._customAttributes);\r\n }\r\n\r\n this.ReviewUniform(\"uniform\", uniforms);\r\n this.ReviewUniform(\"sampler\", samplers);\r\n\r\n const name = this._createdShaderName;\r\n\r\n if (Effect.ShadersStore[name + \"VertexShader\"] && Effect.ShadersStore[name + \"PixelShader\"]) {\r\n return name;\r\n }\r\n\r\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader.replace(\"#define CUSTOM_VERTEX_BEGIN\", this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\")\r\n .replace(\r\n \"#define CUSTOM_VERTEX_DEFINITIONS\",\r\n (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\")\r\n )\r\n .replace(\"#define CUSTOM_VERTEX_MAIN_BEGIN\", this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\")\r\n .replace(\"#define CUSTOM_VERTEX_UPDATE_POSITION\", this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\")\r\n .replace(\"#define CUSTOM_VERTEX_UPDATE_NORMAL\", this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\")\r\n .replace(\"#define CUSTOM_VERTEX_MAIN_END\", this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\");\r\n\r\n if (this.CustomParts.Vertex_After_WorldPosComputed) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = Effect.ShadersStore[name + \"VertexShader\"].replace(\r\n \"#define CUSTOM_VERTEX_UPDATE_WORLDPOS\",\r\n this.CustomParts.Vertex_After_WorldPosComputed\r\n );\r\n }\r\n\r\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader.replace(\r\n \"#define CUSTOM_FRAGMENT_BEGIN\",\r\n this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_MAIN_BEGIN\", this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\")\r\n .replace(\r\n \"#define CUSTOM_FRAGMENT_DEFINITIONS\",\r\n (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\")\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\", this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : \"\")\r\n .replace(\"#define CUSTOM_FRAGMENT_UPDATE_ALPHA\", this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\")\r\n .replace(\"#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\", this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\")\r\n .replace(\r\n \"#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\",\r\n this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : \"\"\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\", this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : \"\")\r\n .replace(\r\n \"#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\",\r\n this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : \"\"\r\n )\r\n .replace(\"#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\", this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\")\r\n .replace(\"#define CUSTOM_FRAGMENT_MAIN_END\", this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : \"\");\r\n\r\n if (this.CustomParts.Fragment_Before_Fog) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = Effect.ShadersStore[name + \"PixelShader\"].replace(\r\n \"#define CUSTOM_FRAGMENT_BEFORE_FOG\",\r\n this.CustomParts.Fragment_Before_Fog\r\n );\r\n }\r\n\r\n return name;\r\n }\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.CustomParts = new ShaderAlbedoParts();\r\n this.customShaderNameResolve = this.Builder;\r\n\r\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\r\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\r\n\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore[\"pbrBlockAlbedoOpacity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore[\"pbrBlockReflectivity\"]);\r\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore[\"pbrBlockFinalColorComposition\"]);\r\n\r\n PBRCustomMaterial.ShaderIndexer++;\r\n this._createdShaderName = \"custompbr_\" + PBRCustomMaterial.ShaderIndexer;\r\n }\r\n\r\n protected _afterBind(mesh?: Mesh, effect: Nullable<Effect> = null): void {\r\n if (!effect) {\r\n return;\r\n }\r\n this.AttachAfterBind(mesh, effect);\r\n try {\r\n super._afterBind(mesh, effect);\r\n } catch (e) {}\r\n }\r\n\r\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\r\n if (!this._customUniform) {\r\n this._customUniform = new Array();\r\n this._newUniforms = new Array();\r\n this._newSamplerInstances = {};\r\n this._newUniformInstances = {};\r\n }\r\n if (param) {\r\n if (kind.indexOf(\"sampler\") != -1) {\r\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\r\n } else {\r\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\r\n }\r\n }\r\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\r\n this._newUniforms.push(name);\r\n\r\n return this;\r\n }\r\n\r\n public AddAttribute(name: string): PBRCustomMaterial {\r\n if (!this._customAttributes) {\r\n this._customAttributes = [];\r\n }\r\n\r\n this._customAttributes.push(name);\r\n\r\n return this;\r\n }\r\n\r\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\r\n return this;\r\n }\r\n\r\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Lights = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_Fog = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;\r\n return this;\r\n }\r\n\r\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\r\n return this;\r\n }\r\n\r\n public Fragment_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Fragment_MainEnd = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Begin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Definitions = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainBegin = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\r\n return this;\r\n }\r\n\r\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\r\n return this;\r\n }\r\n\r\n public Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\r\n return this;\r\n }\r\n\r\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\r\n this.CustomParts.Vertex_MainEnd = shaderPart;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PBRCustomMaterial\", PBRCustomMaterial);\r\n"]}
@@ -1,7 +1,9 @@
1
1
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
2
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
2
3
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
3
4
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
4
5
  import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
5
7
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
6
8
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
7
9
  /** @internal */
@@ -1,9 +1,11 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
3
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
4
5
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
5
6
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
6
7
  import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
8
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
7
9
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
8
10
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
9
11
  const name = "firePixelShader";
@@ -19,6 +21,10 @@ uniform sampler2D distortionSampler;uniform sampler2D opacitySampler;
19
21
  varying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;
20
22
  #endif
21
23
  #include<clipPlaneFragmentDeclaration>
24
+ #ifdef LOGARITHMICDEPTH
25
+ #extension GL_EXT_frag_depth : enable
26
+ #endif
27
+ #include<logDepthDeclaration>
22
28
  #include<fogFragmentDeclaration>
23
29
  vec4 bx2(vec4 x)
24
30
  {return vec4(2.0)*x-vec4(1.0);}
@@ -44,6 +50,7 @@ vec3 diffuseBase=vec3(1.0,1.0,1.0);
44
50
  alpha*=vColor.a;
45
51
  #endif
46
52
  vec4 color=vec4(baseColor.rgb,alpha);
53
+ #include<logDepthFragment>
47
54
  #include<fogFragment>
48
55
  gl_FragColor=color;
49
56
  #include<imageProcessingCompatibility>
@@ -1 +1 @@
1
- {"version":3,"file":"fire.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/fire/fire.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,gFAAkE;AAClE,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"firePixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\nuniform sampler2D distortionSampler;uniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{return vec4(2.0)*x-vec4(1.0);}\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.);float alpha=1.0;\n#ifdef DIFFUSE\nconst float distortionAmount0 =0.092;const float distortionAmount1 =0.092;const float distortionAmount2 =0.092;vec2 heightAttenuation=vec2(0.3,0.39);vec4 noise0=texture2D(distortionSampler,vDistortionCoords1);vec4 noise1=texture2D(distortionSampler,vDistortionCoords2);vec4 noise2=texture2D(distortionSampler,vDistortionCoords3);vec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;vec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);vec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;baseColor*=opacityColor;baseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec4 color=vec4(baseColor.rgb,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 firePixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"fire.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/fire/fire.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,gFAAkE;AAClE,uEAAyD;AACzD,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,oEAAsD;AACtD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Cb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"firePixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\nuniform sampler2D distortionSampler;uniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{return vec4(2.0)*x-vec4(1.0);}\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.);float alpha=1.0;\n#ifdef DIFFUSE\nconst float distortionAmount0 =0.092;const float distortionAmount1 =0.092;const float distortionAmount2 =0.092;vec2 heightAttenuation=vec2(0.3,0.39);vec4 noise0=texture2D(distortionSampler,vDistortionCoords1);vec4 noise1=texture2D(distortionSampler,vDistortionCoords2);vec4 noise2=texture2D(distortionSampler,vDistortionCoords3);vec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;vec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);vec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;baseColor*=opacityColor;baseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<logDepthFragment>\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 firePixelShader = { name, shader };\n"]}
@@ -2,11 +2,13 @@ import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
2
2
  import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
3
3
  import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
4
4
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
5
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
5
6
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
6
7
  import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
7
8
  import "@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js";
8
9
  import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
9
10
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
11
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
10
12
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
11
13
  import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
12
14
  /** @internal */
@@ -4,11 +4,13 @@ import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
4
4
  import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
5
5
  import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
6
6
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
7
8
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
8
9
  import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
9
10
  import "@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js";
10
11
  import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
11
12
  import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
13
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
12
14
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
13
15
  import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
14
16
  const name = "fireVertexShader";
@@ -37,6 +39,7 @@ varying vec3 vPositionW;
37
39
  varying vec4 vColor;
38
40
  #endif
39
41
  #include<clipPlaneVertexDeclaration>
42
+ #include<logDepthDeclaration>
40
43
  #include<fogVertexDeclaration>
41
44
  uniform float time;uniform float speed;
42
45
  #ifdef DIFFUSE
@@ -53,6 +56,7 @@ vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;
53
56
  vDiffuseUV=uv;vDiffuseUV.y-=0.2;
54
57
  #endif
55
58
  #include<clipPlaneVertex>
59
+ #include<logDepthVertex>
56
60
  #include<fogVertex>
57
61
  #include<vertexColorMixing>
58
62
  #if defined(POINTSIZE) && !defined(WEBGPU)
@@ -1 +1 @@
1
- {"version":3,"file":"fire.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/fire/fire.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,qEAAuD;AAEvD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,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/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/vertexColorMixing\";\n\nconst name = \"fireVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\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;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\nuniform float time;uniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\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 DIFFUSE\nvDiffuseUV=uv;vDiffuseUV.y-=0.2;\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;vDistortionCoords1.x=uv.x;vDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;vDistortionCoords2.x=uv.x;vDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;vDistortionCoords3.x=uv.x;vDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const fireVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"fire.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/fire/fire.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,uEAAyD;AACzD,wEAA0D;AAC1D,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,kEAAoD;AACpD,6DAA+C;AAC/C,qEAAuD;AAEvD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,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/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/bonesVertex\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/vertexColorMixing\";\n\nconst name = \"fireVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\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;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\nuniform float time;uniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\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 DIFFUSE\nvDiffuseUV=uv;vDiffuseUV.y-=0.2;\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;vDistortionCoords1.x=uv.x;vDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;vDistortionCoords2.x=uv.x;vDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;vDistortionCoords3.x=uv.x;vDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const fireVertexShader = { name, shader };\n"]}
@@ -37,6 +37,7 @@ class FireMaterialDefines extends MaterialDefines {
37
37
  this.INSTANCESCOLOR = false;
38
38
  this.IMAGEPROCESSINGPOSTPROCESS = false;
39
39
  this.SKIPFINALCOLORCLAMP = false;
40
+ this.LOGARITHMICDEPTH = false;
40
41
  this.rebuild();
41
42
  }
42
43
  }
@@ -91,6 +92,7 @@ export class FireMaterial extends PushMaterial {
91
92
  if (defines._areMiscDirty) {
92
93
  defines.POINTSIZE = this.pointsCloud || scene.forcePointsCloud;
93
94
  defines.FOG = scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE && this.fogEnabled;
95
+ defines.LOGARITHMICDEPTH = this._useLogarithmicDepth;
94
96
  }
95
97
  // Values that need to be evaluated on every frame
96
98
  MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);
@@ -132,6 +134,7 @@ export class FireMaterial extends PushMaterial {
132
134
  "vDiffuseInfos",
133
135
  "mBones",
134
136
  "diffuseMatrix",
137
+ "logarithmicDepthConstant",
135
138
  // Fire
136
139
  "time",
137
140
  "speed",
@@ -196,6 +199,10 @@ export class FireMaterial extends PushMaterial {
196
199
  if (this.pointsCloud) {
197
200
  this._activeEffect.setFloat("pointSize", this.pointSize);
198
201
  }
202
+ // Log. depth
203
+ if (this._useLogarithmicDepth) {
204
+ MaterialHelper.BindLogDepth(defines, effect, scene);
205
+ }
199
206
  scene.bindEyePosition(effect);
200
207
  }
201
208
  this._activeEffect.setColor4("vDiffuseColor", this._scaledDiffuse, this.alpha * mesh.visibility);