sebastien пре 6 година
родитељ
комит
fe0ef68f6e
64 измењених фајлова са 112 додато и 3674 уклоњено
  1. 1 1
      .vscode/settings.json
  2. 1 1
      Tools/Gulp/tasks/gulpTasks-libraries.js
  3. 32 14
      dist/preview release/materialsLibrary/babylon.waterMaterial.js
  4. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.js.map
  5. 32 14
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  6. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js.map
  7. 0 61
      gui/src/3D/materials/shaders/fluent.fragment.fx.ts
  8. 0 78
      gui/src/3D/materials/shaders/fluent.vertex.fx.ts
  9. 0 123
      materialsLibrary/src/cell/cell.fragment.fx.ts
  10. 0 87
      materialsLibrary/src/cell/cell.vertex.fx.ts
  11. 3 3
      materialsLibrary/src/cell/cellMaterial.ts
  12. 0 78
      materialsLibrary/src/fire/fire.fragment.fx.ts
  13. 0 80
      materialsLibrary/src/fire/fire.vertex.fx.ts
  14. 3 3
      materialsLibrary/src/fire/fireMaterial.ts
  15. 0 106
      materialsLibrary/src/fur/fur.fragment.fx.ts
  16. 0 147
      materialsLibrary/src/fur/fur.vertex.fx.ts
  17. 3 3
      materialsLibrary/src/fur/furMaterial.ts
  18. 0 87
      materialsLibrary/src/gradient/gradient.fragment.fx.ts
  19. 0 89
      materialsLibrary/src/gradient/gradient.vertex.fx.ts
  20. 3 3
      materialsLibrary/src/gradient/gradientMaterial.ts
  21. 0 92
      materialsLibrary/src/grid/grid.fragment.fx.ts
  22. 0 36
      materialsLibrary/src/grid/grid.vertex.fx.ts
  23. 3 3
      materialsLibrary/src/grid/gridMaterial.ts
  24. 0 116
      materialsLibrary/src/lava/lava.fragment.fx.ts
  25. 0 193
      materialsLibrary/src/lava/lava.vertex.fx.ts
  26. 3 3
      materialsLibrary/src/lava/lavaMaterial.ts
  27. 0 134
      materialsLibrary/src/mix/mix.fragment.fx.ts
  28. 0 88
      materialsLibrary/src/mix/mix.vertex.fx.ts
  29. 3 3
      materialsLibrary/src/mix/mixMaterial.ts
  30. 0 84
      materialsLibrary/src/normal/normal.fragment.fx.ts
  31. 0 87
      materialsLibrary/src/normal/normal.vertex.fx.ts
  32. 3 3
      materialsLibrary/src/normal/normalMaterial.ts
  33. 0 46
      materialsLibrary/src/shadowOnly/shadowOnly.fragment.fx.ts
  34. 0 52
      materialsLibrary/src/shadowOnly/shadowOnly.vertex.fx.ts
  35. 3 3
      materialsLibrary/src/shadowOnly/shadowOnlyMaterial.ts
  36. 0 78
      materialsLibrary/src/simple/simple.fragment.fx.ts
  37. 0 87
      materialsLibrary/src/simple/simple.vertex.fx.ts
  38. 3 3
      materialsLibrary/src/simple/simpleMaterial.ts
  39. 0 133
      materialsLibrary/src/sky/sky.fragment.fx.ts
  40. 0 45
      materialsLibrary/src/sky/sky.vertex.fx.ts
  41. 3 3
      materialsLibrary/src/sky/skyMaterial.ts
  42. 0 147
      materialsLibrary/src/terrain/terrain.fragment.fx.ts
  43. 0 88
      materialsLibrary/src/terrain/terrain.vertex.fx.ts
  44. 3 3
      materialsLibrary/src/terrain/terrainMaterial.ts
  45. 3 3
      materialsLibrary/src/triPlanar/triPlanarMaterial.ts
  46. 0 125
      materialsLibrary/src/triPlanar/triplanar.fragment.fx.ts
  47. 0 96
      materialsLibrary/src/triPlanar/triplanar.vertex.fx.ts
  48. 0 181
      materialsLibrary/src/water/water.fragment.fx.ts
  49. 0 127
      materialsLibrary/src/water/water.vertex.fx.ts
  50. 3 3
      materialsLibrary/src/water/waterMaterial.ts
  51. 2 7
      materialsLibrary/webpack.config.js
  52. 0 45
      postProcessLibrary/src/asciiArt/asciiart.fragment.fx.ts
  53. 0 53
      postProcessLibrary/src/digitalRain/digitalrain.fragment.fx.ts
  54. 0 64
      proceduralTexturesLibrary/src/brick/brickProceduralTexture.fragment.fx.ts
  55. 0 34
      proceduralTexturesLibrary/src/cloud/cloudProceduralTexture.fragment.fx.ts
  56. 0 45
      proceduralTexturesLibrary/src/fire/fireProceduralTexture.fragment.fx.ts
  57. 0 38
      proceduralTexturesLibrary/src/grass/grassProceduralTexture.fragment.fx.ts
  58. 0 79
      proceduralTexturesLibrary/src/marble/marbleProceduralTexture.fragment.fx.ts
  59. 0 31
      proceduralTexturesLibrary/src/normalMap/normalMapProceduralTexture.fragment.fx.ts
  60. 0 91
      proceduralTexturesLibrary/src/perlinNoise/perlinNoiseProceduralTexture.fragment.fx.ts
  61. 0 32
      proceduralTexturesLibrary/src/road/roadProceduralTexture.fragment.fx.ts
  62. 0 61
      proceduralTexturesLibrary/src/starfield/starfieldProceduralTexture.fragment.fx.ts
  63. 0 34
      proceduralTexturesLibrary/src/wood/woodProceduralTexture.fragment.fx.ts
  64. 0 15
      serializers/src/glTF/2.0/shaders/textureTransform.fragment.fx.ts

+ 1 - 1
.vscode/settings.json

@@ -25,7 +25,7 @@
         "**/*.js": {
             "when": "$(basename).ts"
         },
