Skip to content

fix(legacy): sphere light has not lighting at LDR mode - #243

Merged
star-e merged 1 commit into
cocos:v4.0.0from
troublemaker52025:fix-SphereLight-with-LDR-bug
Aug 7, 2026
Merged

fix(legacy): sphere light has not lighting at LDR mode#243
star-e merged 1 commit into
cocos:v4.0.0from
troublemaker52025:fix-SphereLight-with-LDR-bug

Conversation

@troublemaker52025

@troublemaker52025 troublemaker52025 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Re: #

Changelog


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.

@troublemaker52025

Copy link
Copy Markdown
Contributor Author

@cocos-robot run test cases

Copilot AI 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.

Pull request overview

This PR fixes a rendering bug in LDR mode for legacy light types by adding missing luminanceLDR getters so that code reading the property (e.g., UBO packing) no longer receives undefined (which can propagate as NaN).

Changes:

  • Add get luminanceLDR() to SphereLight so LDR luminance reads correctly.
  • Add get luminanceLDR() to PointLight for the same reason and consistency with other light implementations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cocos/render-scene/scene/sphere-light.ts Adds the missing luminanceLDR getter so LDR luminance reads don’t return undefined.
cocos/render-scene/scene/point-light.ts Adds the missing luminanceLDR getter to prevent undefined reads and align with other light classes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1014561 bytes 1014634 bytes ⚠️ +73 bytes
2D All (legacy pipeline) 2682237 bytes 2682310 bytes ⚠️ +73 bytes
2D All (new pipeline) 2774076 bytes 2774149 bytes ⚠️ +73 bytes
(2D + 3D) All 10031391 bytes 10031464 bytes ⚠️ +73 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16867805 bytes 16867878 bytes ⚠️ +73 bytes

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -13006,8 +13006,9 @@
                 /**
                  * @en The luminance of the light source in LDR mode
                  * @zh LDR 模式下光源的亮度
                  */
+                get luminanceLDR(): number;
                 set luminanceLDR(value: number);
                 /**
                  * @en The AABB bounding box of the lighting area
                  * @zh 受光源影响范围的 AABB 包围盒
@@ -13181,8 +13182,9 @@
                 /**
                  * @en The luminance of the light source in LDR mode.
                  * @zh LDR 模式下光源的亮度。
                  */
+                get luminanceLDR(): number;
                 set luminanceLDR(value: number);
                 /**
                  * @en The AABB bounding box of the lighting area.
                  * @zh 受光源影响范围的 AABB 包围盒。

@troublemaker52025

Copy link
Copy Markdown
Contributor Author

测试方法:

  • 打开cocos-test-projects/lighting/lighting-ldr 场景,旧版本没有球面光光照效果

*测试场景需要合并
cocos/cocos-test-projects#944

@troublemaker52025

Copy link
Copy Markdown
Contributor Author
无标题

@star-e
star-e merged commit 2c91155 into cocos:v4.0.0 Aug 7, 2026
15 checks passed
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.

4 participants