Skip to content

fix(rendering): add planar shadow rendering support for new render pipeline#19187

Open
UC-RX0 wants to merge 1 commit into
cocos:v3.8.8from
UC-RX0:fix/planar-shadow-new-pipeline
Open

fix(rendering): add planar shadow rendering support for new render pipeline#19187
UC-RX0 wants to merge 1 commit into
cocos:v3.8.8from
UC-RX0:fix/planar-shadow-new-pipeline

Conversation

@UC-RX0

@UC-RX0 UC-RX0 commented Jun 26, 2026

Copy link
Copy Markdown

Problem

Planar shadows render correctly in the Legacy Pipeline but do not appear at all when using the New Render Pipeline in Cocos Creator 3.8.8.

Root Cause

The new render pipeline's forward pass setup (buildForwardPass in define.ts and setupForwardPass in pipeline-define.ts) incorrectly included SceneFlags.PLANAR_SHADOW in the main opaque queue. This added planar shadow casters to the opaque render queue, causing them to be rendered with their default material instead of the planar shadow projection pass.

There was no dedicated queue for the planar-shadow phase, unlike the shadow map path which correctly uses a separate shadow-caster queue.

Fix

  1. Removed SceneFlags.PLANAR_SHADOW from the opaque queue
  2. Added a dedicated planar-shadow queue that renders when planar shadows are enabled:
    • Uses the planar-shadow phase (matching PlanarShadowQueue in legacy pipeline)
    • Includes SHADOW_CASTER flag to filter only shadow-casting models
    • Includes OPAQUE_OBJECT | CUTOUT_OBJECT flags for correct queue processing
    • Uses PLANAR_SHADOW flag for correct frustum selection in scene culling

Data Flow

Legacy Pipeline:                    New Pipeline (after fix):
  opaque queue (default)              opaque queue (default)
  ↓                                   ↓
  PlanarShadowQueue → planar-shadow   planar-shadow queue → planar-shadow
  ↓                                   ↓
  transparent queue                   transparent queue

Changes

  • cocos/rendering/custom/define.ts: +13/-1 lines (buildForwardPass)
  • cocos/rendering/custom/pipeline-define.ts: +13/-1 lines (setupForwardPass)

Fixes: #19158

Changelog

  • Fixed planar shadows not rendering when using the New Render Pipeline

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown

Too many files changed for review. (1573 files found, 100 file limit)

…peline

The new render pipeline ForwardPass incorrectly used TRANSPARENT_OBJECT and RENDER_TRANSPARENT for the planar shadow queue, causing shadow casters to never match. scene-culling.ts also filtered out PLANAR_SHADOW via kDrawMask.

This change:
- Adds PLANAR_SHADOW to kDrawMask in scene-culling.ts
- Fixes planar shadow queue in forward-pass.ts to use RENDER_OPAQUE with OPAQUE_OBJECT/CUTOUT_OBJECT
- Adds PLANAR_SHADOW and SHADOW_CASTER flags for correct model filtering

Fixes: cocos#19158
@UC-RX0 UC-RX0 force-pushed the fix/planar-shadow-new-pipeline branch from d38908f to ca0e31b Compare June 29, 2026 02:08

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1009738 bytes 1009738 bytes ✅ 0 bytes
2D All (legacy pipeline) 2675347 bytes 2675347 bytes ✅ 0 bytes
2D All (new pipeline) 2767083 bytes 2767085 bytes ⚠️ +2 bytes
(2D + 3D) All 10024081 bytes 10024083 bytes ⚠️ +2 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16843143 bytes 16843145 bytes ⚠️ +2 bytes

Interface Check Report

This pull request does not change any public interfaces !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Planar shadows do not render when using the New Render Pipeline in Cocos Creator 3.8.8

1 participant