Skip to content

Commit

Permalink
fix defferredForward pass lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
hana-alice committed Sep 4, 2023
1 parent 4cc3a6f commit aff567f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cocos/rendering/custom/builtin-pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class DeferredPipelineBuilder implements PipelineBuilder {
// Lighting Pass
const lightInfo = setupLightingPass(ppl, info, useCluster);
// Deferred ForwardPass, for non-surface-shader material and transparent material
setupDeferredForward(ppl, info, lightInfo.rtName);
setupDeferredForward(ppl, info, lightInfo.rtName, useCluster);
// Postprocess
setupPostprocessPass(ppl, info, lightInfo.rtName);

Expand Down
10 changes: 6 additions & 4 deletions cocos/rendering/custom/pipeline-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export function updateForwardRes (ppl: BasicPipeline, cameraInfo: CameraInfo, is
ppl.updateDepthStencil(`ForwardDepthStencil${cameraInfo.id}`, width, height);
}

export function setupDeferredForward (ppl: BasicPipeline, cameraInfo: CameraInfo, inputColor: string): void {
export function setupDeferredForward (ppl: BasicPipeline, cameraInfo: CameraInfo, inputColor: string, clusterLighting?: boolean): void {
const area = getRenderArea(cameraInfo.camera, cameraInfo.camera.window.width, cameraInfo.camera.window.height);
const width = area.width;
const height = area.height;
Expand All @@ -255,10 +255,12 @@ export function setupDeferredForward (ppl: BasicPipeline, cameraInfo: CameraInfo
}
}

let sceneFlags = SceneFlags.OPAQUE_OBJECT | SceneFlags.PLANAR_SHADOW | SceneFlags.CUTOUT_OBJECT
| SceneFlags.DRAW_INSTANCING;
sceneFlags |= clusterLighting ? SceneFlags.CLUSTERED_LIGHTING : SceneFlags.DEFAULT_LIGHTING;

forwardPass.addQueue(QueueHint.RENDER_OPAQUE, 'deferred-forward')
.addSceneOfCamera(camera, new LightInfo(),
SceneFlags.OPAQUE_OBJECT | SceneFlags.PLANAR_SHADOW | SceneFlags.CUTOUT_OBJECT
| SceneFlags.DEFAULT_LIGHTING | SceneFlags.DRAW_INSTANCING);
.addSceneOfCamera(camera, new LightInfo(), sceneFlags);
forwardPass.addQueue(QueueHint.RENDER_TRANSPARENT, 'deferred-forward')
.addSceneOfCamera(camera, new LightInfo(), SceneFlags.TRANSPARENT_OBJECT | SceneFlags.GEOMETRY);
}
Expand Down

0 comments on commit aff567f

Please sign in to comment.