babylonjs-materials 9.23.0 → 9.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -396,6 +396,17 @@ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
396
396
  import { SubMesh } from "babylonjs/Meshes/subMesh";
397
397
  import { Mesh } from "babylonjs/Meshes/mesh";
398
398
  import { Scene } from "babylonjs/scene";
399
+ /**
400
+ * Max value the sky shader may write before the bound render target stores it as +Inf (which would
401
+ * corrupt anything reading the texture back, e.g. an IBL CDF). Derived from the RT's texture type:
402
+ * half-float caps at its 65504 ceiling; float is effectively unbounded (a huge finite +Inf guard);
403
+ * anything else (8-bit LDR, or the default framebuffer when no RT is bound) is [0,1]. Only used when
404
+ * `rawHdrOutput` is enabled.
405
+ * @param textureType the bound render target's texture type (Constants.TEXTURETYPE_*), or undefined
406
+ * @returns the maximum color value that can be stored without overflowing to +Inf
407
+ * @internal
408
+ */
409
+ export function _MaxColorValueForRenderTarget(textureType: number | undefined): number;
399
410
  /**
400
411
  * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
401
412
  * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
@@ -458,6 +469,28 @@ export class SkyMaterial extends PushMaterial {
458
469
  * Defines if sky should be dithered.
459
470
  */
460
471
  dithering: boolean;
472
+ /**
473
+ * When enabled, the material emits scene-referred linear HDR: `luminance` acts as a plain linear
474
+ * gain (no filmic tonemap), the output is clamped to the bound render target's max representable
475
+ * value rather than [0, 1] (so a bright sun cannot overflow to +Inf), and no sRGB encode is
476
+ * applied. Enable this to bake the sky into an HDR (float / half-float) render target — e.g. an
477
+ * IBL environment cube — where the full dynamic range of the sun disc must be preserved. The
478
+ * clamp ceiling follows whatever target is bound at draw time (65504 for half-float, effectively
479
+ * unbounded for float); if the sky is drawn to an LDR target or the default framebuffer it falls
480
+ * back to [0, 1], so this flag is only meaningful when rendering into a float/half-float target.
481
+ * When disabled, the material produces tonemapped, display-referred output for direct viewing.
482
+ */
483
+ rawHdrOutput: boolean;
484
+ /**
485
+ * Cloud cover over the sun in [0, 1] (0 = clear direct sun, default; 1 = sun fully hidden). This
486
+ * softens only the *sun disc* — the sky dome color itself is unchanged (there is no overcast
487
+ * graying or whitening of the sky). At 0 the sun is a sharp solar disc; above 0 a physically-
488
+ * based single-scattering cloud model attenuates the direct beam (Beer–Lambert) and redistributes
489
+ * the removed energy into a dual-lobe Henyey–Greenstein aureole, energy-conserving as it broadens
490
+ * (thin cloud → tight silver lining; heavy cloud → broad, directionless glow). See the sun-disc
491
+ * branch in sky.fragment for the model + references.
492
+ */
493
+ cloudiness: number;
461
494
  private _cameraPosition;
462
495
  private _skyOrientation;
463
496
  private static readonly _ShaderLoader;
@@ -665,6 +698,16 @@ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
665
698
  import { SubMesh } from "babylonjs/Meshes/subMesh";
666
699
  import { Mesh } from "babylonjs/Meshes/mesh";
667
700
  import { Scene } from "babylonjs/scene";