-        "**/*.fx.ts": true,
+        "**/*.fx.ts": false,
     },
     "files.associations": {
         "*.fx": "glsl"

+ 1 - 1
Tools/Gulp/tasks/gulpTasks-libraries.js

@@ -72,7 +72,7 @@ function buildExternalLibraries(settings) {
 
     // Creates the required tasks.
     var tasks = [];
-    for (var library of settings.libraries) {
+    for (let library of settings.libraries) {
         var shaders = function() { return buildShaders(settings); };
         var build = function(cb) { return buildExternalLibrary(library, settings, cb) };
 

Разлика између датотеке није приказан због своје велике величине
+ 32 - 14
dist/preview release/materialsLibrary/babylon.waterMaterial.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.js.map


Разлика између датотеке није приказан због своје велике величине
+ 32 - 14
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js.map


+ 0 - 61
gui/src/3D/materials/shaders/fluent.fragment.fx.ts

@@ -1,61 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'fluentPixelShader';
-let shader = `precision highp float;
-varying vec2 vUV;
-uniform vec4 albedoColor;
-#ifdef INNERGLOW
-uniform vec4 innerGlowColor;
-#endif
-#ifdef BORDER
-varying vec2 scaleInfo;
-uniform float edgeSmoothingValue;
-uniform float borderMinValue;
-#endif
-#ifdef HOVERLIGHT
-varying vec3 worldPosition;
-uniform vec3 hoverPosition;
-uniform vec4 hoverColor;
-uniform float hoverRadius;
-#endif
-#ifdef TEXTURE
-uniform sampler2D albedoSampler;
-#endif
-void main(void) {
-vec3 albedo=albedoColor.rgb;
-float alpha=albedoColor.a;
-#ifdef TEXTURE
-albedo=texture2D(albedoSampler,vUV).rgb;
-#endif
-#ifdef HOVERLIGHT
-float pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;
-albedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);
-#else
-float pointToHover=1.0;
-#endif
-#ifdef BORDER
-float borderPower=10.0;
-float inverseBorderPower=1.0/borderPower;
-vec3 borderColor=albedo*borderPower;
-vec2 distanceToEdge;
-distanceToEdge.x=abs(vUV.x-0.5)*2.0;
-distanceToEdge.y=abs(vUV.y-0.5)*2.0;
-float borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),
-smoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));
-borderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover);
-albedo+=borderColor;
-alpha=max(alpha,borderValue);
-#endif
-#ifdef INNERGLOW
-
-vec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);
-uvGlow=uvGlow*uvGlow;
-uvGlow=uvGlow*uvGlow;
-albedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y);
-#endif
-gl_FragColor=vec4(albedo,alpha);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 78
gui/src/3D/materials/shaders/fluent.vertex.fx.ts

@@ -1,78 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'fluentVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 uv;
-
-uniform mat4 world;
-uniform mat4 viewProjection;
-varying vec2 vUV;
-#ifdef BORDER
-varying vec2 scaleInfo;
-uniform float borderWidth;
-uniform vec3 scaleFactor;
-#endif
-#ifdef HOVERLIGHT
-varying vec3 worldPosition;
-#endif
-void main(void) {
-vUV=uv;
-#ifdef BORDER
-vec3 scale=scaleFactor;
-float minScale=min(min(scale.x,scale.y),scale.z);
-float maxScale=max(max(scale.x,scale.y),scale.z);
-float minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);
-float areaYZ=scale.y*scale.z;
-float areaXZ=scale.x*scale.z;
-float areaXY=scale.x*scale.y;
-float scaledBorderWidth=borderWidth;
-if (abs(normal.x) == 1.0)
-{
-scale.x=scale.y;
-scale.y=scale.z;
-if (areaYZ>areaXZ && areaYZ>areaXY)
-{
-scaledBorderWidth*=minOverMiddleScale;
-}
-}
-else if (abs(normal.y) == 1.0)
-{
-scale.x=scale.z;
-if (areaXZ>areaXY && areaXZ>areaYZ)
-{
-scaledBorderWidth*=minOverMiddleScale;
-}
-}
-else
-{
-if (areaXY>areaYZ && areaXY>areaXZ)
-{
-scaledBorderWidth*=minOverMiddleScale;
-}
-}
-float scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);
-if (scale.x>scale.y)
-{
-scaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);
-scaleInfo.y=1.0-scaledBorderWidth;
-}
-else
-{
-scaleInfo.x=1.0-scaledBorderWidth;
-scaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);
-}
-#endif
-vec4 worldPos=world*vec4(position,1.0);
-#ifdef HOVERLIGHT
-worldPosition=worldPos.xyz;
-#endif
-gl_Position=viewProjection*worldPos;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 123
materialsLibrary/src/cell/cell.fragment.fx.ts

@@ -1,123 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'cellPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-
-vec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)
-{
-diffuseBase=info.diffuse*shadow;
-#ifdef CELLBASIC
-float level=1.0;
-if (info.ndl<0.5)
-level=0.5;
-diffuseBase.rgb*vec3(level,level,level);
-#else
-float 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])
-{
-diffuseBase.rgb*=ToonBrightnessLevels[0];
-}
-else if (info.ndl>ToonThresholds[1])
-{
-diffuseBase.rgb*=ToonBrightnessLevels[1];
-}
-else if (info.ndl>ToonThresholds[2])
-{
-diffuseBase.rgb*=ToonBrightnessLevels[2];
-}
-else if (info.ndl>ToonThresholds[3])
-{
-diffuseBase.rgb*=ToonBrightnessLevels[3];
-}
-else
-{
-diffuseBase.rgb*=ToonBrightnessLevels[4];
-}
-#endif
-return max(diffuseBase,vec3(0.2));
-}
-void main(void)
-{
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-#ifdef DIFFUSE
-baseColor=texture2D(diffuseSampler,vDiffuseUV);
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-baseColor.rgb*=vDiffuseInfos.y;
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-
-lightingInfo info;
-vec3 diffuseBase=vec3(0.,0.,0.);
-float shadow=1.;
-float glossiness=0.;
-#ifdef SPECULARTERM
-vec3 specularBase=vec3(0.,0.,0.);
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
-
-vec4 color=vec4(finalDiffuse,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 87
materialsLibrary/src/cell/cell.vertex.fx.ts

@@ -1,87 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'cellVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vDiffuseInfos.x == 0.)
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/cell/cellMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, expandToProperty, BaseTexture, serializeAsColor3, Scene, Color3, serialize, AbstractMesh, Nullable, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, expandToProperty, BaseTexture, serializeAsColor3, Scene, Color3, serialize, AbstractMesh, Nullable, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["cellPixelShader"] = require("./cell.fragment.fx");
-Effect.ShadersStore["cellVertexShader"] = require("./cell.vertex.fx");
+import "./cell.fragment.fx";
+import "./cell.vertex.fx";
 
 class CellMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 78
materialsLibrary/src/fire/fire.fragment.fx.ts

@@ -1,78 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'firePixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-
-varying vec3 vPositionW;
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-
-uniform sampler2D distortionSampler;
-uniform sampler2D opacitySampler;
-#ifdef DIFFUSE
-varying vec2 vDistortionCoords1;
-varying vec2 vDistortionCoords2;
-varying vec2 vDistortionCoords3;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-vec4 bx2(vec4 x)
-{
-return vec4(2.0)*x-vec4(1.0);
-}
-void main(void) {
-
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-
-float alpha=1.0;
-#ifdef DIFFUSE
-
-const 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);
-#ifdef ALPHATEST
-if (opacityColor.r<0.1)
-discard;
-#endif
-#include<depthPrePass>
-baseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;
-baseColor*=opacityColor;
-baseColor.rgb*=vDiffuseInfos.y;
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-vec3 diffuseBase=vec3(1.0,1.0,1.0);
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-
-vec4 color=vec4(baseColor.rgb,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 80
materialsLibrary/src/fire/fire.vertex.fx.ts

@@ -1,80 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'fireVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-
-uniform float time;
-uniform float speed;
-#ifdef DIFFUSE
-varying vec2 vDistortionCoords1;
-varying vec2 vDistortionCoords2;
-varying vec2 vDistortionCoords3;
-#endif
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-
-#ifdef DIFFUSE
-vDiffuseUV=uv;
-vDiffuseUV.y-=0.2;
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-#ifdef DIFFUSE
-
-vec3 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;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/fire/fireMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, Nullable, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, Matrix, Mesh, IAnimatable, SerializationHelper, Tags, Texture, } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, Nullable, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, Matrix, Mesh, IAnimatable, SerializationHelper, Tags, Texture, } from "babylonjs";
 
-Effect.ShadersStore["firePixelShader"] = require("./fire.fragment.fx");
-Effect.ShadersStore["fireVertexShader"] = require("./fire.vertex.fx");
+import "./fire.fragment.fx";
+import "./fire.vertex.fx";
 
 class FireMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 106
materialsLibrary/src/fur/fur.fragment.fx.ts

@@ -1,106 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'furPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-
-uniform vec4 furColor;
-uniform float furLength;
-varying vec3 vPositionW;
-varying float vfur_length;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-
-#ifdef HIGHLEVEL
-uniform float furOffset;
-uniform float furOcclusion;
-uniform sampler2D furTexture;
-varying vec2 vFurUV;
-#endif
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-#include<fogFragmentDeclaration>
-#include<clipPlaneFragmentDeclaration>
-float Rand(vec3 rv) {
-float x=dot(rv,vec3(12.9898,78.233,24.65487));
-return fract(sin(x)*43758.5453);
-}
-void main(void) {
-
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=furColor;
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-#ifdef DIFFUSE
-baseColor*=texture2D(diffuseSampler,vDiffuseUV);
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-baseColor.rgb*=vDiffuseInfos.y;
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-#ifdef HIGHLEVEL
-
-vec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));
-if (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {
-discard;
-}
-float occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);
-baseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-float glossiness=0.;
-#ifdef SPECULARTERM
-vec3 specularBase=vec3(0.,0.,0.);
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-vec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);
-
-#ifdef HIGHLEVEL
-vec4 color=vec4(finalDiffuse,alpha);
-#else
-float r=vfur_length/furLength*0.5;
-vec4 color=vec4(finalDiffuse*(0.5+r),alpha);
-#endif
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 147
materialsLibrary/src/fur/fur.vertex.fx.ts

@@ -1,147 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'furVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-attribute vec3 normal;
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-uniform float furLength;
-uniform float furAngle;
-#ifdef HIGHLEVEL
-uniform float furOffset;
-uniform vec3 furGravity;
-uniform float furTime;
-uniform float furSpacing;
-uniform float furDensity;
-#endif
-#ifdef HEIGHTMAP
-uniform sampler2D heightTexture;
-#endif
-#ifdef HIGHLEVEL
-varying vec2 vFurUV;
-#endif
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-varying float vfur_length;
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-float Rand(vec3 rv) {
-float x=dot(rv,vec3(12.9898,78.233,24.65487));
-return fract(sin(x)*43758.5453);
-}
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-
-float r=Rand(position);
-#ifdef HEIGHTMAP
-#if __VERSION__>100
-vfur_length=furLength*texture(heightTexture,uv).x;
-#else
-vfur_length=furLength*texture2D(heightTexture,uv).r;
-#endif
-#else
-vfur_length=(furLength*r);
-#endif
-vec3 tangent1=vec3(normal.y,-normal.x,0);
-vec3 tangent2=vec3(-normal.z,0,normal.x);
-r=Rand(tangent1*r);
-float J=(2.0+4.0*r);
-r=Rand(tangent2*r);
-float K=(2.0+2.0*r);
-tangent1=tangent1*J+tangent2*K;
-tangent1=normalize(tangent1);
-vec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);
-#ifdef HIGHLEVEL
-
-vec3 forceDirection=vec3(0.0,0.0,0.0);
-forceDirection.x=sin(furTime+position.x*0.05)*0.2;
-forceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;
-forceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;
-vec3 displacement=vec3(0.0,0.0,0.0);
-displacement=furGravity+forceDirection;
-float displacementFactor=pow(furOffset,3.0);
-vec3 aNormal=normal;
-aNormal.xyz+=displacement*displacementFactor;
-newPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);
-#endif
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-gl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);
-vec4 worldPos=finalWorld*vec4(newPosition,1.0);
-vPositionW=vec3(worldPos);
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vDiffuseInfos.x == 0.)
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
-}
-#ifdef HIGHLEVEL
-vFurUV=vDiffuseUV*furDensity;
-#endif
-#else
-#ifdef HIGHLEVEL
-vFurUV=uv*furDensity;
-#endif
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/fur/furMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, serializeAsVector3, Vector3, DynamicTexture, AbstractMesh, Scene, Nullable, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper, Texture, Tags } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, serializeAsVector3, Vector3, DynamicTexture, AbstractMesh, Scene, Nullable, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper, Texture, Tags } from "babylonjs";
 
-Effect.ShadersStore["furPixelShader"] = require("./fur.fragment.fx");
-Effect.ShadersStore["furVertexShader"] = require("./fur.vertex.fx");
+import "./fur.fragment.fx";
+import "./fur.vertex.fx";
 
 class FurMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 87
materialsLibrary/src/gradient/gradient.fragment.fx.ts

@@ -1,87 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'gradientPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-
-uniform vec4 topColor;
-uniform vec4 bottomColor;
-uniform float offset;
-uniform float scale;
-uniform float smoothness;
-
-varying vec3 vPositionW;
-varying vec3 vPosition;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0]
-#include<__decl__lightFragment>[1]
-#include<__decl__lightFragment>[2]
-#include<__decl__lightFragment>[3]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-void main(void) {
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-float h=vPosition.y*scale+offset;
-float mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));
-vec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));
-
-vec3 diffuseColor=baseColor.rgb;
-
-float alpha=baseColor.a;
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-float glossiness=0.;
-#include<lightFragment>[0]
-#include<lightFragment>[1]
-#include<lightFragment>[2]
-#include<lightFragment>[3]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
-
-vec4 color=vec4(finalDiffuse,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 89
materialsLibrary/src/gradient/gradient.vertex.fx.ts

@@ -1,89 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'gradientVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-varying vec3 vPosition;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-vPosition=position;
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vDiffuseInfos.x == 0.)
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/gradient/gradientMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serialize, expandToProperty, serializeAsColor3, Color3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serialize, expandToProperty, serializeAsColor3, Color3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["gradientPixelShader"] = require("./gradient.fragment.fx");
-Effect.ShadersStore["gradientVertexShader"] = require("./gradient.vertex.fx");
+import "./gradient.fragment.fx";
+import "./gradient.vertex.fx";
 
 class GradientMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 92
materialsLibrary/src/grid/grid.fragment.fx.ts

@@ -1,92 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'gridPixelShader';
-let shader = `#extension GL_OES_standard_derivatives : enable
-#define SQRT2 1.41421356
-#define PI 3.14159
-precision highp float;
-uniform vec3 mainColor;
-uniform vec3 lineColor;
-uniform vec4 gridControl;
-uniform vec3 gridOffset;
-
-#ifdef TRANSPARENT
-varying vec4 vCameraSpacePosition;
-#endif
-varying vec3 vPosition;
-varying vec3 vNormal;
-#include<fogFragmentDeclaration>
-float getVisibility(float position) {
-
-float majorGridFrequency=gridControl.y;
-if (floor(position+0.5) == floor(position/majorGridFrequency+0.5)*majorGridFrequency)
-{
-return 1.0;
-}
-return gridControl.z;
-}
-float getAnisotropicAttenuation(float differentialLength) {
-const float maxNumberOfLines=10.0;
-return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);
-}
-float isPointOnLine(float position,float differentialLength) {
-float fractionPartOfPosition=position-floor(position+0.5);
-fractionPartOfPosition/=differentialLength;
-fractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);
-float result=0.5+0.5*cos(fractionPartOfPosition*PI);
-return result;
-}
-float contributionOnAxis(float position) {
-float differentialLength=length(vec2(dFdx(position),dFdy(position)));
-differentialLength*=SQRT2;
-
-float result=isPointOnLine(position,differentialLength);
-
-float visibility=getVisibility(position);
-result*=visibility;
-
-float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);
-result*=anisotropicAttenuation;
-return result;
-}
-float normalImpactOnAxis(float x) {
-float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);
-return normalImpact;
-}
-void main(void) {
-
-float gridRatio=gridControl.x;
-vec3 gridPos=(vPosition+gridOffset)/gridRatio;
-
-float x=contributionOnAxis(gridPos.x);
-float y=contributionOnAxis(gridPos.y);
-float z=contributionOnAxis(gridPos.z);
-
-vec3 normal=normalize(vNormal);
-x*=normalImpactOnAxis(normal.x);
-y*=normalImpactOnAxis(normal.y);
-z*=normalImpactOnAxis(normal.z);
-
-float grid=clamp(x+y+z,0.,1.);
-
-vec3 color=mix(mainColor,lineColor,grid);
-#ifdef FOG
-#include<fogFragment>
-#endif
-#ifdef TRANSPARENT
-float distanceToFragment=length(vCameraSpacePosition.xyz);
-float cameraPassThrough=clamp(distanceToFragment-0.25,0.0,1.0);
-float opacity=clamp(grid,0.08,cameraPassThrough*gridControl.w*grid);
-gl_FragColor=vec4(color.rgb,opacity);
-#ifdef PREMULTIPLYALPHA
-gl_FragColor.rgb*=opacity;
-#endif
-#else
-
-gl_FragColor=vec4(color.rgb,1.0);
-#endif
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 36
materialsLibrary/src/grid/grid.vertex.fx.ts

@@ -1,36 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'gridVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-attribute vec3 normal;
-
-uniform mat4 projection;
-uniform mat4 world;
-uniform mat4 view;
-uniform mat4 worldView;
-
-#ifdef TRANSPARENT
-varying vec4 vCameraSpacePosition;
-#endif
-varying vec3 vPosition;
-varying vec3 vNormal;
-#include<fogVertexDeclaration>
-void main(void) {
-#ifdef FOG
-vec4 worldPos=world*vec4(position,1.0);
-#endif
-#include<fogVertex>
-vec4 cameraSpacePosition=worldView*vec4(position,1.0);
-gl_Position=projection*cameraSpacePosition;
-#ifdef TRANSPARENT
-vCameraSpacePosition=cameraSpacePosition;
-#endif
-vPosition=position;
-vNormal=normal;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/grid/gridMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, serializeAsColor3, Color3, serialize, Vector3, Vector4, Scene, AbstractMesh, SubMesh, MaterialHelper, VertexBuffer, Matrix, Mesh, SerializationHelper } from "babylonjs";
+import { MaterialDefines, serializeAsColor3, Color3, serialize, Vector3, Vector4, Scene, AbstractMesh, SubMesh, MaterialHelper, VertexBuffer, Matrix, Mesh, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["gridPixelShader"] = require("./grid.fragment.fx");
-Effect.ShadersStore["gridVertexShader"] = require("./grid.vertex.fx");
+import "./grid.fragment.fx";
+import "./grid.vertex.fx";
 
 class GridMaterialDefines extends MaterialDefines {
     public TRANSPARENT = false;

+ 0 - 116
materialsLibrary/src/lava/lava.fragment.fx.ts

@@ -1,116 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'lavaPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-
-varying vec3 vPositionW;
-
-uniform float time;
-uniform float speed;
-uniform float movingSpeed;
-uniform vec3 fogColor;
-uniform sampler2D noiseTexture;
-uniform float fogDensity;
-
-varying float noise;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0]
-#include<__decl__lightFragment>[1]
-#include<__decl__lightFragment>[2]
-#include<__decl__lightFragment>[3]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-float random( vec3 scale,float seed ){
-return fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;
-}
-void main(void) {
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-#ifdef DIFFUSE
-
-vec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );
-vec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time*0.02;
-vec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;
-T1.x+=noiseTex.x*2.0;
-T1.y+=noiseTex.y*2.0;
-T2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;
-T2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;
-float p=texture2D( noiseTexture,T1*3.0 ).a;
-vec4 lavaColor=texture2D( diffuseSampler,T2*4.0);
-vec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );
-baseColor=temp;
-float depth=gl_FragCoord.z*4.0;
-const float LOG2=1.442695;
-float fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );
-fogFactor=1.0-clamp( fogFactor,0.0,1.0 );
-baseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );
-diffuseColor=baseColor.rgb;
-
-
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-baseColor.rgb*=vDiffuseInfos.y;
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-#ifdef UNLIT
-vec3 diffuseBase=vec3(1.,1.,1.);
-#else
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-float glossiness=0.;
-#include<lightFragment>[0]
-#include<lightFragment>[1]
-#include<lightFragment>[2]
-#include<lightFragment>[3]
-#endif
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
-
-vec4 color=vec4(finalDiffuse,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 193
materialsLibrary/src/lava/lava.vertex.fx.ts

@@ -1,193 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'lavaVertexShader';
-let shader = `precision highp float;
-
-uniform float time;
-uniform float lowFrequencySpeed;
-
-varying float noise;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-
-
-
-vec3 mod289(vec3 x)
-{
-return x-floor(x*(1.0/289.0))*289.0;
-}
-vec4 mod289(vec4 x)
-{
-return x-floor(x*(1.0/289.0))*289.0;
-}
-vec4 permute(vec4 x)
-{
-return mod289(((x*34.0)+1.0)*x);
-}
-vec4 taylorInvSqrt(vec4 r)
-{
-return 1.79284291400159-0.85373472095314*r;
-}
-vec3 fade(vec3 t) {
-return t*t*t*(t*(t*6.0-15.0)+10.0);
-}
-
-float pnoise(vec3 P,vec3 rep)
-{
-vec3 Pi0=mod(floor(P),rep);
-vec3 Pi1=mod(Pi0+vec3(1.0),rep);
-Pi0=mod289(Pi0);
-Pi1=mod289(Pi1);
-vec3 Pf0=fract(P);
-vec3 Pf1=Pf0-vec3(1.0);
-vec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);
-vec4 iy=vec4(Pi0.yy,Pi1.yy);
-vec4 iz0=Pi0.zzzz;
-vec4 iz1=Pi1.zzzz;
-vec4 ixy=permute(permute(ix)+iy);
-vec4 ixy0=permute(ixy+iz0);
-vec4 ixy1=permute(ixy+iz1);
-vec4 gx0=ixy0*(1.0/7.0);
-vec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;
-gx0=fract(gx0);
-vec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);
-vec4 sz0=step(gz0,vec4(0.0));
-gx0-=sz0*(step(0.0,gx0)-0.5);
-gy0-=sz0*(step(0.0,gy0)-0.5);
-vec4 gx1=ixy1*(1.0/7.0);
-vec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;
-gx1=fract(gx1);
-vec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);
-vec4 sz1=step(gz1,vec4(0.0));
-gx1-=sz1*(step(0.0,gx1)-0.5);
-gy1-=sz1*(step(0.0,gy1)-0.5);
-vec3 g000=vec3(gx0.x,gy0.x,gz0.x);
-vec3 g100=vec3(gx0.y,gy0.y,gz0.y);
-vec3 g010=vec3(gx0.z,gy0.z,gz0.z);
-vec3 g110=vec3(gx0.w,gy0.w,gz0.w);
-vec3 g001=vec3(gx1.x,gy1.x,gz1.x);
-vec3 g101=vec3(gx1.y,gy1.y,gz1.y);
-vec3 g011=vec3(gx1.z,gy1.z,gz1.z);
-vec3 g111=vec3(gx1.w,gy1.w,gz1.w);
-vec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));
-g000*=norm0.x;
-g010*=norm0.y;
-g100*=norm0.z;
-g110*=norm0.w;
-vec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));
-g001*=norm1.x;
-g011*=norm1.y;
-g101*=norm1.z;
-g111*=norm1.w;
-float n000=dot(g000,Pf0);
-float n100=dot(g100,vec3(Pf1.x,Pf0.yz));
-float n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));
-float n110=dot(g110,vec3(Pf1.xy,Pf0.z));
-float n001=dot(g001,vec3(Pf0.xy,Pf1.z));
-float n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));
-float n011=dot(g011,vec3(Pf0.x,Pf1.yz));
-float n111=dot(g111,Pf1);
-vec3 fade_xyz=fade(Pf0);
-vec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);
-vec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);
-float n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);
-return 2.2*n_xyz;
-}
-
-float turbulence( vec3 p ) {
-float w=100.0;
-float t=-.5;
-for (float f=1.0 ; f<=10.0 ; f++ ){
-float power=pow( 2.0,f );
-t+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );
-}
-return t;
-}
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-#ifdef NORMAL
-
-noise=10.0*-.10*turbulence( .5*normal+time*1.15 );
-
-float b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );
-
-float displacement =-1.5*noise+b;
-
-vec3 newPosition=position+normal*displacement;
-gl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );
-vec4 worldPos=finalWorld*vec4(newPosition,1.0);
-vPositionW=vec3(worldPos);
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vDiffuseInfos.x == 0.)
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/lava/lavaMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["lavaPixelShader"] = require("./lava.fragment.fx");
-Effect.ShadersStore["lavaVertexShader"] = require("./lava.vertex.fx");
+import "./lava.fragment.fx";
+import "./lava.vertex.fx";
 
 class LavaMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 134
materialsLibrary/src/mix/mix.fragment.fx.ts

@@ -1,134 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'mixPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-#ifdef SPECULARTERM
-uniform vec4 vSpecularColor;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-
-#ifdef DIFFUSE
-varying vec2 vTextureUV;
-uniform sampler2D mixMap1Sampler;
-uniform vec2 vTextureInfos;
-#ifdef MIXMAP2
-uniform sampler2D mixMap2Sampler;
-#endif
-uniform sampler2D diffuse1Sampler;
-uniform sampler2D diffuse2Sampler;
-uniform sampler2D diffuse3Sampler;
-uniform sampler2D diffuse4Sampler;
-uniform vec2 diffuse1Infos;
-uniform vec2 diffuse2Infos;
-uniform vec2 diffuse3Infos;
-uniform vec2 diffuse4Infos;
-#ifdef MIXMAP2
-uniform sampler2D diffuse5Sampler;
-uniform sampler2D diffuse6Sampler;
-uniform sampler2D diffuse7Sampler;
-uniform sampler2D diffuse8Sampler;
-uniform vec2 diffuse5Infos;
-uniform vec2 diffuse6Infos;
-uniform vec2 diffuse7Infos;
-uniform vec2 diffuse8Infos;
-#endif
-#endif
-
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-void main(void) {
-
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 finalMixColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-#ifdef MIXMAP2
-vec4 mixColor2=vec4(1.,1.,1.,1.);
-#endif
-#ifdef SPECULARTERM
-float glossiness=vSpecularColor.a;
-vec3 specularColor=vSpecularColor.rgb;
-#else
-float glossiness=0.;
-#endif
-
-float alpha=vDiffuseColor.a;
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-#ifdef DIFFUSE
-vec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);
-#include<depthPrePass>
-mixColor.rgb*=vTextureInfos.y;
-vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);
-vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);
-vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);
-vec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);
-diffuse1Color.rgb*=mixColor.r;
-diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);
-diffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);
-finalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);
-#ifdef MIXMAP2
-mixColor=texture2D(mixMap2Sampler,vTextureUV);
-mixColor.rgb*=vTextureInfos.y;
-vec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);
-vec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);
-vec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);
-vec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);
-diffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);
-diffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);
-diffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);
-finalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);
-#endif
-#endif
-#ifdef VERTEXCOLOR
-finalMixColor.rgb*=vColor.rgb;
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-#ifdef SPECULARTERM
-vec3 specularBase=vec3(0.,0.,0.);
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-#ifdef SPECULARTERM
-vec3 finalSpecular=specularBase*specularColor;
-#else
-vec3 finalSpecular=vec3(0.0);
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);
-
-vec4 color=vec4(finalDiffuse+finalSpecular,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 88
materialsLibrary/src/mix/mix.vertex.fx.ts

@@ -1,88 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'mixVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vTextureUV;
-uniform mat4 textureMatrix;
-uniform vec2 vTextureInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vTextureInfos.x == 0.)
-{
-vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/mix/mixMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, Texture, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, Texture, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["mixPixelShader"] = require("./mix.fragment.fx");
-Effect.ShadersStore["mixVertexShader"] = require("./mix.vertex.fx");
+import "./mix.fragment.fx";
+import "./mix.vertex.fx";
 
 class MixMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 84
materialsLibrary/src/normal/normal.fragment.fx.ts

@@ -1,84 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'normalPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0]
-#include<__decl__lightFragment>[1]
-#include<__decl__lightFragment>[2]
-#include<__decl__lightFragment>[3]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-void main(void) {
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-#ifdef DIFFUSE
-baseColor=texture2D(diffuseSampler,vDiffuseUV);
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-baseColor.rgb*=vDiffuseInfos.y;
-#endif
-#ifdef NORMAL
-baseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-float glossiness=0.;
-#include<lightFragment>[0]
-#include<lightFragment>[1]
-#include<lightFragment>[2]
-#include<lightFragment>[3]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
-
-vec4 color=vec4(finalDiffuse,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 87
materialsLibrary/src/normal/normal.vertex.fx.ts

@@ -1,87 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'normalVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vDiffuseInfos.x == 0.)
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/normal/normalMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["normalPixelShader"] = require("./normal.fragment.fx");
-Effect.ShadersStore["normalVertexShader"] = require("./normal.vertex.fx");
+import "./normal.fragment.fx";
+import "./normal.vertex.fx";
 
 class NormalMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 46
materialsLibrary/src/shadowOnly/shadowOnly.fragment.fx.ts

@@ -1,46 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'shadowOnlyPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform float alpha;
-uniform vec3 shadowColor;
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-void main(void) {
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-float glossiness=0.;
-#include<lightFragment>[0..1]
-
-vec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 52
materialsLibrary/src/shadowOnly/shadowOnly.vertex.fx.ts

@@ -1,52 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'shadowOnlyVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/shadowOnly/shadowOnlyMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, IShadowLight, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, IShadowLight, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["shadowOnlyPixelShader"] = require("./shadowOnly.fragment.fx");
-Effect.ShadersStore["shadowOnlyVertexShader"] = require("./shadowOnly.vertex.fx");
+import "./shadowOnly.fragment.fx";
+import "./shadowOnly.vertex.fx";
 
 class ShadowOnlyMaterialDefines extends MaterialDefines {
     public CLIPPLANE = false;

+ 0 - 78
materialsLibrary/src/simple/simple.fragment.fx.ts

@@ -1,78 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'simplePixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-void main(void) {
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-#ifdef DIFFUSE
-baseColor=texture2D(diffuseSampler,vDiffuseUV);
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-baseColor.rgb*=vDiffuseInfos.y;
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-float glossiness=0.;
-#ifdef SPECULARTERM
-vec3 specularBase=vec3(0.,0.,0.);
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
-
-vec4 color=vec4(finalDiffuse,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 87
materialsLibrary/src/simple/simple.vertex.fx.ts

@@ -1,87 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'simpleVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vDiffuseInfos.x == 0.)
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/simple/simpleMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["simplePixelShader"] = require("./simple.fragment.fx");
-Effect.ShadersStore["simpleVertexShader"] = require("./simple.vertex.fx");
+import "./simple.fragment.fx";
+import "./simple.vertex.fx";
 
 class SimpleMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 0 - 133
materialsLibrary/src/sky/sky.fragment.fx.ts

@@ -1,133 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'skyPixelShader';
-let shader = `precision highp float;
-
-varying vec3 vPositionW;
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneFragmentDeclaration>
-
-uniform vec3 cameraPosition;
-uniform float luminance;
-uniform float turbidity;
-uniform float rayleigh;
-uniform float mieCoefficient;
-uniform float mieDirectionalG;
-uniform vec3 sunPosition;
-
-#include<fogFragmentDeclaration>
-
-const float e=2.71828182845904523536028747135266249775724709369995957;
-const float pi=3.141592653589793238462643383279502884197169;
-const float n=1.0003;
-const float N=2.545E25;
-const float pn=0.035;
-const vec3 lambda=vec3(680E-9,550E-9,450E-9);
-const vec3 K=vec3(0.686,0.678,0.666);
-const float v=4.0;
-const float rayleighZenithLength=8.4E3;
-const float mieZenithLength=1.25E3;
-const vec3 up=vec3(0.0,1.0,0.0);
-const float EE=1000.0;
-const float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;
-const float cutoffAngle=pi/1.95;
-const float steepness=1.5;
-vec3 totalRayleigh(vec3 lambda)
-{
-return (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));
-}
-vec3 simplifiedRayleigh()
-{
-return 0.0005/vec3(94,40,18);
-}
-float rayleighPhase(float cosTheta)
-{
-return (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));
-}
-vec3 totalMie(vec3 lambda,vec3 K,float T)
-{
-float c=(0.2*T )*10E-18;
-return 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;
-}
-float hgPhase(float cosTheta,float g)
-{
-return (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));
-}
-float sunIntensity(float zenithAngleCos)
-{
-return EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));
-}
-float A=0.15;
-float B=0.50;
-float C=0.10;
-float D=0.20;
-float EEE=0.02;
-float F=0.30;
-float W=1000.0;
-vec3 Uncharted2Tonemap(vec3 x)
-{
-return ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;
-}
-void main(void) {
-
-#include<clipPlaneFragment>
-
-float sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);
-float rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));
-vec3 sunDirection=normalize(sunPosition);
-float sunE=sunIntensity(dot(sunDirection,up));
-vec3 betaR=simplifiedRayleigh()*rayleighCoefficient;
-vec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;
-float zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition))));
-float sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));
-float sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));
-vec3 Fex=exp(-(betaR*sR+betaM*sM));
-float cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);
-float rPhase=rayleighPhase(cosTheta*0.5+0.5);
-vec3 betaRTheta=betaR*rPhase;
-float mPhase=hgPhase(cosTheta,mieDirectionalG);
-vec3 betaMTheta=betaM*mPhase;
-vec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));
-Lin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));
-vec3 direction=normalize(vPositionW-cameraPosition);
-float theta=acos(direction.y);
-float phi=atan(direction.z,direction.x);
-vec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);
-vec3 L0=vec3(0.1)*Fex;
-float sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);
-L0+=(sunE*19000.0*Fex)*sundisk;
-vec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));
-vec3 texColor=(Lin+L0);
-texColor*=0.04 ;
-texColor+=vec3(0.0,0.001,0.0025)*0.3;
-float g_fMaxLuminance=1.0;
-float fLumScaled=0.1/luminance;
-float fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled);
-float ExposureBias=fLumCompressed;
-vec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);
-
-
-
-vec3 retColor=curr*whiteScale;
-
-
-float alpha=1.0;
-#ifdef VERTEXCOLOR
-retColor.rgb*=vColor.rgb;
-#endif
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-
-vec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);
-
-#include<fogFragment>
-gl_FragColor=color;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 45
materialsLibrary/src/sky/sky.vertex.fx.ts

