diff --git a/cocos/rendering/custom/framework.ts b/cocos/rendering/custom/framework.ts index aea332c7ab2..92de3a19a6f 100644 --- a/cocos/rendering/custom/framework.ts +++ b/cocos/rendering/custom/framework.ts @@ -33,21 +33,12 @@ import { PipelineSettings } from './settings'; // Editor preview begin //----------------------------------------------------------------- let editorPipelineSettings: PipelineSettings | null = null; -let pipelineCamera: Camera | null = null; -let pipelineCameraUsePostProcess = false; let forceResize = false; export function setEditorPipelineSettings ( settings: PipelineSettings | null, - camera: Camera | null | undefined, ): void { editorPipelineSettings = settings; - if (settings && camera) { - pipelineCamera = camera; - pipelineCameraUsePostProcess = camera.usePostProcess; - } else if (!settings) { - pipelineCamera = null; - } forceResize = true; } @@ -55,10 +46,6 @@ export function getEditorPipelineSettings (): PipelineSettings | null { return editorPipelineSettings; } -export function getEditorPipelineCamera (): Camera | null { - return pipelineCamera; -} - //----------------------------------------------------------------- // Editor preview end //----------------------------------------------------------------- @@ -85,12 +72,6 @@ export function dispatchResizeEvents (cameras: Camera[], builder: PipelineBuilde return; } - // For editor preview - if (pipelineCamera && pipelineCamera.usePostProcess !== pipelineCameraUsePostProcess) { - pipelineCameraUsePostProcess = pipelineCamera.usePostProcess; - forceResize = true; - } - for (const camera of cameras) { if (!camera.window.isRenderWindowResized() && !forceResize) { continue; diff --git a/cocos/rendering/post-process/passes/fsr-pass.ts b/cocos/rendering/post-process/passes/fsr-pass.ts index 89617ee60f8..b9353c1282a 100644 --- a/cocos/rendering/post-process/passes/fsr-pass.ts +++ b/cocos/rendering/post-process/passes/fsr-pass.ts @@ -46,7 +46,7 @@ export class FSRPass extends SettingPass { const input0 = this.lastPass!.slotName(camera, 0); const easu = `FSR_EASU${cameraID}`; passContext - .addRenderPass('fsr-easu', `CameraFSR_EASU_Pass${cameraID}`) + .addRenderPass('post-process', `CameraFSR_EASU_Pass${cameraID}`) .setPassInput(input0, 'outputResultMap') .addRasterView(easu, Format.RGBA8) .blitScreen(0) @@ -54,7 +54,7 @@ export class FSRPass extends SettingPass { const slot0 = this.slotName(camera, 0); passContext - .addRenderPass('fsr-rcas', `CameraFSR_RCAS_Pass${cameraID}`) + .addRenderPass('post-process', `CameraFSR_RCAS_Pass${cameraID}`) .setPassInput(easu, 'outputResultMap') .addRasterView(slot0, Format.RGBA8) .blitScreen(1) diff --git a/editor/assets/default_renderpipeline/builtin-pipeline-settings.ts b/editor/assets/default_renderpipeline/builtin-pipeline-settings.ts index a42962f1acb..cb1c98833a0 100644 --- a/editor/assets/default_renderpipeline/builtin-pipeline-settings.ts +++ b/editor/assets/default_renderpipeline/builtin-pipeline-settings.ts @@ -90,8 +90,7 @@ export class BuiltinPipelineSettings extends Component { return; } if (this._editorPreview) { - const camera = this.getComponent(Camera)!.camera; - rendering.setEditorPipelineSettings(this._settings, camera); + rendering.setEditorPipelineSettings(this._settings); } else { this._disableEditorPreview(); } @@ -102,7 +101,7 @@ export class BuiltinPipelineSettings extends Component { } const current = rendering.getEditorPipelineSettings(); if (current === this._settings) { - rendering.setEditorPipelineSettings(null, null); + rendering.setEditorPipelineSettings(null); } } diff --git a/editor/assets/default_renderpipeline/builtin-pipeline.ts b/editor/assets/default_renderpipeline/builtin-pipeline.ts index 311e9548a09..73238086027 100644 --- a/editor/assets/default_renderpipeline/builtin-pipeline.ts +++ b/editor/assets/default_renderpipeline/builtin-pipeline.ts @@ -136,30 +136,24 @@ class CameraConfigs { function setupPostProcessConfigs( pipelineConfigs: PipelineConfigs, - camera: renderer.scene.Camera, settings: PipelineSettings, cameraConfigs: CameraConfigs, ) { - cameraConfigs.enableDOF = camera.usePostProcess - && pipelineConfigs.supportDepthSample + cameraConfigs.enableDOF = pipelineConfigs.supportDepthSample && settings.depthOfField.enabled && settings.depthOfField.material !== null; - cameraConfigs.enableBloom = camera.usePostProcess - && settings.bloom.enabled + cameraConfigs.enableBloom = settings.bloom.enabled && settings.bloom.material !== null; - cameraConfigs.enableColorGrading = camera.usePostProcess - && settings.colorGrading.enabled + cameraConfigs.enableColorGrading = settings.colorGrading.enabled && settings.colorGrading.material !== null && settings.colorGrading.colorGradingMap !== null; - cameraConfigs.enableFXAA = camera.usePostProcess - && settings.fxaa.enabled + cameraConfigs.enableFXAA = settings.fxaa.enabled && settings.fxaa.material !== null; - cameraConfigs.enablePostProcess = camera.usePostProcess - && pipelineConfigs.useFloatOutput + cameraConfigs.enablePostProcess = pipelineConfigs.useFloatOutput && (cameraConfigs.enableDOF || cameraConfigs.enableBloom || cameraConfigs.enableColorGrading @@ -185,14 +179,13 @@ function setupCameraConfigs( cameraConfigs.settings = camera.pipelineSettings ? camera.pipelineSettings : defaultSettings; - setupPostProcessConfigs(pipelineConfigs, camera, cameraConfigs.settings, cameraConfigs); + setupPostProcessConfigs(pipelineConfigs, cameraConfigs.settings, cameraConfigs); if (isEditorView) { const editorSettings = rendering.getEditorPipelineSettings(); - const pipelineCamera = rendering.getEditorPipelineCamera(); - if (editorSettings && pipelineCamera) { + if (editorSettings) { cameraConfigs.settings = editorSettings; - setupPostProcessConfigs(pipelineConfigs, pipelineCamera, + setupPostProcessConfigs(pipelineConfigs, cameraConfigs.settings, cameraConfigs); } } @@ -472,7 +465,7 @@ if (rendering) { } // Radiance - if (this._cameraConfigs.enableHDR) { + if (this._configs.useFloatOutput) { ppl.addRenderTarget(`Radiance${id}`, Format.RGBA16F, width, height); } else if (this._cameraConfigs.enableShadingScale) { ppl.addRenderTarget(`Radiance${id}`, Format.RGBA8, width, height); @@ -1100,7 +1093,7 @@ if (rendering) { const fsrColorName = `FsrColor${id}`; - const easuPass = ppl.addRenderPass(nativeWidth, nativeHeight, 'fsr-easu'); + const easuPass = ppl.addRenderPass(nativeWidth, nativeHeight, 'post-process'); easuPass.addRenderTarget(fsrColorName, LoadOp.CLEAR, StoreOp.STORE, this._clearColorTransparentBlack); easuPass.addTexture(ldrColorName, 'outputResultMap'); easuPass.setVec4('cc_cameraPos', this._configs.platform); // We only use cc_cameraPos.w @@ -1108,7 +1101,7 @@ if (rendering) { .addQueue(QueueHint.OPAQUE) .addFullscreenQuad(fsrMaterial, 0); - const rcasPass = ppl.addRenderPass(nativeWidth, nativeHeight, 'fsr-rcas'); + const rcasPass = ppl.addRenderPass(nativeWidth, nativeHeight, 'post-process'); rcasPass.addRenderTarget(colorName, LoadOp.CLEAR, StoreOp.STORE, this._clearColorTransparentBlack); rcasPass.addTexture(fsrColorName, 'outputResultMap'); rcasPass.setVec4('cc_cameraPos', this._configs.platform); // We only use cc_cameraPos.w @@ -1308,3 +1301,4 @@ if (rendering) { rendering.setCustomPipeline('Builtin', new BuiltinPipelineBuilder()); } // if (rendering) + diff --git a/editor/assets/effects/pipeline/post-process/fsr.effect b/editor/assets/effects/pipeline/post-process/fsr.effect index 863f9593ca6..1b0e5766334 100644 --- a/editor/assets/effects/pipeline/post-process/fsr.effect +++ b/editor/assets/effects/pipeline/post-process/fsr.effect @@ -5,7 +5,7 @@ CCEffect %{ - passes: - vert: vs frag: fs-easu - pass: fsr-easu + pass: post-process rasterizerState: cullMode: none depthStencilState: @@ -13,7 +13,7 @@ CCEffect %{ depthWrite: false - vert: vs frag: fs-rcas - pass: fsr-rcas + pass: post-process rasterizerState: cullMode: none depthStencilState: