Skip to content

Commit

Permalink
Renamed shadow type constants, old constants are deprecated (#7145)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <[email protected]>
  • Loading branch information
mvaligursky and Martin Valigursky authored Nov 27, 2024
1 parent d68f412 commit 30a788d
Show file tree
Hide file tree
Showing 30 changed files with 153 additions and 139 deletions.
2 changes: 1 addition & 1 deletion examples/src/examples/animation/blend-trees-1d.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ assetListLoader.load(() => {
castShadows: true,
intensity: 1.5,
normalOffsetBias: 0.02,
shadowType: pc.SHADOW_PCF5,
shadowType: pc.SHADOW_PCF5_32F,
shadowDistance: 6,
shadowResolution: 2048,
shadowBias: 0.02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ assetListLoader.load(() => {
castShadows: true,
intensity: 1.5,
normalOffsetBias: 0.02,
shadowType: pc.SHADOW_PCF5,
shadowType: pc.SHADOW_PCF5_32F,
shadowDistance: 6,
shadowResolution: 2048,
shadowBias: 0.02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ assetListLoader.load(() => {
castShadows: true,
intensity: 1.5,
normalOffsetBias: 0.02,
shadowType: pc.SHADOW_PCF5,
shadowType: pc.SHADOW_PCF5_32F,
shadowDistance: 6,
shadowResolution: 2048,
shadowBias: 0.02
Expand Down
2 changes: 1 addition & 1 deletion examples/src/examples/animation/layer-masks.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ assetListLoader.load(() => {
castShadows: true,
intensity: 1.5,
normalOffsetBias: 0.02,
shadowType: pc.SHADOW_PCF5,
shadowType: pc.SHADOW_PCF5_32F,
shadowDistance: 6,
shadowResolution: 2048,
shadowBias: 0.02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export const controls = ({ observer, ReactPCUI, React, jsx, fragment }) => {
link: { observer, path: 'settings.shadowType' },
type: 'number',
options: [
{ v: pc.SHADOW_PCF1, t: 'PCF1' },
{ v: pc.SHADOW_PCF3, t: 'PCF3' },
{ v: pc.SHADOW_PCF5, t: 'PCF5' },
{ v: pc.SHADOW_PCF1_FLOAT16, t: 'PCF1_FLOAT16' },
{ v: pc.SHADOW_PCF3_FLOAT16, t: 'PCF3_FLOAT16' },
{ v: pc.SHADOW_PCF5_FLOAT16, t: 'PCF5_FLOAT16' }
{ v: pc.SHADOW_PCF1_32F, t: 'PCF1_32F' },
{ v: pc.SHADOW_PCF3_32F, t: 'PCF3_32F' },
{ v: pc.SHADOW_PCF5_32F, t: 'PCF5_32F' },
{ v: pc.SHADOW_PCF1_16F, t: 'PCF1_16F' },
{ v: pc.SHADOW_PCF3_16F, t: 'PCF3_16F' },
{ v: pc.SHADOW_PCF5_16F, t: 'PCF5_16F' }
]
})
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ assetListLoader.load(() => {

data.set('settings', {
shadowAtlasResolution: 1300, // shadow map resolution storing all shadows
shadowType: pc.SHADOW_PCF3, // shadow filter type
shadowType: pc.SHADOW_PCF3_32F, // shadow filter type
shadowsEnabled: true,
cookiesEnabled: true
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ export const controls = ({ observer, ReactPCUI, React, jsx, fragment }) => {
link: { observer, path: 'settings.shadowType' },
type: 'number',
options: [
{ v: pc.SHADOW_PCF1, t: 'PCF1' },
{ v: pc.SHADOW_PCF3, t: 'PCF3' },
{ v: pc.SHADOW_PCF5, t: 'PCF5' },
{ v: pc.SHADOW_PCF1_FLOAT16, t: 'PCF1_FLOAT16' },
{ v: pc.SHADOW_PCF3_FLOAT16, t: 'PCF3_FLOAT16' },
{ v: pc.SHADOW_PCF5_FLOAT16, t: 'PCF5_FLOAT16' }
{ v: pc.SHADOW_PCF1_32F, t: 'PCF1_32F' },
{ v: pc.SHADOW_PCF3_32F, t: 'PCF3_32F' },
{ v: pc.SHADOW_PCF5_32F, t: 'PCF5_32F' },
{ v: pc.SHADOW_PCF1_16F, t: 'PCF1_16F' },
{ v: pc.SHADOW_PCF3_16F, t: 'PCF3_16F' },
{ v: pc.SHADOW_PCF5_16F, t: 'PCF5_16F' }
]
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ assetListLoader.load(() => {

data.set('settings', {
shadowAtlasResolution: 1024, // shadow map resolution storing all shadows
shadowType: pc.SHADOW_PCF3, // shadow filter type
shadowType: pc.SHADOW_PCF3_32F, // shadow filter type
shadowsEnabled: true,
cookiesEnabled: true,
shadowIntensity: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const controls = ({ observer, ReactPCUI, React, jsx, fragment }) => {
binding: new BindingTwoWay(),
link: { observer, path: 'script.area.shadowType' },
options: [
{ v: pc.SHADOW_PCSS, t: 'PCSS' },
{ v: pc.SHADOW_PCF5, t: 'PCF' }
{ v: pc.SHADOW_PCSS_32F, t: 'PCSS_32F' },
{ v: pc.SHADOW_PCF5_32F, t: 'PCF_32F' }
]
})
)
Expand Down Expand Up @@ -91,8 +91,8 @@ export const controls = ({ observer, ReactPCUI, React, jsx, fragment }) => {
binding: new BindingTwoWay(),
link: { observer, path: 'script.point.shadowType' },
options: [
{ v: pc.SHADOW_PCSS, t: 'PCSS' },
{ v: pc.SHADOW_PCF5, t: 'PCF' }
{ v: pc.SHADOW_PCSS_32F, t: 'PCSS_32F' },
{ v: pc.SHADOW_PCF5_32F, t: 'PCF_32F' }
]
})
)
Expand Down Expand Up @@ -136,8 +136,8 @@ export const controls = ({ observer, ReactPCUI, React, jsx, fragment }) => {
binding: new BindingTwoWay(),
link: { observer, path: 'script.directional.shadowType' },
options: [
{ v: pc.SHADOW_PCSS, t: 'PCSS' },
{ v: pc.SHADOW_PCF5, t: 'PCF' }
{ v: pc.SHADOW_PCSS_32F, t: 'PCSS_32F' },
{ v: pc.SHADOW_PCF5_32F, t: 'PCF_32F' }
]
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ assetListLoader.load(() => {
enabled: true,
intensity: 16.0,
size: 2,
shadowType: pc.SHADOW_PCSS
shadowType: pc.SHADOW_PCSS_32F
},
point: {
enabled: true,
intensity: 4.0,
size: 2,
shadowType: pc.SHADOW_PCSS
shadowType: pc.SHADOW_PCSS_32F
},
directional: {
enabled: true,
intensity: 2.0,
size: 1,
shadowType: pc.SHADOW_PCSS
shadowType: pc.SHADOW_PCSS_32F
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ assetListLoader.load(() => {
range: 200,
castShadows: true,
shadowResolution: 2048,
shadowType: pc.SHADOW_VSM16,
shadowType: pc.SHADOW_VSM_16F,
vsmBlurSize: 20,
shadowBias: 0.1,
normalOffsetBias: 0.1
Expand Down
2 changes: 1 addition & 1 deletion examples/src/examples/graphics/ground-fog.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ assetListLoader.load(() => {
castShadows: true,
shadowDistance: 1000,
shadowResolution: 2048,
shadowType: pc.SHADOW_PCF3
shadowType: pc.SHADOW_PCF3_32F
});
app.root.addChild(dirLight);
dirLight.setLocalEulerAngles(45, 350, 20);
Expand Down
6 changes: 3 additions & 3 deletions examples/src/examples/graphics/lights-baked-a-o.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ assetListLoader.load(() => {
shadowBias: 0.2,
shadowDistance: 100,
shadowResolution: 2048,
shadowType: pc.SHADOW_PCF3,
shadowType: pc.SHADOW_PCF3_32F,
color: new pc.Color(0.7, 0.7, 0.5),
intensity: 1.6
});
Expand All @@ -115,7 +115,7 @@ assetListLoader.load(() => {
shadowBias: 0.2,
shadowDistance: 25,
shadowResolution: 512,
shadowType: pc.SHADOW_PCF3,
shadowType: pc.SHADOW_PCF3_32F,
color: pc.Color.YELLOW,
range: 25,
intensity: 0.9
Expand All @@ -135,7 +135,7 @@ assetListLoader.load(() => {
shadowBias: 0.2,
shadowDistance: 50,
shadowResolution: 512,
shadowType: pc.SHADOW_PCF3,
shadowType: pc.SHADOW_PCF3_32F,
color: pc.Color.RED,
range: 10,
intensity: 2.5
Expand Down
4 changes: 2 additions & 2 deletions examples/src/examples/graphics/lights-baked.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ light.addComponent('light', {
shadowBias: 0.2,
shadowDistance: 50,
shadowResolution: 2048,
shadowType: pc.SHADOW_PCF3,
shadowType: pc.SHADOW_PCF3_32F,
color: pc.Color.GREEN,
type: 'directional'
});
Expand All @@ -105,7 +105,7 @@ lightPoint.addComponent('light', {
shadowBias: 0.2,
shadowDistance: 50,
shadowResolution: 512,
shadowType: pc.SHADOW_PCF3,
shadowType: pc.SHADOW_PCF3_32F,
color: pc.Color.RED,
range: 100,
type: 'point'
Expand Down
2 changes: 1 addition & 1 deletion examples/src/examples/graphics/lights.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ assetListLoader.load(() => {
castShadows: true,
shadowBias: 0.05,
normalOffsetBias: 0.03,
shadowType: pc.SHADOW_PCF3,
shadowType: pc.SHADOW_PCF3_32F,
shadowResolution: 256,
range: 111,
cookieAsset: cubemapAsset,
Expand Down
16 changes: 8 additions & 8 deletions examples/src/examples/graphics/shadow-cascades.controls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export const controls = ({ observer, ReactPCUI, React, jsx, fragment }) => {
link: { observer, path: 'settings.light.shadowType' },
type: 'number',
options: [
{ v: pc.SHADOW_PCF1, t: 'PCF1' },
{ v: pc.SHADOW_PCF3, t: 'PCF3' },
{ v: pc.SHADOW_PCF5, t: 'PCF5' },
{ v: pc.SHADOW_PCF1_FLOAT16, t: 'PCF1_FLOAT16' },
{ v: pc.SHADOW_PCF3_FLOAT16, t: 'PCF3_FLOAT16' },
{ v: pc.SHADOW_PCF5_FLOAT16, t: 'PCF5_FLOAT16' },
{ v: pc.SHADOW_PCF1_32F, t: 'PCF1_32F' },
{ v: pc.SHADOW_PCF3_32F, t: 'PCF3_32F' },
{ v: pc.SHADOW_PCF5_32F, t: 'PCF5_32F' },
{ v: pc.SHADOW_PCF1_16F, t: 'PCF1_16F' },
{ v: pc.SHADOW_PCF3_16F, t: 'PCF3_16F' },
{ v: pc.SHADOW_PCF5_16F, t: 'PCF5_16F' },
{ v: pc.SHADOW_VSM8, t: 'VSM8' },
{ v: pc.SHADOW_VSM16, t: 'VSM16' },
{ v: pc.SHADOW_VSM32, t: 'VSM32' }
{ v: pc.SHADOW_VSM_16F, t: 'VSM_16F' },
{ v: pc.SHADOW_VSM_32F, t: 'VSM_32F' }
]
})
),
Expand Down
2 changes: 1 addition & 1 deletion examples/src/examples/graphics/shadow-cascades.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ assetListLoader.load(() => {
numCascades: 4, // number of cascades
shadowResolution: 2048, // shadow map resolution storing 4 cascades
cascadeDistribution: 0.5, // distribution of cascade distances to prefer sharpness closer to the camera
shadowType: pc.SHADOW_PCF3, // shadow filter type
shadowType: pc.SHADOW_PCF3_32F, // shadow filter type
vsmBlurSize: 11, // shader filter blur size for VSM shadows
everyFrame: true // true if all cascades update every frame
}
Expand Down
2 changes: 1 addition & 1 deletion examples/src/examples/physics/offset-collision.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ assetListLoader.load(() => {
castShadows: true,
intensity: 1.5,
normalOffsetBias: 0.2,
shadowType: pc.SHADOW_PCF5,
shadowType: pc.SHADOW_PCF5_32F,
shadowDistance: 12,
shadowResolution: 4096,
shadowBias: 0.2
Expand Down
9 changes: 6 additions & 3 deletions src/framework/app-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1416,9 +1416,12 @@ class AppBase extends EventHandler {
* @param {number} settings.render.lightingMaxLightsPerCell - Maximum number of lights a cell can store.
* @param {number} settings.render.lightingShadowType - The type of shadow filtering used by all shadows. Can be:
*
* - {@link SHADOW_PCF1}: PCF 1x1 sampling.
* - {@link SHADOW_PCF3}: PCF 3x3 sampling.
* - {@link SHADOW_PCF5}: PCF 5x5 sampling.
* - {@link SHADOW_PCF1_32F}
* - {@link SHADOW_PCF3_32F}
* - {@link SHADOW_PCF5_32F}
* - {@link SHADOW_PCF1_16F}
* - {@link SHADOW_PCF3_16F}
* - {@link SHADOW_PCF5_16F}
*
* @param {Vec3} settings.render.lightingCells - Number of cells along each world space axis the space containing lights
* is subdivided into.
Expand Down
18 changes: 9 additions & 9 deletions src/framework/components/light/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,16 +547,16 @@ class LightComponent extends Component {
/**
* Sets the type of shadows being rendered by this light. Can be:
*
* - {@link SHADOW_PCF1}
* - {@link SHADOW_PCF3}
* - {@link SHADOW_PCF5}
* - {@link SHADOW_PCF1_FLOAT16}
* - {@link SHADOW_PCF3_FLOAT16}
* - {@link SHADOW_PCF5_FLOAT16}
* - {@link SHADOW_PCF1_32F}
* - {@link SHADOW_PCF3_32F}
* - {@link SHADOW_PCF5_32F}
* - {@link SHADOW_PCF1_16F}
* - {@link SHADOW_PCF3_16F}
* - {@link SHADOW_PCF5_16F}
* - {@link SHADOW_VSM8}
* - {@link SHADOW_VSM16}
* - {@link SHADOW_VSM32}
* - {@link SHADOW_PCSS}
* - {@link SHADOW_VSM_16F}
* - {@link SHADOW_VSM_32F}
* - {@link SHADOW_PCSS_32F}
*
* @type {number}
*/
Expand Down
4 changes: 2 additions & 2 deletions src/framework/components/light/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
LAYERID_WORLD,
LIGHTSHAPE_PUNCTUAL,
LIGHTFALLOFF_LINEAR,
SHADOW_PCF3,
SHADOW_PCF3_32F,
SHADOWUPDATE_REALTIME
} from '../../../scene/constants.js';

Expand Down Expand Up @@ -58,7 +58,7 @@ class LightComponentData {

falloffMode = LIGHTFALLOFF_LINEAR;

shadowType = SHADOW_PCF3;
shadowType = SHADOW_PCF3_32F;

vsmBlurSize = 11;

Expand Down
4 changes: 2 additions & 2 deletions src/framework/lightmapper/bake-light-ambient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Vec3 } from '../../core/math/vec3.js';
import { random } from '../../core/math/random.js';
import { Color } from '../../core/math/color.js';
import { Entity } from '../entity.js';
import { SHADOW_PCF3 } from '../../scene/constants.js';
import { SHADOW_PCF3_32F } from '../../scene/constants.js';
import { BakeLight } from './bake-light.js';

const _tempPoint = new Vec3();
Expand All @@ -24,7 +24,7 @@ class BakeLightAmbient extends BakeLight {
shadowBias: 0.2,
shadowDistance: 1, // this is updated during shadow map rendering
shadowResolution: 2048,
shadowType: SHADOW_PCF3,
shadowType: SHADOW_PCF3_32F,
color: Color.WHITE,
intensity: 1,
bakeDir: false
Expand Down
Loading

0 comments on commit 30a788d

Please sign in to comment.