@@ -54,6 +54,14 @@ class LightComponentElement extends ComponentElement {
5454
5555 private _vsmBlurSize = 11 ;
5656
57+ private _penumbraSize = 1 ;
58+
59+ private _penumbraFalloff = 2 ;
60+
61+ private _shadowSamples = 16 ;
62+
63+ private _shadowBlockerSamples = 16 ;
64+
5765 /** @ignore */
5866 constructor ( ) {
5967 super ( 'light' ) ;
@@ -67,11 +75,15 @@ class LightComponentElement extends ComponentElement {
6775 intensity : this . _intensity ,
6876 normalOffsetBias : this . _normalOffsetBias ,
6977 outerConeAngle : this . _outerConeAngle ,
78+ penumbraFalloff : this . _penumbraFalloff ,
79+ penumbraSize : this . _penumbraSize ,
7080 range : this . _range ,
7181 shadowBias : this . _shadowBias ,
82+ shadowBlockerSamples : this . _shadowBlockerSamples ,
7283 shadowDistance : this . _shadowDistance ,
7384 shadowIntensity : this . _shadowIntensity ,
7485 shadowResolution : this . _shadowResolution ,
86+ shadowSamples : this . _shadowSamples ,
7587 shadowType : shadowTypes . get ( this . _shadowType ) ,
7688 type : this . _type ,
7789 vsmBias : this . _vsmBias ,
@@ -387,6 +399,82 @@ class LightComponentElement extends ComponentElement {
387399 return this . _vsmBlurSize ;
388400 }
389401
402+ /**
403+ * Sets the penumbra size of the light. Used for PCSS shadows.
404+ * @param value - The penumbra size.
405+ */
406+ set penumbraSize ( value : number ) {
407+ this . _penumbraSize = value ;
408+ if ( this . component ) {
409+ this . component . penumbraSize = value ;
410+ }
411+ }
412+
413+ /**
414+ * Gets the penumbra size of the light.
415+ * @returns The penumbra size.
416+ */
417+ get penumbraSize ( ) {
418+ return this . _penumbraSize ;
419+ }
420+
421+ /**
422+ * Sets the penumbra falloff of the light. Used for PCSS shadows.
423+ * @param value - The penumbra falloff.
424+ */
425+ set penumbraFalloff ( value : number ) {
426+ this . _penumbraFalloff = value ;
427+ if ( this . component ) {
428+ this . component . penumbraFalloff = value ;
429+ }
430+ }
431+
432+ /**
433+ * Gets the penumbra falloff of the light.
434+ * @returns The penumbra falloff.
435+ */
436+ get penumbraFalloff ( ) {
437+ return this . _penumbraFalloff ;
438+ }
439+
440+ /**
441+ * Sets the number of shadow samples. Used for PCSS shadows.
442+ * @param value - The number of shadow samples.
443+ */
444+ set shadowSamples ( value : number ) {
445+ this . _shadowSamples = value ;
446+ if ( this . component ) {
447+ this . component . shadowSamples = value ;
448+ }
449+ }
450+
451+ /**
452+ * Gets the number of shadow samples.
453+ * @returns The number of shadow samples.
454+ */
455+ get shadowSamples ( ) {
456+ return this . _shadowSamples ;
457+ }
458+
459+ /**
460+ * Sets the number of shadow blocker samples. Used for PCSS shadows.
461+ * @param value - The number of shadow blocker samples.
462+ */
463+ set shadowBlockerSamples ( value : number ) {
464+ this . _shadowBlockerSamples = value ;
465+ if ( this . component ) {
466+ this . component . shadowBlockerSamples = value ;
467+ }
468+ }
469+
470+ /**
471+ * Gets the number of shadow blocker samples.
472+ * @returns The number of shadow blocker samples.
473+ */
474+ get shadowBlockerSamples ( ) {
475+ return this . _shadowBlockerSamples ;
476+ }
477+
390478 static get observedAttributes ( ) {
391479 return [
392480 ...super . observedAttributes ,
@@ -396,11 +484,15 @@ class LightComponentElement extends ComponentElement {
396484 'inner-cone-angle' ,
397485 'normal-offset-bias' ,
398486 'outer-cone-angle' ,
487+ 'penumbra-falloff' ,
488+ 'penumbra-size' ,
399489 'range' ,
400490 'shadow-bias' ,
491+ 'shadow-blocker-samples' ,
401492 'shadow-distance' ,
402493 'shadow-intensity' ,
403494 'shadow-resolution' ,
495+ 'shadow-samples' ,
404496 'shadow-type' ,
405497 'type' ,
406498 'vsm-bias' ,
@@ -430,6 +522,12 @@ class LightComponentElement extends ComponentElement {
430522 case 'outer-cone-angle' :
431523 this . outerConeAngle = Number ( newValue ) ;
432524 break ;
525+ case 'penumbra-falloff' :
526+ this . penumbraFalloff = Number ( newValue ) ;
527+ break ;
528+ case 'penumbra-size' :
529+ this . penumbraSize = Number ( newValue ) ;
530+ break ;
433531 case 'range' :
434532 this . range = Number ( newValue ) ;
435533 break ;
@@ -439,12 +537,18 @@ class LightComponentElement extends ComponentElement {
439537 case 'shadow-distance' :
440538 this . shadowDistance = Number ( newValue ) ;
441539 break ;
540+ case 'shadow-blocker-samples' :
541+ this . shadowBlockerSamples = Number ( newValue ) ;
542+ break ;
442543 case 'shadow-resolution' :
443544 this . shadowResolution = Number ( newValue ) ;
444545 break ;
445546 case 'shadow-intensity' :
446547 this . shadowIntensity = Number ( newValue ) ;
447548 break ;
549+ case 'shadow-samples' :
550+ this . shadowSamples = Number ( newValue ) ;
551+ break ;
448552 case 'shadow-type' :
449553 this . shadowType = newValue as 'pcf1-16f' | 'pcf1-32f' | 'pcf3-16f' | 'pcf3-32f' | 'pcf5-16f' | 'pcf5-32f' | 'vsm-16f' | 'vsm-32f' | 'pcss-32f' ;
450554 break ;
0 commit comments