701
+ /**
702
+ * A transparent "shadow catcher" material: it renders only shadow strength into its alpha channel
703
+ * (over {@link ShadowOnlyMaterial.shadowColor | shadowColor}, black by default), so shadows can be
704
+ * composited over an arbitrary background.
705
+ *
706
+ * It can receive IBL shadows (via `IblShadowsRenderPipeline.addShadowReceivingMaterial` /
707
+ * the Frame Graph IBL shadows task). Because the material has a single alpha output channel, IBL
708
+ * shadows are received as **monochrome**: a colored IBL shadow is reduced to its luminance rather
709
+ * than preserving per-channel hue.
710
+ */
668
711
  export class ShadowOnlyMaterial extends PushMaterial {
669
712
  private _activeLight;
670
713
  private _needAlphaBlending;
@@ -676,6 +719,19 @@ export class ShadowOnlyMaterial extends PushMaterial {
676
719
  * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
677
720
  */
678
721
  constructor(name: string, scene?: Scene, forceGLSL?: boolean);
722
+ /**
723
+ * @internal
724
+ * Force the material uniform buffer into "no UBO" (individual uniform) mode so that any attached
725
+ * material plugin (e.g. IBLShadowsPluginMaterial) binds its uniforms directly on the effect. This
726
+ * lets ShadowOnlyMaterial host plugins without declaring a dedicated "Material" uniform block in its
727
+ * shaders (its own uniforms - alpha/shadowColor/... - stay individual uniforms). The base class only
728
+ * does this on WebGPU ("leftovers UBO"); we extend it to every backend.
729
+ */
730
+ _createUniformBuffer(): void;
731
+ /**
732
+ * The color the shadow is rendered with (black by default). Only its RGB is used; shadow
733
+ * strength is written to the material's alpha channel.
734
+ */
679
735
  shadowColor: Color3;
680
736
  needAlphaBlending(): boolean;
681
737
  needAlphaTesting(): boolean;
@@ -688,6 +744,13 @@ export class ShadowOnlyMaterial extends PushMaterial {
688
744
  clone(name: string): ShadowOnlyMaterial;
689
745
  serialize(): any;
690
746
  getClassName(): string;
747
+ /**
748
+ * Creates a ShadowOnly material from parsed material data.
749
+ * @param source defines the JSON representation of the material
750
+ * @param scene defines the hosting scene
751
+ * @param rootUrl defines the root URL to use to load textures and relative dependencies
752
+ * @returns a new ShadowOnly material
753
+ */
691
754
  static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
692
755
  }
693
756
 
@@ -2507,6 +2570,17 @@ declare namespace BABYLON {
2507
2570
  };
2508
2571
 
2509
2572
 
2573
+ /**
2574
+ * Max value the sky shader may write before the bound render target stores it as +Inf (which would
2575
+ * corrupt anything reading the texture back, e.g. an IBL CDF). Derived from the RT's texture type:
2576
+ * half-float caps at its 65504 ceiling; float is effectively unbounded (a huge finite +Inf guard);
2577
+ * anything else (8-bit LDR, or the default framebuffer when no RT is bound) is [0,1]. Only used when
2578
+ * `rawHdrOutput` is enabled.
2579
+ * @param textureType the bound render target's texture type (Constants.TEXTURETYPE_*), or undefined
2580
+ * @returns the maximum color value that can be stored without overflowing to +Inf
2581
+ * @internal
2582
+ */
2583
+ export function _MaxColorValueForRenderTarget(textureType: number | undefined): number;
2510
2584
  /**
2511
2585
  * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
2512
2586
  * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
@@ -2569,6 +2643,28 @@ declare namespace BABYLON {
2569
2643
  * Defines if sky should be dithered.
2570
2644
  */
2571
2645
  dithering: boolean;
2646
+ /**
2647
+ * When enabled, the material emits scene-referred linear HDR: `luminance` acts as a plain linear
2648
+ * gain (no filmic tonemap), the output is clamped to the bound render target's max representable
2649
+ * value rather than [0, 1] (so a bright sun cannot overflow to +Inf), and no sRGB encode is
2650
+ * applied. Enable this to bake the sky into an HDR (float / half-float) render target — e.g. an
2651
+ * IBL environment cube — where the full dynamic range of the sun disc must be preserved. The
2652
+ * clamp ceiling follows whatever target is bound at draw time (65504 for half-float, effectively
2653
+ * unbounded for float); if the sky is drawn to an LDR target or the default framebuffer it falls
2654
+ * back to [0, 1], so this flag is only meaningful when rendering into a float/half-float target.
2655
+ * When disabled, the material produces tonemapped, display-referred output for direct viewing.
2656
+ */
2657
+ rawHdrOutput: boolean;
2658
+ /**
2659
+ * Cloud cover over the sun in [0, 1] (0 = clear direct sun, default; 1 = sun fully hidden). This
2660
+ * softens only the *sun disc* — the sky dome color itself is unchanged (there is no overcast
2661
+ * graying or whitening of the sky). At 0 the sun is a sharp solar disc; above 0 a physically-
2662
+ * based single-scattering cloud model attenuates the direct beam (Beer–Lambert) and redistributes
2663
+ * the removed energy into a dual-lobe Henyey–Greenstein aureole, energy-conserving as it broadens
2664
+ * (thin cloud → tight silver lining; heavy cloud → broad, directionless glow). See the sun-disc
2665
+ * branch in sky.fragment for the model + references.
2666
+ */
2667
+ cloudiness: number;
2572
2668
  private _cameraPosition;
2573
2669
  private _skyOrientation;
2574
2670
  private static readonly _ShaderLoader;
@@ -2742,6 +2838,16 @@ declare namespace BABYLON {
2742
2838
  };
2743
2839
 
2744
2840
 
2841
+ /**
2842
+ * A transparent "shadow catcher" material: it renders only shadow strength into its alpha channel
2843
+ * (over {@link ShadowOnlyMaterial.shadowColor | shadowColor}, black by default), so shadows can be
2844
+ * composited over an arbitrary background.
2845
+ *
2846
+ * It can receive IBL shadows (via `IblShadowsRenderPipeline.addShadowReceivingMaterial` /
2847
+ * the Frame Graph IBL shadows task). Because the material has a single alpha output channel, IBL
2848
+ * shadows are received as **monochrome**: a colored IBL shadow is reduced to its luminance rather
2849
+ * than preserving per-channel hue.
2850
+ */
2745
2851
  export class ShadowOnlyMaterial extends PushMaterial {
2746
2852
  private _activeLight;
2747
2853
  private _needAlphaBlending;
@@ -2753,6 +2859,19 @@ declare namespace BABYLON {
2753
2859
  * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
2754
2860
  */
2755
2861
  constructor(name: string, scene?: Scene, forceGLSL?: boolean);
2862
+ /**
2863
+ * @internal
2864
+ * Force the material uniform buffer into "no UBO" (individual uniform) mode so that any attached
2865
+ * material plugin (e.g. IBLShadowsPluginMaterial) binds its uniforms directly on the effect. This
2866
+ * lets ShadowOnlyMaterial host plugins without declaring a dedicated "Material" uniform block in its
2867
+ * shaders (its own uniforms - alpha/shadowColor/... - stay individual uniforms). The base class only
2868
+ * does this on WebGPU ("leftovers UBO"); we extend it to every backend.
2869
+ */
2870
+ _createUniformBuffer(): void;
2871
+ /**
2872
+ * The color the shadow is rendered with (black by default). Only its RGB is used; shadow
2873
+ * strength is written to the material's alpha channel.
2874
+ */
2756
2875
  shadowColor: Color3;
2757
2876
  needAlphaBlending(): boolean;
2758
2877
  needAlphaTesting(): boolean;
@@ -2765,6 +2884,13 @@ declare namespace BABYLON {
2765
2884
  clone(name: string): ShadowOnlyMaterial;
2766
2885
  serialize(): any;
2767
2886
  getClassName(): string;
2887
+ /**
2888
+ * Creates a ShadowOnly material from parsed material data.
2889
+ * @param source defines the JSON representation of the material
2890
+ * @param scene defines the hosting scene
2891
+ * @param rootUrl defines the root URL to use to load textures and relative dependencies
2892
+ * @returns a new ShadowOnly material
2893
+ */
2768
2894
  static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
2769
2895
  }
2770
2896
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-materials",
3
- "version": "9.23.0",
3
+ "version": "9.26.0",
4
4
  "main": "babylonjs.materials.min.js",
5
5
  "types": "babylonjs.materials.module.d.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "test:escheck": "es-check es6 ./babylonjs.materials.js"
17
17
  },
18
18
  "dependencies": {
19
- "babylonjs": "9.23.0"
19
+ "babylonjs": "9.26.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@dev/build-tools": "1.0.0",