Skip to content

feat(rendering): add transparent object support for reflection probe - #249

Open
xubing0906 wants to merge 13 commits into
cocos:v4.0.0from
xubing0906:v4.0.0-probe-transparency
Open

feat(rendering): add transparent object support for reflection probe#249
xubing0906 wants to merge 13 commits into
cocos:v4.0.0from
xubing0906:v4.0.0-probe-transparency

Conversation

@xubing0906

@xubing0906 xubing0906 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Re: cocos/cocos-engine#16297

Summary

  • Add supportTransparency option to ReflectionProbe component (CUBE mode)
  • When enabled, use RGBA16F intermediate RT for correct alpha blending, then convert to RGBE via a fullscreen pass
  • Support both Custom/Builtin pipeline and Legacy ForwardPipeline
  • Add CC_USE_FLOAT_PROBE_OUTPUT shader macro to skip RGBE encoding and tone mapping in float probe path

Changes

  • Component/render-scene layer: supportTransparency property, useFloatIntermediateRT(), RGBA16F intermediate texture lifecycle
  • Custom pipeline: float RT resource allocation, probe convert pass (_buildProbeConvertPass), transparent queue (SceneFlags.BLEND) for probe rendering
  • Legacy pipeline: _renderConvertPass fullscreen quad in ReflectionProbeStage, transparent object collection in RenderReflectionProbeQueue
  • Shaders: CC_USE_FLOAT_PROBE_OUTPUT branch in 5 chunk files + skybox effect; new probe-rgbe-convert.effect (technique 0 for Custom, technique 1 for Legacy)

Test plan

  • Enable supportTransparency on a CUBE probe, verify transparent objects appear in reflection
  • Disable supportTransparency, verify behavior unchanged (transparent objects excluded, RGBE encoding direct)
  • Test Planar probe with transparency enabled
  • Test both Custom pipeline and Legacy ForwardPipeline
  • Verify no regression on existing opaque-only reflection probes

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@xubing0906 xubing0906 added the investigation Investigate the impact on the code base label Aug 6, 2026
@xubing0906
xubing0906 requested review from jk20012001 and star-e August 6, 2026 02:46
The effect file changes from the previous fix were not committed:
add pass: copy-pass to technique 1 and rename sampler to probeInputTex.
Models with bakeToReflectionProbe disabled were still rendered into
reflection probes in the custom/builtin pipeline.
@xubing0906
xubing0906 force-pushed the v4.0.0-probe-transparency branch from ffa403e to 005773c Compare August 6, 2026 03:20
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1015290 bytes 1018570 bytes ⚠️ +3280 bytes
2D All (legacy pipeline) 2683021 bytes 2686313 bytes ⚠️ +3292 bytes
2D All (new pipeline) 2774976 bytes 2776493 bytes ⚠️ +1517 bytes
(2D + 3D) All 10032418 bytes 10036591 bytes ⚠️ +4173 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16868836 bytes 16873012 bytes ⚠️ +4176 bytes

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -5639,8 +5639,16 @@
          * @zh 快速烘焙不会进行卷积。
          */
         get fastBake(): boolean;
         set fastBake(val: boolean);
+        /**
+         * @en Whether to support transparent objects in reflection probe rendering.
+         * When enabled, uses RGBA16F intermediate RT for correct alpha blending.
+         * @zh 是否支持半透明物体参与反射探针渲染。
+         * 开启后使用 RGBA16F 中间 RT 以支持正确的 alpha 混合。
+         */
+        get supportTransparency(): boolean;
+        set supportTransparency(val: boolean);
         set cubemap(val: TextureCube | null);
         get cubemap(): TextureCube | null;
         get probe(): renderer.scene.ReflectionProbe;
         /**
@@ -45497,9 +45505,9 @@
          * @zh 设置probe信息
          * @param probe
          * @param frameBuffer
          */
-        setUsageInfo(probe: renderer.scene.ReflectionProbe, frameBuffer: gfx.Framebuffer, reflectionCamera?: renderer.scene.Camera): void;
+        setUsageInfo(probe: renderer.scene.ReflectionProbe, frameBuffer: gfx.Framebuffer, outputFrameBuffer?: gfx.Framebuffer | null, reflectionCamera?: renderer.scene.Camera): void;
         destroy(): void;
         clearFramebuffer(camera: renderer.scene.Camera): void;
         render(camera: renderer.scene.Camera): void;
         activate(pipeline: ForwardPipeline, flow: ReflectionProbeFlow): void;

@xubing0906

Copy link
Copy Markdown
Contributor Author

@cocos-robot run test cases

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

@xubing0906, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS FAIL
ios PASS PASS PASS
mac PASS PASS PASS

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

@xubing0906, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
windows PASS PASS PASS
android PASS PASS PASS
wechatgame PASS FAIL FAIL

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

Labels

investigation Investigate the impact on the code base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant