Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/editor/attributes/reference/components/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ export const fields: AttributeReference[] = [{
subTitle: '{Number}',
description: 'The size of the penumbra for PCSS (Percentage Closer Soft Shadows). A larger value produces softer shadow edges. Only applies when shadows are enabled.',
url: 'https://api.playcanvas.com/engine/classes/LightComponent.html#penumbrasize'
}, {
name: 'light:penumbraFalloff',
title: 'penumbraFalloff',
subTitle: '{Number}',
description: 'The falloff rate for shadow penumbra for PCSS (Percentage Closer Soft Shadows). Controls how quickly the shadow edge transitions from hard to soft. Only applies when shadow type is PCSS.',
url: 'https://api.playcanvas.com/engine/classes/LightComponent.html#penumbrafalloff'
}, {
name: 'light:layers',
title: 'layers',
Expand Down
5 changes: 5 additions & 0 deletions src/editor/entities/entities-migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ editor.once('load', () => {
entity.set('components.light.penumbraSize', 1);
}

// penumbraFalloff
if (!entity.has('components.light.penumbraFalloff')) {
entity.set('components.light.penumbraFalloff', 1);
}

// cookieAsset
if (!entity.has('components.light.cookieAsset')) {
entity.set('components.light.cookieAsset', null);
Expand Down
16 changes: 15 additions & 1 deletion src/editor/inspector/components/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ const ATTRIBUTES: (Attribute | Divider)[] = [{
v: SHADOW_VSM_16F, t: 'Variance Shadow Map (16bit)'
}, {
v: SHADOW_VSM_32F, t: 'Variance Shadow Map (32bit)'
}, {
v: SHADOW_PCSS_32F, t: 'PCSS (Soft Shadows)'
}]
}
}, {
Expand Down Expand Up @@ -347,6 +349,16 @@ const ATTRIBUTES: (Attribute | Divider)[] = [{
step: 0.1,
min: 0
}
}, {
label: 'Penumbra Falloff',
path: 'components.light.penumbraFalloff',
reference: 'light:penumbraFalloff',
type: 'number',
args: {
precision: 2,
step: 0.1,
min: 0
}
}, {
type: 'divider',
alias: 'components.light.cookieDivider'
Expand Down Expand Up @@ -600,7 +612,9 @@ class LightComponentInspector extends ComponentInspector {
this._field(field).parent.hidden = !castShadows || shadowTypeVsm;
});

this._field('penumbraSize').parent.hidden = !castShadows || shadowType !== SHADOW_PCSS_32F;
const shadowTypePcss = shadowType === SHADOW_PCSS_32F;
this._field('penumbraSize').parent.hidden = !castShadows || !shadowTypePcss;
this._field('penumbraFalloff').parent.hidden = !castShadows || !shadowTypePcss;

this._btnUpdateShadow.hidden = this._field('shadowUpdateMode').value !== SHADOWUPDATE_THISFRAME;
}
Expand Down