@zephyr3d/scene 0.9.15 → 0.9.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/app/engine.js +3 -1
  2. package/dist/app/engine.js.map +1 -1
  3. package/dist/asset/assetmanager.js +1 -0
  4. package/dist/asset/assetmanager.js.map +1 -1
  5. package/dist/camera/camera.js +87 -0
  6. package/dist/camera/camera.js.map +1 -1
  7. package/dist/index.d.ts +152 -4
  8. package/dist/index.js +3 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/material/meshmaterial.js +8 -1
  11. package/dist/material/meshmaterial.js.map +1 -1
  12. package/dist/material/shader/helper.js +6 -0
  13. package/dist/material/shader/helper.js.map +1 -1
  14. package/dist/material/skin.js +263 -0
  15. package/dist/material/skin.js.map +1 -0
  16. package/dist/posteffect/compositor.js +3 -0
  17. package/dist/posteffect/compositor.js.map +1 -1
  18. package/dist/posteffect/skinsss.js +194 -0
  19. package/dist/posteffect/skinsss.js.map +1 -0
  20. package/dist/posteffect/ssr.js +26 -49
  21. package/dist/posteffect/ssr.js.map +1 -1
  22. package/dist/posteffect/sss.js +1 -0
  23. package/dist/posteffect/sss.js.map +1 -1
  24. package/dist/posteffect/taa.js +2 -40
  25. package/dist/posteffect/taa.js.map +1 -1
  26. package/dist/render/abuffer_oit.js +1 -0
  27. package/dist/render/abuffer_oit.js.map +1 -1
  28. package/dist/render/drawable_mixin.js +1 -0
  29. package/dist/render/drawable_mixin.js.map +1 -1
  30. package/dist/render/fbm_wavegenerator.js +1 -0
  31. package/dist/render/fbm_wavegenerator.js.map +1 -1
  32. package/dist/render/gerstner_wavegenerator.js +1 -0
  33. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  34. package/dist/render/globalbindgroup_allocator.js +1 -0
  35. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  36. package/dist/render/lightpass.js +4 -1
  37. package/dist/render/lightpass.js.map +1 -1
  38. package/dist/render/render_queue.js +1 -0
  39. package/dist/render/render_queue.js.map +1 -1
  40. package/dist/render/renderer.js +1 -0
  41. package/dist/render/renderer.js.map +1 -1
  42. package/dist/render/rendergraph/device_pool_allocator.js +41 -41
  43. package/dist/render/rendergraph/device_pool_allocator.js.map +1 -1
  44. package/dist/render/rendergraph/forward_plus_builder.js +78 -8
  45. package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
  46. package/dist/scene/basesprite.js +1 -0
  47. package/dist/scene/basesprite.js.map +1 -1
  48. package/dist/scene/batchgroup.js +1 -0
  49. package/dist/scene/batchgroup.js.map +1 -1
  50. package/dist/scene/environment.js +1 -0
  51. package/dist/scene/environment.js.map +1 -1
  52. package/dist/scene/light.js +158 -154
  53. package/dist/scene/light.js.map +1 -1
  54. package/dist/scene/mesh.js +1 -0
  55. package/dist/scene/mesh.js.map +1 -1
  56. package/dist/scene/msdftext.js +1 -0
  57. package/dist/scene/msdftext.js.map +1 -1
  58. package/dist/scene/msdftextsprite.js +1 -0
  59. package/dist/scene/msdftextsprite.js.map +1 -1
  60. package/dist/scene/particlesys.js +1 -0
  61. package/dist/scene/particlesys.js.map +1 -1
  62. package/dist/scene/scene.js +1 -0
  63. package/dist/scene/scene.js.map +1 -1
  64. package/dist/scene/terrain-cm/grass.js +1 -0
  65. package/dist/scene/terrain-cm/grass.js.map +1 -1
  66. package/dist/scene/terrain-cm/grassmaterial.js +1 -0
  67. package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
  68. package/dist/scene/terrain-cm/terrain-cm.js +1 -0
  69. package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
  70. package/dist/scene/water.js +1 -0
  71. package/dist/scene/water.js.map +1 -1
  72. package/dist/shaders/shadow.js +617 -1
  73. package/dist/shaders/shadow.js.map +1 -1
  74. package/dist/shadow/esm.js +1 -0
  75. package/dist/shadow/esm.js.map +1 -1
  76. package/dist/shadow/pcf_opt.js +1 -0
  77. package/dist/shadow/pcf_opt.js.map +1 -1
  78. package/dist/shadow/pcf_pd.js +1 -0
  79. package/dist/shadow/pcf_pd.js.map +1 -1
  80. package/dist/shadow/pcss.js +182 -0
  81. package/dist/shadow/pcss.js.map +1 -0
  82. package/dist/shadow/shader.js +1 -0
  83. package/dist/shadow/shader.js.map +1 -1
  84. package/dist/shadow/shadow_impl.js.map +1 -1
  85. package/dist/shadow/shadowmapper.js +183 -105
  86. package/dist/shadow/shadowmapper.js.map +1 -1
  87. package/dist/shadow/ssm.js +1 -0
  88. package/dist/shadow/ssm.js.map +1 -1
  89. package/dist/shadow/vsm.js +1 -0
  90. package/dist/shadow/vsm.js.map +1 -1
  91. package/dist/utility/serialization/manager.js +3 -1
  92. package/dist/utility/serialization/manager.js.map +1 -1
  93. package/dist/utility/serialization/scene/animation.js +1 -0
  94. package/dist/utility/serialization/scene/animation.js.map +1 -1
  95. package/dist/utility/serialization/scene/batch.js +1 -0
  96. package/dist/utility/serialization/scene/batch.js.map +1 -1
  97. package/dist/utility/serialization/scene/camera.js +122 -0
  98. package/dist/utility/serialization/scene/camera.js.map +1 -1
  99. package/dist/utility/serialization/scene/common.js +1 -0
  100. package/dist/utility/serialization/scene/common.js.map +1 -1
  101. package/dist/utility/serialization/scene/light.js +102 -21
  102. package/dist/utility/serialization/scene/light.js.map +1 -1
  103. package/dist/utility/serialization/scene/material.js +195 -3
  104. package/dist/utility/serialization/scene/material.js.map +1 -1
  105. package/dist/utility/serialization/scene/mesh.js +1 -0
  106. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  107. package/dist/utility/serialization/scene/node.js +1 -0
  108. package/dist/utility/serialization/scene/node.js.map +1 -1
  109. package/dist/utility/serialization/scene/particle.js +1 -0
  110. package/dist/utility/serialization/scene/particle.js.map +1 -1
  111. package/dist/utility/serialization/scene/primitive.js +1 -0
  112. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  113. package/dist/utility/serialization/scene/sprite.js +1 -0
  114. package/dist/utility/serialization/scene/sprite.js.map +1 -1
  115. package/dist/utility/serialization/scene/terrain.js +1 -0
  116. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  117. package/dist/utility/serialization/scene/text.js +1 -0
  118. package/dist/utility/serialization/scene/text.js.map +1 -1
  119. package/dist/utility/serialization/scene/water.js +1 -0
  120. package/dist/utility/serialization/scene/water.js.map +1 -1
  121. package/dist/values.js +1 -0
  122. package/dist/values.js.map +1 -1
  123. package/package.json +2 -2