@@ -1,45 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'skyVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-
-uniform mat4 world;
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-void main(void) {
-gl_Position=viewProjection*world*vec4(position,1.0);
-vec4 worldPos=world*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/sky/skyMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serialize, serializeAsVector3, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serialize, serializeAsVector3, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, MaterialHelper, EffectFallbacks, VertexBuffer, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["skyPixelShader"] = require("./sky.fragment.fx");
-Effect.ShadersStore["skyVertexShader"] = require("./sky.vertex.fx");
+import "./sky.fragment.fx";
+import "./sky.vertex.fx";
 
 class SkyMaterialDefines extends MaterialDefines {
     public CLIPPLANE = false;

+ 0 - 147
materialsLibrary/src/terrain/terrain.fragment.fx.ts

@@ -1,147 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'terrainPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-#ifdef SPECULARTERM
-uniform vec4 vSpecularColor;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-
-#ifdef DIFFUSE
-varying vec2 vTextureUV;
-uniform sampler2D textureSampler;
-uniform vec2 vTextureInfos;
-uniform sampler2D diffuse1Sampler;
-uniform sampler2D diffuse2Sampler;
-uniform sampler2D diffuse3Sampler;
-uniform vec2 diffuse1Infos;
-uniform vec2 diffuse2Infos;
-uniform vec2 diffuse3Infos;
-#endif
-#ifdef BUMP
-uniform sampler2D bump1Sampler;
-uniform sampler2D bump2Sampler;
-uniform sampler2D bump3Sampler;
-#endif
-
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-#include<clipPlaneFragmentDeclaration>
-
-#include<fogFragmentDeclaration>
-
-#ifdef BUMP
-#extension GL_OES_standard_derivatives : enable
-
-mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)
-{
-
-vec3 dp1=dFdx(p);
-vec3 dp2=dFdy(p);
-vec2 duv1=dFdx(uv);
-vec2 duv2=dFdy(uv);
-
-vec3 dp2perp=cross(dp2,normal);
-vec3 dp1perp=cross(normal,dp1);
-vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;
-vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;
-
-float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));
-return mat3(tangent*invmax,binormal*invmax,normal);
-}
-vec3 perturbNormal(vec3 viewDir,vec3 mixColor)
-{
-vec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;
-vec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;
-vec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;
-bump1Color.rgb*=mixColor.r;
-bump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);
-vec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);
-map=map*255./127.-128./127.;
-mat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);
-return normalize(TBN*map);
-}
-#endif
-void main(void) {
-
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-#ifdef SPECULARTERM
-float glossiness=vSpecularColor.a;
-vec3 specularColor=vSpecularColor.rgb;
-#else
-float glossiness=0.;
-#endif
-
-float alpha=vDiffuseColor.a;
-
-#ifdef NORMAL
-vec3 normalW=normalize(vNormalW);
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-#ifdef DIFFUSE
-baseColor=texture2D(textureSampler,vTextureUV);
-#if defined(BUMP) && defined(DIFFUSE)
-normalW=perturbNormal(viewDirectionW,baseColor.rgb);
-#endif
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-baseColor.rgb*=vTextureInfos.y;
-vec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);
-vec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);
-vec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);
-diffuse1Color.rgb*=baseColor.r;
-diffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);
-baseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-#ifdef SPECULARTERM
-vec3 specularBase=vec3(0.,0.,0.);
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-#ifdef SPECULARTERM
-vec3 finalSpecular=specularBase*specularColor;
-#else
-vec3 finalSpecular=vec3(0.0);
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);
-
-vec4 color=vec4(finalDiffuse+finalSpecular,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 88
materialsLibrary/src/terrain/terrain.vertex.fx.ts

@@ -1,88 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'terrainVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSE
-varying vec2 vTextureUV;
-uniform mat4 textureMatrix;
-uniform vec2 vTextureInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef DIFFUSE
-if (vTextureInfos.x == 0.)
-{
-vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));
-}
-else
-{
-vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/terrain/terrainMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, Texture, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, Texture, serializeAsColor3, Color3, serialize, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["terrainPixelShader"] = require("./terrain.fragment.fx");
-Effect.ShadersStore["terrainVertexShader"] = require("./terrain.vertex.fx");
+import "./terrain.fragment.fx";
+import "./terrain.vertex.fx";
 
 class TerrainMaterialDefines extends MaterialDefines {
     public DIFFUSE = false;

+ 3 - 3
materialsLibrary/src/triPlanar/triPlanarMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serialize, serializeAsColor3, Color3, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serialize, serializeAsColor3, Color3, Scene, Nullable, AbstractMesh, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Matrix, Mesh, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["triPlanarPixelShader"] = require("./triplanar.fragment.fx");
-Effect.ShadersStore["triPlanarVertexShader"] = require("./triplanar.vertex.fx");
+import "./triplanar.fragment.fx";
+import "./triplanar.vertex.fx";
 
 class TriPlanarMaterialDefines extends MaterialDefines {
     public DIFFUSEX = false;

+ 0 - 125
materialsLibrary/src/triPlanar/triplanar.fragment.fx.ts

@@ -1,125 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'triplanarPixelShader';
-let shader = `precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-#ifdef SPECULARTERM
-uniform vec4 vSpecularColor;
-#endif
-
-varying vec3 vPositionW;
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-
-#ifdef DIFFUSEX
-varying vec2 vTextureUVX;
-uniform sampler2D diffuseSamplerX;
-#ifdef BUMPX
-uniform sampler2D normalSamplerX;
-#endif
-#endif
-#ifdef DIFFUSEY
-varying vec2 vTextureUVY;
-uniform sampler2D diffuseSamplerY;
-#ifdef BUMPY
-uniform sampler2D normalSamplerY;
-#endif
-#endif
-#ifdef DIFFUSEZ
-varying vec2 vTextureUVZ;
-uniform sampler2D diffuseSamplerZ;
-#ifdef BUMPZ
-uniform sampler2D normalSamplerZ;
-#endif
-#endif
-#ifdef NORMAL
-varying mat3 tangentSpace;
-#endif
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-#include<clipPlaneFragmentDeclaration>
-#include<fogFragmentDeclaration>
-void main(void) {
-
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(0.,0.,0.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-
-#ifdef NORMAL
-vec3 normalW=tangentSpace[2];
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-#endif
-vec4 baseNormal=vec4(0.0,0.0,0.0,1.0);
-normalW*=normalW;
-#ifdef DIFFUSEX
-baseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;
-#ifdef BUMPX
-baseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;
-#endif
-#endif
-#ifdef DIFFUSEY
-baseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;
-#ifdef BUMPY
-baseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;
-#endif
-#endif
-#ifdef DIFFUSEZ
-baseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;
-#ifdef BUMPZ
-baseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;
-#endif
-#endif
-#ifdef NORMAL
-normalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);
-#endif
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-#include<depthPrePass>
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-#ifdef SPECULARTERM
-float glossiness=vSpecularColor.a;
-vec3 specularBase=vec3(0.,0.,0.);
-vec3 specularColor=vSpecularColor.rgb;
-#else
-float glossiness=0.;
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-#ifdef SPECULARTERM
-vec3 finalSpecular=specularBase*specularColor;
-#else
-vec3 finalSpecular=vec3(0.0);
-#endif
-vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
-
-vec4 color=vec4(finalDiffuse+finalSpecular,alpha);
-#include<fogFragment>
-gl_FragColor=color;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 96
materialsLibrary/src/triPlanar/triplanar.vertex.fx.ts

@@ -1,96 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'triplanarVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef DIFFUSEX
-varying vec2 vTextureUVX;
-#endif
-#ifdef DIFFUSEY
-varying vec2 vTextureUVY;
-#endif
-#ifdef DIFFUSEZ
-varying vec2 vTextureUVZ;
-#endif
-uniform float tileSize;
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying mat3 tangentSpace;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-void main(void)
-{
-#include<instancesVertex>
-#include<bonesVertex>
-gl_Position=viewProjection*finalWorld*vec4(position,1.0);
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef DIFFUSEX
-vTextureUVX=worldPos.zy/tileSize;
-#endif
-#ifdef DIFFUSEY
-vTextureUVY=worldPos.xz/tileSize;
-#endif
-#ifdef DIFFUSEZ
-vTextureUVZ=worldPos.xy/tileSize;
-#endif
-#ifdef NORMAL
-
-vec3 xtan=vec3(0,0,1);
-vec3 xbin=vec3(0,1,0);
-vec3 ytan=vec3(1,0,0);
-vec3 ybin=vec3(0,0,1);
-vec3 ztan=vec3(1,0,0);
-vec3 zbin=vec3(0,1,0);
-vec3 normalizedNormal=normalize(normal);
-normalizedNormal*=normalizedNormal;
-vec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);
-vec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);
-worldTangent=(world*vec4(worldTangent,1.0)).xyz;
-worldBinormal=(world*vec4(worldBinormal,1.0)).xyz;
-vec3 worldNormal=normalize(cross(worldTangent,worldBinormal));
-tangentSpace[0]=worldTangent;
-tangentSpace[1]=worldBinormal;
-tangentSpace[2]=worldNormal;
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 181
materialsLibrary/src/water/water.fragment.fx.ts

@@ -1,181 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'waterPixelShader';
-let shader = `#ifdef LOGARITHMICDEPTH
-#extension GL_EXT_frag_depth : enable
-#endif
-precision highp float;
-
-uniform vec3 vEyePosition;
-uniform vec4 vDiffuseColor;
-#ifdef SPECULARTERM
-uniform vec4 vSpecularColor;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-
-#include<helperFunctions>
-
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-#include<lightsFragmentFunctions>
-#include<shadowsFragmentFunctions>
-
-#ifdef BUMP
-varying vec2 vNormalUV;
-varying vec2 vNormalUV2;
-uniform sampler2D normalSampler;
-uniform vec2 vNormalInfos;
-#endif
-uniform sampler2D refractionSampler;
-uniform sampler2D reflectionSampler;
-
-const float LOG2=1.442695;
-uniform vec3 cameraPosition;
-uniform vec4 waterColor;
-uniform float colorBlendFactor;
-uniform vec4 waterColor2;
-uniform float colorBlendFactor2;
-uniform float bumpHeight;
-uniform float time;
-
-varying vec3 vRefractionMapTexCoord;
-varying vec3 vReflectionMapTexCoord;
-varying vec3 vPosition;
-#include<clipPlaneFragmentDeclaration>
-#include<logDepthDeclaration>
-
-#include<fogFragmentDeclaration>
-void main(void) {
-
-#include<clipPlaneFragment>
-vec3 viewDirectionW=normalize(vEyePosition-vPositionW);
-
-vec4 baseColor=vec4(1.,1.,1.,1.);
-vec3 diffuseColor=vDiffuseColor.rgb;
-
-float alpha=vDiffuseColor.a;
-#ifdef BUMP
-#ifdef BUMPSUPERIMPOSE
-baseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));
-#else
-baseColor=texture2D(normalSampler,vNormalUV);
-#endif
-vec3 bumpColor=baseColor.rgb;
-#ifdef ALPHATEST
-if (baseColor.a<0.4)
-discard;
-#endif
-baseColor.rgb*=vNormalInfos.y;
-#else
-vec3 bumpColor=vec3(1.0);
-#endif
-#ifdef VERTEXCOLOR
-baseColor.rgb*=vColor.rgb;
-#endif
-
-#ifdef NORMAL
-vec2 perturbation=bumpHeight*(baseColor.rg-0.5);
-#ifdef BUMPAFFECTSREFLECTION
-vec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));
-if (normalW.y<0.0) {
-normalW.y=-normalW.y;
-}
-#else
-vec3 normalW=normalize(vNormalW);
-#endif
-#else
-vec3 normalW=vec3(1.0,1.0,1.0);
-vec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);
-#endif
-#ifdef FRESNELSEPARATE
-#ifdef REFLECTION
-
-vec3 eyeVector=normalize(vEyePosition-vPosition);
-vec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);
-vec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);
-vec2 projectedReflectionTexCoords=clamp(vec2(
-vReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,
-vReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y
-),0.0,1.0);
-vec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);
-vec3 upVector=vec3(0.0,1.0,0.0);
-float fresnelTerm=clamp(abs(pow(dot(eyeVector,upVector),3.0)),0.05,0.65);
-float IfresnelTerm=1.0-fresnelTerm;
-refractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;
-reflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;
-vec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;
-baseColor=combinedColor;
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-#ifdef SPECULARTERM
-float glossiness=vSpecularColor.a;
-vec3 specularBase=vec3(0.,0.,0.);
-vec3 specularColor=vSpecularColor.rgb;
-#else
-float glossiness=0.;
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-vec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-#ifdef SPECULARTERM
-vec3 finalSpecular=specularBase*specularColor;
-#else
-vec3 finalSpecular=vec3(0.0);
-#endif
-#else
-#ifdef REFLECTION
-
-vec3 eyeVector=normalize(vEyePosition-vPosition);
-vec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);
-vec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);
-vec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);
-vec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);
-vec3 upVector=vec3(0.0,1.0,0.0);
-float fresnelTerm=max(dot(eyeVector,upVector),0.0);
-vec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);
-baseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;
-#endif
-
-vec3 diffuseBase=vec3(0.,0.,0.);
-lightingInfo info;
-float shadow=1.;
-#ifdef SPECULARTERM
-float glossiness=vSpecularColor.a;
-vec3 specularBase=vec3(0.,0.,0.);
-vec3 specularColor=vSpecularColor.rgb;
-#else
-float glossiness=0.;
-#endif
-#include<lightFragment>[0..maxSimultaneousLights]
-vec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);
-#ifdef VERTEXALPHA
-alpha*=vColor.a;
-#endif
-#ifdef SPECULARTERM
-vec3 finalSpecular=specularBase*specularColor;
-#else
-vec3 finalSpecular=vec3(0.0);
-#endif
-#endif
-
-vec4 color=vec4(finalDiffuse+finalSpecular,alpha);
-#include<logDepthFragment>
-#include<fogFragment>
-gl_FragColor=color;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 127
materialsLibrary/src/water/water.vertex.fx.ts

@@ -1,127 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'waterVertexShader';
-let shader = `precision highp float;
-
-attribute vec3 position;
-#ifdef NORMAL
-attribute vec3 normal;
-#endif
-#ifdef UV1
-attribute vec2 uv;
-#endif
-#ifdef UV2
-attribute vec2 uv2;
-#endif
-#ifdef VERTEXCOLOR
-attribute vec4 color;
-#endif
-#include<bonesDeclaration>
-
-#include<instancesDeclaration>
-uniform mat4 view;
-uniform mat4 viewProjection;
-#ifdef BUMP
-varying vec2 vNormalUV;
-#ifdef BUMPSUPERIMPOSE
-varying vec2 vNormalUV2;
-#endif
-uniform mat4 normalMatrix;
-uniform vec2 vNormalInfos;
-#endif
-#ifdef POINTSIZE
-uniform float pointSize;
-#endif
-
-varying vec3 vPositionW;
-#ifdef NORMAL
-varying vec3 vNormalW;
-#endif
-#ifdef VERTEXCOLOR
-varying vec4 vColor;
-#endif
-#include<clipPlaneVertexDeclaration>
-#include<fogVertexDeclaration>
-#include<__decl__lightFragment>[0..maxSimultaneousLights]
-#include<logDepthDeclaration>
-
-uniform mat4 worldReflectionViewProjection;
-uniform vec2 windDirection;
-uniform float waveLength;
-uniform float time;
-uniform float windForce;
-uniform float waveHeight;
-uniform float waveSpeed;
-
-varying vec3 vPosition;
-varying vec3 vRefractionMapTexCoord;
-varying vec3 vReflectionMapTexCoord;
-void main(void) {
-#include<instancesVertex>
-#include<bonesVertex>
-vec4 worldPos=finalWorld*vec4(position,1.0);
-vPositionW=vec3(worldPos);
-#ifdef NORMAL
-vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
-#endif
-
-#ifndef UV1
-vec2 uv=vec2(0.,0.);
-#endif
-#ifndef UV2
-vec2 uv2=vec2(0.,0.);
-#endif
-#ifdef BUMP
-if (vNormalInfos.x == 0.)
-{
-vNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));
-#ifdef BUMPSUPERIMPOSE
-vNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));
-#endif
-}
-else
-{
-vNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));
-#ifdef BUMPSUPERIMPOSE
-vNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));
-#endif
-}
-#endif
-
-#include<clipPlaneVertex>
-
-#include<fogVertex>
-
-#include<shadowsVertex>[0..maxSimultaneousLights]
-
-#ifdef VERTEXCOLOR
-vColor=color;
-#endif
-
-#ifdef POINTSIZE
-gl_PointSize=pointSize;
-#endif
-vec3 p=position;
-float newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)
-+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);
-p.y+=abs(newY);
-gl_Position=viewProjection*finalWorld*vec4(p,1.0);
-#ifdef REFLECTION
-worldPos=viewProjection*finalWorld*vec4(p,1.0);
-
-vPosition=position;
-vRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);
-vRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);
-vRefractionMapTexCoord.z=worldPos.w;
-worldPos=worldReflectionViewProjection*vec4(position,1.0);
-vReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);
-vReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);
-vReflectionMapTexCoord.z=worldPos.w;
-#endif
-#include<logDepthVertex>
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 3 - 3
materialsLibrary/src/water/waterMaterial.ts

@@ -1,7 +1,7 @@
-import { Effect, MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, serializeAsVector2, Vector2, SmartArray, RenderTargetTexture, Nullable, AbstractMesh, Matrix, Scene, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Mesh, Plane, Vector3, Camera, IAnimatable, SerializationHelper } from "babylonjs";
+import { MaterialDefines, PushMaterial, serializeAsTexture, BaseTexture, expandToProperty, serializeAsColor3, Color3, serialize, serializeAsVector2, Vector2, SmartArray, RenderTargetTexture, Nullable, AbstractMesh, Matrix, Scene, SubMesh, StandardMaterial, MaterialHelper, EffectFallbacks, VertexBuffer, EffectCreationOptions, Mesh, Plane, Vector3, Camera, IAnimatable, SerializationHelper } from "babylonjs";
 
-Effect.ShadersStore["waterPixelShader"] = require("./water.fragment.fx");
-Effect.ShadersStore["waterVertexShader"] = require("./water.vertex.fx");
+import "./water.fragment.fx";
+import "./water.vertex.fx";
 
 class WaterMaterialDefines extends MaterialDefines {
     public BUMP = false;

+ 2 - 7
materialsLibrary/webpack.config.js

@@ -43,12 +43,6 @@ module.exports = {
                     declarationDir: '../../dist/preview release/materialsLibrary/build'
                 }
             }]
-        },
-        {
-            test: /\.fx$/,
-            use: [{
-                loader: path.resolve(__dirname, '../Tools/WebpackShaderLoader/index.js')
-            }]
         }]
     },
     mode: "production",
@@ -65,7 +59,8 @@ module.exports = {
         ]),
         new webpack.WatchIgnorePlugin([
             /\.js$/,
-            /\.d\.ts$/
+            /\.d\.ts$/,
+            /\.fx$/
         ])
     ],
     watchOptions: {

+ 0 - 45
postProcessLibrary/src/asciiArt/asciiart.fragment.fx.ts

@@ -1,45 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'asciiartPixelShader';
-let shader = `
-varying vec2 vUV;
-uniform sampler2D textureSampler;
-uniform sampler2D asciiArtFont;
-
-uniform vec4 asciiArtFontInfos;
-uniform vec4 asciiArtOptions;
-
-float getLuminance(vec3 color)
-{
-return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);
-}
-
-void main(void)
-{
-float caracterSize=asciiArtFontInfos.x;
-float numChar=asciiArtFontInfos.y-1.0;
-float fontx=asciiArtFontInfos.z;
-float fonty=asciiArtFontInfos.w;
-float screenx=asciiArtOptions.x;
-float screeny=asciiArtOptions.y;
-float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;
-float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;
-vec2 tileUV=vec2(tileX,tileY);
-vec4 tileColor=texture2D(textureSampler,tileUV);
-vec4 baseColor=texture2D(textureSampler,vUV);
-float tileLuminance=getLuminance(tileColor.rgb);
-float offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;
-float offsety=0.0;
-float x=float(mod(gl_FragCoord.x,caracterSize))/fontx;
-float y=float(mod(gl_FragCoord.y,caracterSize))/fonty;
-vec4 finalColor=texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));
-finalColor.rgb*=tileColor.rgb;
-finalColor.a=1.0;
-finalColor=mix(finalColor,tileColor,asciiArtOptions.w);
-finalColor=mix(finalColor,baseColor,asciiArtOptions.z);
-gl_FragColor=finalColor;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 53
postProcessLibrary/src/digitalRain/digitalrain.fragment.fx.ts

