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.
@@ -316,6 +316,17 @@ declare namespace BABYLON {
316
316
  };
317
317
 
318
318
 
319
+ /**
320
+ * Max value the sky shader may write before the bound render target stores it as +Inf (which would
321
+ * corrupt anything reading the texture back, e.g. an IBL CDF). Derived from the RT's texture type:
322
+ * half-float caps at its 65504 ceiling; float is effectively unbounded (a huge finite +Inf guard);
323
+ * anything else (8-bit LDR, or the default framebuffer when no RT is bound) is [0,1]. Only used when
324
+ * `rawHdrOutput` is enabled.
325
+ * @param textureType the bound render target's texture type (Constants.TEXTURETYPE_*), or undefined
326
+ * @returns the maximum color value that can be stored without overflowing to +Inf
327
+ * @internal
328
+ */
329
+ export function _MaxColorValueForRenderTarget(textureType: number | undefined): number;
319
330
  /**
320
331
  * This is the sky material which allows to create dynamic and texture free effects for skyboxes.
321
332
  * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat
@@ -378,6 +389,28 @@ declare namespace BABYLON {
378
389
  * Defines if sky should be dithered.
379
390
  */
380
391
  dithering: boolean;
392
+ /**
393
+ * When enabled, the material emits scene-referred linear HDR: `luminance` acts as a plain linear
394
+ * gain (no filmic tonemap), the output is clamped to the bound render target's max representable
395
+ * value rather than [0, 1] (so a bright sun cannot overflow to +Inf), and no sRGB encode is
396
+ * applied. Enable this to bake the sky into an HDR (float / half-float) render target — e.g. an
397
+ * IBL environment cube — where the full dynamic range of the sun disc must be preserved. The
398
+ * clamp ceiling follows whatever target is bound at draw time (65504 for half-float, effectively
399
+ * unbounded for float); if the sky is drawn to an LDR target or the default framebuffer it falls
400
+ * back to [0, 1], so this flag is only meaningful when rendering into a float/half-float target.
401
+ * When disabled, the material produces tonemapped, display-referred output for direct viewing.
402
+ */
403
+ rawHdrOutput: boolean;
404
+ /**
405
+ * Cloud cover over the sun in [0, 1] (0 = clear direct sun, default; 1 = sun fully hidden). This
406
+ * softens only the *sun disc* — the sky dome color itself is unchanged (there is no overcast
407
+ * graying or whitening of the sky). At 0 the sun is a sharp solar disc; above 0 a physically-
408
+ * based single-scattering cloud model attenuates the direct beam (Beer–Lambert) and redistributes
409
+ * the removed energy into a dual-lobe Henyey–Greenstein aureole, energy-conserving as it broadens
410
+ * (thin cloud → tight silver lining; heavy cloud → broad, directionless glow). See the sun-disc
411
+ * branch in sky.fragment for the model + references.
412
+ */
413
+ cloudiness: number;
381
414
  private _cameraPosition;
382
415
  private _skyOrientation;
383
416
  private static readonly _ShaderLoader;
@@ -551,6 +584,16 @@ declare namespace BABYLON {
551
584
  };
552
585
 
553
586
 
587
+ /**
588
+ * A transparent "shadow catcher" material: it renders only shadow strength into its alpha channel
589
+ * (over {@link ShadowOnlyMaterial.shadowColor | shadowColor}, black by default), so shadows can be
590
+ * composited over an arbitrary background.
591
+ *
592
+ * It can receive IBL shadows (via `IblShadowsRenderPipeline.addShadowReceivingMaterial` /
593
+ * the Frame Graph IBL shadows task). Because the material has a single alpha output channel, IBL
594
+ * shadows are received as **monochrome**: a colored IBL shadow is reduced to its luminance rather
595
+ * than preserving per-channel hue.
596
+ */
554
597
  export class ShadowOnlyMaterial extends PushMaterial {
555
598
  private _activeLight;
556
599
  private _needAlphaBlending;
@@ -562,6 +605,19 @@ declare namespace BABYLON {
562
605
  * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
563
606
  */
564
607
  constructor(name: string, scene?: Scene, forceGLSL?: boolean);
608
+ /**
609
+ * @internal
610
+ * Force the material uniform buffer into "no UBO" (individual uniform) mode so that any attached
611
+ * material plugin (e.g. IBLShadowsPluginMaterial) binds its uniforms directly on the effect. This
612
+ * lets ShadowOnlyMaterial host plugins without declaring a dedicated "Material" uniform block in its
613
+ * shaders (its own uniforms - alpha/shadowColor/... - stay individual uniforms). The base class only
614
+ * does this on WebGPU ("leftovers UBO"); we extend it to every backend.
615
+ */
616
+ _createUniformBuffer(): void;
617
+ /**
618
+ * The color the shadow is rendered with (black by default). Only its RGB is used; shadow
619
+ * strength is written to the material's alpha channel.
620
+ */
565
621
  shadowColor: Color3;
566
622
  needAlphaBlending(): boolean;
567
623
  needAlphaTesting(): boolean;
@@ -574,6 +630,13 @@ declare namespace BABYLON {
574
630
  clone(name: string): ShadowOnlyMaterial;
575
631
  serialize(): any;
576
632
  getClassName(): string;
633
+ /**
634
+ * Creates a ShadowOnly material from parsed material data.
635
+ * @param source defines the JSON representation of the material
636
+ * @param scene defines the hosting scene
637
+ * @param rootUrl defines the root URL to use to load textures and relative dependencies
638
+ * @returns a new ShadowOnly material
639
+ */
577
640
  static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
578
641
  }
579
642