@@ -4,6 +4,7 @@ import { BlinnMaterial } from '../../../material/blinn.js';
4
4
  import { UnlitMaterial } from '../../../material/unlit.js';
5
5
  import { ParticleMaterial } from '../../../material/particle.js';
6
6
  import { SubsurfaceProfile } from '../../../material/subsurfaceprofile.js';
7
+ import { SkinMaterial } from '../../../material/skin.js';
7
8
  import '@zephyr3d/device';
8
9
  import '../../../values.js';
9
10
  import { Vector3, Vector4, Vector2 } from '@zephyr3d/base';
@@ -727,9 +728,9 @@ function getLitMaterialProps(manager) {
727
728
  name: 'doubleSidedLighting',
728
729
  description: 'If true, lighting is evaluated on both sides of the surface',
729
730
  type: 'bool',
730
- default: false,
731
+ default: true,
731
732
  isValid () {
732
- return !this.$isInstance && this.cullMode !== 'back';
733
+ return !this.$isInstance;
733
734
  },
734
735
  get (value) {
735
736
  value.bool[0] = this.doubleSidedLighting;
@@ -738,6 +739,27 @@ function getLitMaterialProps(manager) {
738
739
  this.doubleSidedLighting = value.bool[0];
739
740
  }
740
741
  },
742
+ {
743
+ name: 'NormalScale',
744
+ description: 'Scalar applied to the normal texture',
745
+ type: 'float',
746
+ phase: 1,
747
+ default: 1,
748
+ options: {
749
+ animatable: true,
750
+ minValue: 0,
751
+ maxValue: 2
752
+ },
753
+ get (value) {
754
+ value.num[0] = this.normalScale;
755
+ },
756
+ set (value) {
757
+ this.normalScale = value.num[0];
758
+ },
759
+ isValid () {
760
+ return !this.$isInstance && !!this.normalTexture;
761
+ }
762
+ },
741
763
  {
742
764
  name: 'vertexNormal',
743
765
  description: 'If true, uses vertex normals for lighting and normal mapping',
@@ -1829,6 +1851,176 @@ function getMToonMaterialProps(manager) {
1829
1851
  getMeshMaterialInstanceUniformsClass(BlinnMaterial)
1830
1852
  ];
1831
1853
  }
1854
+ /** @internal */ function getSkinMaterialClass(manager) {
1855
+ return [
1856
+ {
1857
+ ctor: SkinMaterial,
1858
+ parent: MeshMaterial,
1859
+ name: 'SkinMaterial',
1860
+ getProps () {
1861
+ return defineProps([
1862
+ {
1863
+ name: 'Shininess',
1864
+ description: 'Blinn specular exponent for skin highlights',
1865
+ type: 'float',
1866
+ default: 72,
1867
+ options: {
1868
+ animatable: true,
1869
+ minValue: 1,
1870
+ maxValue: 2048
1871
+ },
1872
+ get (value) {
1873
+ value.num[0] = this.shininess;
1874
+ },
1875
+ set (value) {
1876
+ this.shininess = value.num[0];
1877
+ },
1878
+ getDefaultValue () {
1879
+ return this.$isInstance ? this.coreMaterial.shininess : 72;
1880
+ }
1881
+ },
1882
+ {
1883
+ name: 'SpecularStrength',
1884
+ description: 'Direct specular strength for restrained skin highlights',
1885
+ type: 'float',
1886
+ default: 0.22,
1887
+ options: {
1888
+ animatable: true,
1889
+ minValue: 0,
1890
+ maxValue: 4
1891
+ },
1892
+ get (value) {
1893
+ value.num[0] = this.specularStrength;
1894
+ },
1895
+ set (value) {
1896
+ this.specularStrength = value.num[0];
1897
+ },
1898
+ getDefaultValue () {
1899
+ return this.$isInstance ? this.coreMaterial.specularStrength : 0.22;
1900
+ }
1901
+ },
1902
+ {
1903
+ name: 'DiffuseWrap',
1904
+ description: 'Wrap amount for visible diffuse lighting',
1905
+ type: 'float',
1906
+ default: 0.28,
1907
+ options: {
1908
+ animatable: true,
1909
+ minValue: 0,
1910
+ maxValue: 2
1911
+ },
1912
+ get (value) {
1913
+ value.num[0] = this.diffuseWrap;
1914
+ },
1915
+ set (value) {
1916
+ this.diffuseWrap = value.num[0];
1917
+ },
1918
+ getDefaultValue () {
1919
+ return this.$isInstance ? this.coreMaterial.diffuseWrap : 0.28;
1920
+ }
1921
+ },
1922
+ {
1923
+ name: 'DiffuseSoftness',
1924
+ description: 'Blend from hard Lambert lighting to wrapped diffuse lighting',
1925
+ type: 'float',
1926
+ default: 0.45,
1927
+ options: {
1928
+ animatable: true,
1929
+ minValue: 0,
1930
+ maxValue: 1
1931
+ },
1932
+ get (value) {
1933
+ value.num[0] = this.diffuseSoftness;
1934
+ },
1935
+ set (value) {
1936
+ this.diffuseSoftness = value.num[0];
1937
+ },
1938
+ getDefaultValue () {
1939
+ return this.$isInstance ? this.coreMaterial.diffuseSoftness : 0.45;
1940
+ }
1941
+ },
1942
+ {
1943
+ name: 'ScatterWrap',
1944
+ description: 'Wide wrap amount written to the Skin SSS scattering source',
1945
+ type: 'float',
1946
+ default: 0.65,
1947
+ options: {
1948
+ animatable: true,
1949
+ minValue: 0,
1950
+ maxValue: 2
1951
+ },
1952
+ get (value) {
1953
+ value.num[0] = this.scatterWrap;
1954
+ },
1955
+ set (value) {
1956
+ this.scatterWrap = value.num[0];
1957
+ },
1958
+ getDefaultValue () {
1959
+ return this.$isInstance ? this.coreMaterial.scatterWrap : 0.65;
1960
+ }
1961
+ },
1962
+ {
1963
+ name: 'ScatterStrength',
1964
+ description: 'Strength of the lighting multiplier written to the Skin SSS side buffer',
1965
+ type: 'float',
1966
+ default: 0.7,
1967
+ options: {
1968
+ animatable: true,
1969
+ minValue: 0,
1970
+ maxValue: 4
1971
+ },
1972
+ get (value) {
1973
+ value.num[0] = this.scatterStrength;
1974
+ },
1975
+ set (value) {
1976
+ this.scatterStrength = value.num[0];
1977
+ },
1978
+ getDefaultValue () {
1979
+ return this.$isInstance ? this.coreMaterial.scatterStrength : 0.7;
1980
+ }
1981
+ },
1982
+ {
1983
+ name: 'ScatterColor',
1984
+ description: 'Warm tint for the blurred skin scattering contribution',
1985
+ type: 'rgba',
1986
+ default: [
1987
+ 1,
1988
+ 0.42,
1989
+ 0.28,
1990
+ 1
1991
+ ],
1992
+ options: {
1993
+ animatable: true,
1994
+ minValue: 0,
1995
+ maxValue: 1
1996
+ },
1997
+ get (value) {
1998
+ value.num[0] = this.scatterColor.x;
1999
+ value.num[1] = this.scatterColor.y;
2000
+ value.num[2] = this.scatterColor.z;
2001
+ value.num[3] = this.scatterColor.w;
2002
+ },
2003
+ set (value) {
2004
+ this.scatterColor = new Vector4(value.num[0], value.num[1], value.num[2], value.num[3]);
2005
+ },
2006
+ getDefaultValue () {
2007
+ const color = this.$isInstance ? this.coreMaterial.scatterColor : new Vector4(1, 0.42, 0.28, 1);
2008
+ return [
2009
+ color.x,
2010
+ color.y,
2011
+ color.z,
2012
+ color.w
2013
+ ];
2014
+ }
2015
+ },
2016
+ ...getTextureProps(manager, 'subsurfaceTexture', '2D', false, 1),
2017
+ ...getLitMaterialProps(manager)
2018
+ ]);
2019
+ }
2020
+ },
2021
+ getMeshMaterialInstanceUniformsClass(SkinMaterial)
2022
+ ];
2023
+ }
1832
2024
  /** @internal */ function getPBRMetallicRoughnessMaterialClass(manager) {
1833
2025
  return [
1834
2026
  {
@@ -2110,5 +2302,5 @@ function getMToonMaterialProps(manager) {
2110
2302
  ];
2111
2303
  }
2112
2304
 
2113
- export { getBlinnMaterialClass, getLambertMaterialClass, getMToonMaterialClass, getMeshMaterialClass, getPBRBluePrintMaterialClass, getPBRMetallicRoughnessMaterialClass, getPBRSpecularGlossinessMaterialClass, getParticleMaterialClass, getSpriteBlueprintMaterialClass, getSpriteMaterialClass, getStandardSpriteMaterialClass, getSubsurfaceProfileClass, getUnlitMaterialClass };
2305
+ export { getBlinnMaterialClass, getLambertMaterialClass, getMToonMaterialClass, getMeshMaterialClass, getPBRBluePrintMaterialClass, getPBRMetallicRoughnessMaterialClass, getPBRSpecularGlossinessMaterialClass, getParticleMaterialClass, getSkinMaterialClass, getSpriteBlueprintMaterialClass, getSpriteMaterialClass, getStandardSpriteMaterialClass, getSubsurfaceProfileClass, getUnlitMaterialClass };
2114
2306
  //# sourceMappingURL=material.js.map