@@ -1,53 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'digitalrainPixelShader';
-let shader = `
-varying vec2 vUV;
-uniform sampler2D textureSampler;
-uniform sampler2D digitalRainFont;
-
-uniform vec4 digitalRainFontInfos;
-uniform vec4 digitalRainOptions;
-uniform mat4 matrixSpeed;
-uniform float cosTimeZeroOne;
-
-float getLuminance(vec3 color)
-{
-return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);
-}
-
-void main(void)
-{
-float caracterSize=digitalRainFontInfos.x;
-float numChar=digitalRainFontInfos.y-1.0;
-float fontx=digitalRainFontInfos.z;
-float fonty=digitalRainFontInfos.w;
-float screenx=digitalRainOptions.x;
-float screeny=digitalRainOptions.y;
-float ratio=screeny/fonty;
-float columnx=float(floor((gl_FragCoord.x)/caracterSize));
-float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;
-float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;
-vec2 tileUV=vec2(tileX,tileY);
-vec4 tileColor=texture2D(textureSampler,tileUV);
-vec4 baseColor=texture2D(textureSampler,vUV);
-float tileLuminance=getLuminance(tileColor.rgb);
-int st=int(mod(columnx,4.0));
-float speed=cosTimeZeroOne*(sin(tileX*314.5)*0.5+0.6);
-float x=float(mod(gl_FragCoord.x,caracterSize))/fontx;
-float y=float(mod(speed+gl_FragCoord.y/screeny,1.0));
-y*=ratio;
-vec4 finalColor=texture2D(digitalRainFont,vec2(x,1.0-y));
-vec3 high=finalColor.rgb*(vec3(1.2,1.2,1.2)*pow(1.0-y,30.0));
-finalColor.rgb*=vec3(pow(tileLuminance,5.0),pow(tileLuminance,1.5),pow(tileLuminance,3.0));
-finalColor.rgb+=high;
-finalColor.rgb=clamp(finalColor.rgb,0.,1.);
-finalColor.a=1.0;
-finalColor=mix(finalColor,tileColor,digitalRainOptions.w);
-finalColor=mix(finalColor,baseColor,digitalRainOptions.z);
-gl_FragColor=finalColor;
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 64
proceduralTexturesLibrary/src/brick/brickProceduralTexture.fragment.fx.ts

@@ -1,64 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'brickProceduralTexturePixelShader';
-let shader = `precision highp float;
-varying vec2 vPosition;
-varying vec2 vUV;
-uniform float numberOfBricksHeight;
-uniform float numberOfBricksWidth;
-uniform vec3 brickColor;
-uniform vec3 jointColor;
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float fbm(vec2 n) {
-float total=0.0,amplitude=1.0;
-for (int i=0; i<4; i++) {
-total+=noise(n)*amplitude;
-n+=n;
-amplitude*=0.5;
-}
-return total;
-}
-float roundF(float number){
-return sign(number)*floor(abs(number)+0.5);
-}
-void main(void)
-{
-float brickW=1.0/numberOfBricksWidth;
-float brickH=1.0/numberOfBricksHeight;
-float jointWPercentage=0.01;
-float jointHPercentage=0.05;
-vec3 color=brickColor;
-float yi=vUV.y/brickH;
-float nyi=roundF(yi);
-float xi=vUV.x/brickW;
-if (mod(floor(yi),2.0) == 0.0){
-xi=xi-0.5;
-}
-float nxi=roundF(xi);
-vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);
-if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){
-color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);
-}
-else if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){
-color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);
-}
-else {
-float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);
-if (brickColorSwitch == 0.0)
-color=mix(color,vec3(0.33,0.33,0.33),0.3);
-else if (brickColorSwitch == 2.0)
-color=mix(color,vec3(0.11,0.11,0.11),0.3);
-}
-gl_FragColor=vec4(color,1.0);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 34
proceduralTexturesLibrary/src/cloud/cloudProceduralTexture.fragment.fx.ts

