feat(all): 后处理迁移

This commit is contained in:
plum
2026-04-08 16:51:47 +08:00
parent 986da8ce42
commit 4cc239d660
25 changed files with 1644 additions and 66 deletions
+149 -4
View File
@@ -41,6 +41,46 @@ export const defaultProjectInfo = (): IAppProject.Info => ({
// 后处理
effect: {
enabled: false,
// 色调映射 (ToneMappingEffect)
ToneMapping: {
// 色调映射模式:LINEAR, REINHARD, REINHARD2, OPTIMIZED_CINEON, ACES_FILMIC, AGX, NEUTRAL
mode: "ACES_FILMIC",
// 曝光度
exposure: 1.0,
// 混合模式
blendFunction: "NORMAL"
},
// 抗锯齿 (SMAAEffect)
SMAA: {
enabled: true,
// 质量预设: LOW, MEDIUM, HIGH, ULTRA
preset: "ULTRA"
},
// 环境光遮蔽 (SSAOEffect)
SSAO: {
enabled: true,
blendFunction: "MULTIPLY",
samples: 9,
rings: 7,
radius: 0.1825,
intensity: 1.0,
bias: 0.025,
fade: 0.01,
luminanceInfluence: 0.7,
minRadiusScale: 0.1,
depthAwareUpsampling: true,
resolutionScale: 0.5,
distanceThreshold: 0.97,
distanceFalloff: 0.03,
rangeThreshold: 0.0005,
rangeFalloff: 0.001,
worldDistanceThreshold: null,
worldDistanceFalloff: null,
worldProximityThreshold: null,
worldProximityFalloff: null,
colorEnabled: false,
color: "#000000",
},
// 描边线
Outline: {
enabled: true,
@@ -57,7 +97,14 @@ export const defaultProjectInfo = (): IAppProject.Info => ({
// 可见边缘的颜色
visibleEdgeColor: "#ffee00",
// 不可见边缘的颜色
hiddenEdgeColor: "#ff6a00"
hiddenEdgeColor: "#ff6a00",
// Astral postprocessing 兼容字段
pulseSpeed: 0.0,
xRay: true,
blur: true,
kernelSize: 1,
multisampling: 4,
blendFunction: "SCREEN"
},
// 抗锯齿
FXAA: {
@@ -71,7 +118,14 @@ export const defaultProjectInfo = (): IAppProject.Info => ({
// 光晕强度
strength: 1,
// 光晕半径
radius: 0
radius: 0,
// Astral postprocessing 兼容字段
intensity: 1.0,
luminanceThreshold: 0.9,
luminanceSmoothing: 0.025,
levels: 8,
mipmapBlur: true,
blendFunction: "SCREEN"
},
// 背景虚化
Bokeh: {
@@ -81,7 +135,12 @@ export const defaultProjectInfo = (): IAppProject.Info => ({
// 孔径,类似相机孔径调节
aperture: 0.00005,
// 最大模糊程度
maxblur: 0.01
maxblur: 0.01,
// Astral postprocessing 兼容字段
focusDistance: 10.0,
focusRange: 5.0,
bokehScale: 2.0,
resolutionScale: 0.5
},
// 像素风
Pixelate: {
@@ -92,6 +151,87 @@ export const defaultProjectInfo = (): IAppProject.Info => ({
normalEdgeStrength: 0.3,
// 深度边缘强度
depthEdgeStrength: 0.4,
// Astral postprocessing 兼容字段
granularity: 6,
},
// 移轴模糊 (TiltShiftEffect)
TiltShift: {
enabled: false,
offset: 0.0,
rotation: 0.0,
focusArea: 0.4,
feather: 0.3,
blendFunction: "NORMAL"
},
// 扫描线 (ScanlineEffect)
Scanline: {
enabled: false,
density: 1.25,
scrollSpeed: 0.0,
blendFunction: "OVERLAY"
},
// 亮度对比度 (BrightnessContrastEffect)
BrightnessContrast: {
enabled: false,
brightness: 0.0,
contrast: 0.0,
blendFunction: "SRC"
},
// 色差 (ChromaticAberrationEffect)
ChromaticAberration: {
enabled: false,
offset: { x: 0.002, y: 0.002 },
radialModulation: false,
modulationOffset: 0.15,
blendFunction: "NORMAL"
},
// 色深 (ColorDepthEffect)
ColorDepth: {
enabled: false,
bits: 16,
blendFunction: "NORMAL"
},
// 故障 (GlitchEffect)
Glitch: {
enabled: false,
chromaticAberrationOffset: null,
delay: { min: 1.5, max: 3.5 },
duration: { min: 0.6, max: 1.0 },
strength: { min: 0.3, max: 1.0 },
mode: "SPORADIC",
ratio: 0.85,
blendFunction: "NORMAL"
},
// 色相饱和度 (HueSaturationEffect)
HueSaturation: {
enabled: false,
hue: 0.0,
saturation: 0.0,
blendFunction: "SRC"
},
// 镜头畸变 (LensDistortionEffect)
LensDistortion: {
enabled: false,
distortion: { x: 0.0, y: 0.0 },
principalPoint: { x: 0.0, y: 0.0 },
focalLength: { x: 1.0, y: 1.0 },
skew: 0.0
},
// 冲击波 (ShockWaveEffect)
ShockWave: {
enabled: false,
amplitude: 0.05,
waveSize: 0.2,
speed: 2.0,
maxRadius: 1.0,
clickTrigger: true
},
// 暗角 (VignetteEffect)
Vignette: {
enabled: false,
offset: 0.5,
darkness: 0.5,
blendFunction: "NORMAL"
},
// 半色调
Halftone: {
@@ -223,7 +363,12 @@ class Project {
* @param {string} key 可以多层级,需用.分割,如a.b.c
*/
getKey(key: string): any {
return getNestedProperty(this.info, key);
const value = getNestedProperty(this.info, key);
if (value !== undefined) {
return value;
}
return getNestedProperty(defaultProjectInfo(), key);
}
/**