@@ -1,34 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'cloudProceduralTexturePixelShader';
-let shader = `precision highp float;
-varying vec2 vUV;
-uniform vec4 skyColor;
-uniform vec4 cloudColor;
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float fbm(vec2 n) {
-float total=0.0,amplitude=1.0;
-for (int i=0; i<4; i++) {
-total+=noise(n)*amplitude;
-n+=n;
-amplitude*=0.5;
-}
-return total;
-}
-void main() {
-vec2 p=vUV*12.0;
-vec4 c=mix(skyColor,cloudColor,fbm(p));
-gl_FragColor=c;
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 45
proceduralTexturesLibrary/src/fire/fireProceduralTexture.fragment.fx.ts

@@ -1,45 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'fireProceduralTexturePixelShader';
-let shader = `precision highp float;
-uniform float time;
-uniform vec3 c1;
-uniform vec3 c2;
-uniform vec3 c3;
-uniform vec3 c4;
-uniform vec3 c5;
-uniform vec3 c6;
-uniform vec2 speed;
-uniform float shift;
-uniform float alphaThreshold;
-varying vec2 vUV;
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float fbm(vec2 n) {
-float total=0.0,amplitude=1.0;
-for (int i=0; i<4; i++) {
-total+=noise(n)*amplitude;
-n+=n;
-amplitude*=0.5;
-}
-return total;
-}
-void main() {
-vec2 p=vUV*8.0;
-float q=fbm(p-time*0.1);
-vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));
-vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);
-vec3 color=c*cos(shift*vUV.y);
-float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));
-gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 38
proceduralTexturesLibrary/src/grass/grassProceduralTexture.fragment.fx.ts

@@ -1,38 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'grassProceduralTexturePixelShader';
-let shader = `precision highp float;
-varying vec2 vPosition;
-varying vec2 vUV;
-uniform vec3 herb1Color;
-uniform vec3 herb2Color;
-uniform vec3 herb3Color;
-uniform vec3 groundColor;
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float fbm(vec2 n) {
-float total=0.0,amplitude=1.0;
-for (int i=0; i<4; i++) {
-total+=noise(n)*amplitude;
-n+=n;
-amplitude*=0.5;
-}
-return total;
-}
-void main(void) {
-vec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));
-color=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));
-color=mix(color,herb3Color,rand(gl_FragCoord.xy));
-color=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));
-gl_FragColor=vec4(color,1.0);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 79
proceduralTexturesLibrary/src/marble/marbleProceduralTexture.fragment.fx.ts

@@ -1,79 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'marbleProceduralTexturePixelShader';
-let shader = `precision highp float;
-varying vec2 vPosition;
-varying vec2 vUV;
-uniform float numberOfTilesHeight;
-uniform float numberOfTilesWidth;
-uniform float amplitude;
-uniform vec3 marbleColor;
-uniform vec3 jointColor;
-const vec3 tileSize=vec3(1.1,1.0,1.1);
-const vec3 tilePct=vec3(0.98,1.0,0.98);
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float turbulence(vec2 P)
-{
-float val=0.0;
-float freq=1.0;
-for (int i=0; i<4; i++)
-{
-val+=abs(noise(P*freq)/freq);
-freq*=2.07;
-}
-return val;
-}
-float roundF(float number){
-return sign(number)*floor(abs(number)+0.5);
-}
-vec3 marble_color(float x)
-{
-vec3 col;
-x=0.5*(x+1.);
-x=sqrt(x);
-x=sqrt(x);
-x=sqrt(x);
-col=vec3(.2+.75*x);
-col.b*=0.95;
-return col;
-}
-void main()
-{
-float brickW=1.0/numberOfTilesWidth;
-float brickH=1.0/numberOfTilesHeight;
-float jointWPercentage=0.01;
-float jointHPercentage=0.01;
-vec3 color=marbleColor;
-float yi=vUV.y/brickH;
-float nyi=roundF(yi);
-float xi=vUV.x/brickW;
-if (mod(floor(yi),2.0) == 0.0){
-xi=xi-0.5;
-}
-float nxi=roundF(xi);
-vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);
-if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){
-color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);
-}
-else if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){
-color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);
-}
-else {
-float t=6.28*brickvUV.x/(tileSize.x+noise(vec2(vUV)*6.0));
-t+=amplitude*turbulence(brickvUV.xy);
-t=sin(t);
-color=marble_color(t);
-}
-gl_FragColor=vec4(color,0.0);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 31
proceduralTexturesLibrary/src/normalMap/normalMapProceduralTexture.fragment.fx.ts

@@ -1,31 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'normalMapProceduralTexturePixelShader';
-let shader = `precision highp float;
-
-uniform sampler2D baseSampler;
-uniform float size;
-
-varying vec2 vUV;
-
-const vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);
-float lumaAtCoord(vec2 coord)
-{
-vec3 pixel=texture2D(baseSampler,coord).rgb;
-float luma=dot(pixel,LUMA_COEFFICIENT);
-return luma;
-}
-void main()
-{
-float lumaU0=lumaAtCoord(vUV+vec2(-1.0,0.0)/size);
-float lumaU1=lumaAtCoord(vUV+vec2( 1.0,0.0)/size);
-float lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);
-float lumaV1=lumaAtCoord(vUV+vec2( 0.0,1.0)/size);
-vec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;
-gl_FragColor=vec4(slope,1.0,1.0);
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 91
proceduralTexturesLibrary/src/perlinNoise/perlinNoiseProceduralTexture.fragment.fx.ts

@@ -1,91 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'perlinNoiseProceduralTexturePixelShader';
-let shader = `
-precision highp float;
-
-uniform float size;
-uniform float time;
-uniform float translationSpeed;
-
-varying vec2 vUV;
-
-float r(float n)
-{
-return fract(cos(n*89.42)*343.42);
-}
-vec2 r(vec2 n)
-{
-return vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89));
-}
-float worley(vec2 n,float s)
-{
-float dis=1.0;
-for(int x=-1; x<=1; x++)
-{
-for(int y=-1; y<=1; y++)
-{
-vec2 p=floor(n/s)+vec2(x,y);
-float d=length(r(p)+vec2(x,y)-fract(n/s));
-if (dis>d)
-dis=d;
-}
-}
-return 1.0-dis;
-}
-vec3 hash33(vec3 p3)
-{
-p3=fract(p3*vec3(0.1031,0.11369,0.13787));
-p3+=dot(p3,p3.yxz+19.19);
-return -1.0+2.0*fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));
-}
-float perlinNoise(vec3 p)
-{
-vec3 pi=floor(p);
-vec3 pf=p-pi;
-vec3 w=pf*pf*(3.0-2.0*pf);
-return mix(
-mix(
-mix(
-dot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),
-dot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),
-w.x
-),
-mix(
-dot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),
-dot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),
-w.x
-),
-w.z
-),
-mix(
-mix(
-dot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),
-dot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),
-w.x
-),
-mix(
-dot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),
-dot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),
-w.x
-),
-w.z
-),
-w.y
-);
-}
-
-void main(void)
-{
-vec2 uv=gl_FragCoord.xy+translationSpeed;
-float dis=(
-1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))
-*(1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))
-);
-gl_FragColor=vec4(vec3(dis/4.0),1.0);
-}
-`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 32
proceduralTexturesLibrary/src/road/roadProceduralTexture.fragment.fx.ts

@@ -1,32 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'roadProceduralTexturePixelShader';
-let shader = `precision highp float;
-varying vec2 vUV;
-uniform vec3 roadColor;
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float fbm(vec2 n) {
-float total=0.0,amplitude=1.0;
-for (int i=0; i<4; i++) {
-total+=noise(n)*amplitude;
-n+=n;
-amplitude*=0.5;
-}
-return total;
-}
-void main(void) {
-float ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));
-vec3 color=roadColor*ratioy;
-gl_FragColor=vec4(color,1.0);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 61
proceduralTexturesLibrary/src/starfield/starfieldProceduralTexture.fragment.fx.ts

@@ -1,61 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'starfieldProceduralTexturePixelShader';
-let shader = `precision highp float;
-
-#define volsteps 20
-#define iterations 15
-varying vec2 vPosition;
-varying vec2 vUV;
-uniform float time;
-uniform float alpha;
-uniform float beta;
-uniform float zoom;
-uniform float formuparam;
-uniform float stepsize;
-uniform float tile;
-uniform float brightness;
-uniform float darkmatter;
-uniform float distfading;
-uniform float saturation;
-void main()
-{
-vec3 dir=vec3(vUV*zoom,1.);
-float localTime=time*0.0001;
-
-mat2 rot1=mat2(cos(alpha),sin(alpha),-sin(alpha),cos(alpha));
-mat2 rot2=mat2(cos(beta),sin(beta),-sin(beta),cos(beta));
-dir.xz*=rot1;
-dir.xy*=rot2;
-vec3 from=vec3(1.,.5,0.5);
-from+=vec3(-2.,localTime*2.,localTime);
-from.xz*=rot1;
-from.xy*=rot2;
-
-float s=0.1,fade=1.;
-vec3 v=vec3(0.);
-for (int r=0; r<volsteps; r++) {
-vec3 p=from+s*dir*.5;
-p=abs(vec3(tile)-mod(p,vec3(tile*2.)));
-float pa,a=pa=0.;
-for (int i=0; i<iterations; i++) {
-p=abs(p)/dot(p,p)-formuparam;
-a+=abs(length(p)-pa);
-pa=length(p);
-}
-float dm=max(0.,darkmatter-a*a*.001);
-a*=a*a;
-if (r>6) fade*=1.-dm;
-
-v+=fade;
-v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade;
-fade*=distfading;
-s+=stepsize;
-}
-v=mix(vec3(length(v)),v,saturation);
-gl_FragColor=vec4(v*.01,1.);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 34
proceduralTexturesLibrary/src/wood/woodProceduralTexture.fragment.fx.ts

@@ -1,34 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'woodProceduralTexturePixelShader';
-let shader = `precision highp float;
-varying vec2 vPosition;
-varying vec2 vUV;
-uniform float ampScale;
-uniform vec3 woodColor;
-float rand(vec2 n) {
-return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);
-}
-float noise(vec2 n) {
-const vec2 d=vec2(0.0,1.0);
-vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));
-return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);
-}
-float fbm(vec2 n) {
-float total=0.0,amplitude=1.0;
-for (int i=0; i<4; i++) {
-total+=noise(n)*amplitude;
-n+=n;
-amplitude*=0.5;
-}
-return total;
-}
-void main(void) {
-float ratioy=mod(vUV.x*ampScale,2.0+fbm(vUV*0.8));
-vec3 wood=woodColor*ratioy;
-gl_FragColor=vec4(wood,1.0);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };

+ 0 - 15
serializers/src/glTF/2.0/shaders/textureTransform.fragment.fx.ts

@@ -1,15 +0,0 @@
-import { Effect } from "babylonjs";
-
-let name = 'textureTransformPixelShader';
-let shader = `precision highp float;
-varying vec2 vUV;
-uniform sampler2D textureSampler;
-uniform mat4 textureTransformMat;
-void main(void) {
-vec2 uvTransformed=(textureTransformMat*vec4(vUV.xy,1,1)).xy;
-gl_FragColor=texture2D(textureSampler,uvTransformed);
-}`;
-
-Effect.ShadersStore[name] = shader;
-
-export { shader, name };