Skip to content

docs: refactor skybox setup docs to use AssetType.HDR loading - #3085

Open
luo2430 wants to merge 1 commit into
galacean:mainfrom
luo2430:fix/docs
Open

docs: refactor skybox setup docs to use AssetType.HDR loading#3085
luo2430 wants to merge 1 commit into
galacean:mainfrom
luo2430:fix/docs

Conversation

@luo2430

@luo2430 luo2430 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
  • Replace 6-face texture loading with single HDR file loading
  • Add textureDecodeRGBM flag for HDR output format
  • Remove BimAnt HDRI reference, keep only Poly Haven
  • Simplify cube texture creation instructions with link to dedicated page

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Summary by CodeRabbit

  • Documentation
    • Updated English and Chinese skybox guides to reference cube texture creation instructions.
    • Added TypeScript examples showing how to load HDR assets, enable RGBM decoding, create a skybox material, and apply it as the scene background.
    • Updated cube texture guidance to reference Poly Haven as the sole source for free HDR images.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3192e451-d441-491d-a522-0a1a0b697708

📥 Commits

Reviewing files that changed from the base of the PR and between 8a44f5a and 19c336d.

📒 Files selected for processing (4)
  • docs/en/graphics/background/sky.mdx
  • docs/en/graphics/texture/cube.mdx
  • docs/zh/graphics/background/sky.mdx
  • docs/zh/graphics/texture/cube.mdx
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/en/graphics/texture/cube.mdx
  • docs/zh/graphics/texture/cube.mdx
  • docs/zh/graphics/background/sky.mdx

Walkthrough

Updated English and Chinese graphics documentation to use Poly Haven as the sole HDR source, link skybox instructions to cube texture guidance, and show HDR-based skybox setup with RGBM decoding.

Changes

HDR Documentation Guidance

Layer / File(s) Summary
Poly Haven HDR source guidance
docs/{en,zh}/graphics/{background/sky.mdx,texture/cube.mdx}
Skybox pages now link to cube texture creation guidance. Cube texture pages list Poly Haven as the only HDR image source.
HDR skybox setup examples
docs/{en,zh}/graphics/background/sky.mdx
TypeScript examples load HDR resources as TextureCube objects, enable RGBM decoding, create SkyBoxMaterial objects, and assign the skybox to the scene background.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit checks the skybox page,
HDR clouds now turn the stage.
Poly Haven marks the way,
RGBM lights the scene today.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main documentation change: updating skybox setup guidance to use AssetType.HDR loading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

docs/en/graphics/background/sky.mdx

Parsing error: Expression expected.

docs/en/graphics/texture/cube.mdx

Parsing error: Expression expected.

docs/zh/graphics/background/sky.mdx

Parsing error: Expression expected.

  • 1 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.38%. Comparing base (7b8a3c8) to head (19c336d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3085      +/-   ##
==========================================
- Coverage   78.39%   78.38%   -0.01%     
==========================================
  Files         870      870              
  Lines       95035    95035              
  Branches     9489     9492       +3     
==========================================
- Hits        74498    74497       -1     
- Misses      20377    20378       +1     
  Partials      160      160              
Flag Coverage Δ
unittests 78.38% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

GuoLei1990

This comment was marked as outdated.

@luo2430 luo2430 changed the title docs(graphics): remove broken BimAnt HDRI links across sky and cubetexture docs docs(graphics): remove broken BimAnt HDRI links across sky and cube texture docs Jul 30, 2026
@luo2430

luo2430 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@GuoLei1990

  1. 关于操作步骤我的考虑是页面很简单,与代码示例比对一下就知道选哪个,而且由于是外部网站,未来可能会有变更。如果要改,我觉得提一下分辨率的要求差不多了,目前我尝试下来分辨率超过512*512就会有明显形变,这似乎与web标准有关。
  2. 关于代码示例是可以简单改动一下,虽然倒腾出来也不难,但dev/2.0中似乎已经放弃了这个loader,后续是怎么打算的呢?

GuoLei1990

This comment was marked as outdated.

@zhuxudong

Copy link
Copy Markdown
Member

@luo2430

  • 2.0 通过TextureLoader 统一处理"tex", "png", "jpg", "webp", "jpeg", "hdr"等资产,概念更加收敛,且都支持编辑器操作。
  • 关于文档,感谢指正“BimAnt HDRI” 的失效问题,但是不要透出“HDRI-to-CubeMap“三方工具,我们不推荐6张图的方式加载天空盒(弱化这层概念,2.0已经删除),更不推荐通过外部工具转换

@luo2430

luo2430 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@luo2430

  • 2.0 通过TextureLoader 统一处理"tex", "png", "jpg", "webp", "jpeg", "hdr"等资产,概念更加收敛,且都支持编辑器操作。
  • 关于文档,感谢指正“BimAnt HDRI” 的失效问题,但是不要透出“HDRI-to-CubeMap“三方工具,我们不推荐6张图的方式加载天空盒(弱化这层概念,2.0已经删除),更不推荐通过外部工具转换

@zhuxudong 有相关hdr天空盒的代码示例吗?还是api还在计划当中?

import {
  BackgroundMode,
  GalaceanEngine,
  PrimitiveMesh,
  Scene,
  SkyBoxMaterial,
  TextureCube,
  TextureCubeFace,
} from "@luo2430/galacean-utils";
import nx from "../skybox/nx.png?url";
import ny from "../skybox/ny.png?url";
import nz from "../skybox/nz.png?url";
import px from "../skybox/px.png?url";
import py from "../skybox/py.png?url";
import pz from "../skybox/pz.png?url";

export function createBackground(scene: Scene, engine: GalaceanEngine): void {
  const background = scene.background;
  background.mode = BackgroundMode.Sky;
  const skyMaterial = new SkyBoxMaterial(engine);
  background.sky.material = skyMaterial;
  background.sky.mesh = PrimitiveMesh.createCuboid(engine);

  const faceUrls = [px, nx, py, ny, pz, nz];
  const faceImages: HTMLImageElement[] = [];
  let loadedCount = 0;

  faceUrls.forEach((url, i) => {
    const img = new Image();
    img.crossOrigin = "anonymous";
    img.onload = () => {
      faceImages[i] = img;
      loadedCount++;
      if (loadedCount === 6) {
        const textureCube = new TextureCube(engine, img.width);
        textureCube.setImageSource(TextureCubeFace.PositiveX, faceImages[0]!);
        textureCube.setImageSource(TextureCubeFace.NegativeX, faceImages[1]!);
        textureCube.setImageSource(TextureCubeFace.PositiveY, faceImages[2]!);
        textureCube.setImageSource(TextureCubeFace.NegativeY, faceImages[3]!);
        textureCube.setImageSource(TextureCubeFace.PositiveZ, faceImages[4]!);
        textureCube.setImageSource(TextureCubeFace.NegativeZ, faceImages[5]!);
        skyMaterial.texture = textureCube;
      }
    };
    img.src = url;
  });
}

我目前是这样搞的,还是没有脱离原来的方案,且依旧存在分辨率高于512*512就有明显形变的问题

@GuoLei1990 GuoLei1990 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🫧 尘小沫

结论

本轮对同一目标 HEAD 做了完整增量复审:代码范围仍是 main@7b8a3c8976ab3222c8d2201c33b9cc13f9121a96...4da838989593ca2c21bed1f81e7832f5477dd315 的 4 个 MDX;上次 review 后的新增量是仓库成员对官方文档方向的明确约束,以及作者随后对 HDR 天空盒方案的追问。阻塞级别为 P1,合入前需修复:0 个 P0、1 个 P1、0 个新的 P2/P3。实际 review 动作为 REQUEST_CHANGES;目标 HEAD 为 4da838989593ca2c21bed1f81e7832f5477dd315。自动 CR 不替代人工 Reviewer 的合入门禁,修复后仍需人工审核确认。

已关闭问题清单

  • 转换器导出形态与脚本契约不明确(原 P2)— 仍保持关闭。 作者 2026-07-30T06:46:04Z 对外部页面易漂移的解释成立,工具当前输出也与 main 的六面加载顺序一致;本轮不再讨论“如何使用该工具”。下面的新问题来自后续仓库成员对“官方文档是否应推荐该工具”的权威约束,和原问题不是同一件事。
  • PR 标题中的 cubetexture 拼写(原 P3)— 已修复。 当前标题已使用 cube texture

问题

  • [P1] 删除官方不推荐的第三方转换入口docs/en/graphics/background/sky.mdx:39docs/zh/graphics/background/sky.mdx:39 新增的 callout 会把 HDRI-to-CubeMap 变成官方推荐的天空盒创建路径;但仓库成员 zhuxudong 已在 2026-07-30T07:23:25Z 明确要求不要在文档透出该工具,并说明项目不推荐六面图片加载和外部转换。代码复核也表明,mainTextureCubeLoader 虽然仍能消费六个图片 URL,但“运行时仍支持”不等于“官方应推荐其上游第三方生产流程”;dev/2.0 已由统一 TextureLoader 直接处理 hdr,六面脚本也已从对应文档删除。当前写法会让用户进入项目不拥有、产品方向不认可且会随外站漂移的转换协议。请删除中英文两条新增 callout,并同步移除 PR 描述中“新增转换工具指引”的承诺;不要为它增加 compatibility 说明、wrapper 或第二条转换路径。受支持的 Cube Texture/HDR 创建事实应继续由 Cube Texture Creation 章节与相应版本的资产管线拥有,Sky 只消费并链接该契约。

架构、熵增与测试治理

沿修改链路向上,权威 owner 是相应版本的引擎/编辑器资产管线:main 由 Cube Texture Creation 文档与 TextureCubeLoader 定义六面图片契约,dev/2.0 则由统一 TextureLoader 定义 tex/png/jpg/webp/jpeg/hdr 输入;外部转换站点不拥有 Galacean 的公开产品契约。向下,Sky 文档和 SkyBoxMaterial 只是 Cube Texture 的消费方,不应反向创建另一套来源与转换规范。

改动前,HDR 来源与编辑器导入步骤已在中英文 Sky/Cube Texture 页面重复维护,本次同一失效链接需要四处同步删除正是双 owner 的直接证据;改动后运行时状态、状态机、校验和兼容分支净增为 0,但在下游 Sky 又新增了一条外部转换事实,文档层的转换概念与协议 owner 净增 1。应保留 docs/{en,zh}/graphics/texture/cube.mdx 的 Creation 章节作为创建事实唯一 owner,删除 Sky 中重复的 HDR 来源、导入与本次新增转换细节,只保留到 Cube Texture 创建契约的链接;删除后的数据流为“受支持的资产输入/编辑器管线 → Cube Texture 创建契约 → Sky 消费”,无需新增同步层或第三份真相。

本 PR 未替换生产契约,因此没有失效测试、fixture、mock 或 snapshot 需要为旧路径保留,也不得为旧文档示例增加 legacy/compat 生产逻辑。当前唯一失败检查仍是未触达本次 MDX 链路的 Text/TypedText 视觉差异(0.002604%),不归因于本次变更。

@GuoLei1990 GuoLei1990 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🫧 尘小沫

结论

本轮完整增量复审了 main@7b8a3c8976ab3222c8d2201c33b9cc13f9121a96...064ee0db85e91c174ddb60570a0931870a65004c 的 4 个 MDX、相对上次审查 HEAD 4da8389 的重写增量、PR 会话与 CI,并沿 HDR 来源/导入 → Cube Texture 创建契约 → Sky 消费链路各追一层。上一轮 P1 的文档代码已修复;当前阻塞级别为非阻塞:0 个 P0/P1、2 个 P2、0 个 P3。实际 review 动作为 COMMENTED;目标 HEAD 为 064ee0db85e91c174ddb60570a0931870a65004c。自动 CR 不替代人工 Reviewer 的合入门禁,仍需人工审核确认。

已关闭问题清单

  • 转换器导出形态与脚本契约不明确(原 P2)— 不再适用。 作者对外部页面易漂移的解释仍成立,且 064ee0d 已从中英文 Sky 文档删除转换器入口;当前交付不再建立这条转换协议,因此不得改写为分辨率说明、六面格式说明或 compatibility 路径。
  • PR 标题中的 cubetexture 拼写(原 P3)— 已修复。 当前标题保持 cube texture
  • 官方文档推荐第三方转换器(原 P1,代码交付面)— 已修复。 064ee0d 的完整 diff 只删除四处 BimAnt 链接,HDRI-to-CubeMap 已不再出现在文档正文;下方 P2 仅处理尚未同步的 PR/commit 元信息,不重复提出已修复的文档入口。

问题

  • [P2] 清理仍宣称新增第三方转换器的 PR 与 commit 说明 — PR 描述开头、Current/New behavior 段落以及唯一 commit 064ee0d 的正文仍写着 “Add HDRI-to-CubeMap converter link”,但当前完整 diff 已没有该链接,且仓库成员已明确不推荐这条路径。这会让 Reviewer、release note 与后续 git log 记录一项从未交付、方向上也已否决的行为。请把 PR 描述与 commit 正文收口为“删除失效的 BimAnt 链接并同步中英文文档”;不要为了让说明成立而重新加入转换器链接、wrapper 或兼容说明。
  • [P2] 让 Cube Texture 创建页成为 HDR 来源与导入步骤的唯一 ownerdocs/en/graphics/background/sky.mdx:18-23docs/zh/graphics/background/sky.mdx:18-23 仍重复维护 docs/{en,zh}/graphics/texture/cube.mdx 已拥有的 Poly Haven 来源、TextureCube(.hdr) 导入步骤和同一张操作图。本次同一个失效链接必须在 Sky/Cube × 中/英文四处修改,已经给出了实际漂移证据。请保留 Cube Texture 的 Creation/创建章节作为权威 owner,删除 Sky 中重复的下载来源、导入流程和图片,只保留指向该创建章节的链接;删除后的链路应为“外部 HDR/编辑器资产管线 → Cube Texture 创建契约 → SkyBox 消费”。

架构、熵增与测试治理

上游来源事实由 Poly Haven 与编辑器资产管线拥有,当前外链实测返回 200;中间公开创建契约应由 docs/{en,zh}/graphics/texture/cube.mdx 与目标分支的 TextureCubeLoader 拥有;下游 SkyBoxMaterial.texture 和 Sky 文档只消费 TextureCube,不应反向拥有来源、转换或导入协议。相对上次审查 HEAD,本次删除第三方转换器后,转换协议/外部 owner 净减 1,运行时状态、状态机、校验、兼容分支与抽象净增均为 0;相对 base,Sky/Cube 双 owner 数量仍未下降,PR/commit 元信息还形成一份与最终 diff 冲突的陈旧叙事。保留 Cube Texture 创建契约并按上方方向删除 Sky 副本后,无需同步层或第三份真相。

本 PR 未替换生产契约,也没有失效测试、fixture、mock 或 snapshot 需要为了旧路径保留;不得为历史说明或旧示例新增 legacy fallback、镜像状态或第二条转换/校验路径。当前 CI 的唯一链路失败仍是三次一致的 Text/TypedText 视觉差异 0.00260416666667%,改动未触达该代码或资产;lint、三平台 build、其余 e2e 分片和 codecov patch 均通过,因此不把该失败归因于本次 MDX 增量。

@zhuxudong

Copy link
Copy Markdown
Member

@luo2430
不需要这么麻烦,1.6 写法如下:

 engine.resourceManager
    .load<TextureCube>({
      type: AssetType.HDR,
      url: "***.hdr",
    })
    .then((texture) => {
      skyMaterial.texture = texture;
      // HDR output is in RGBM format.
      skyMaterial.textureDecodeRGBM = true;
    });

GuoLei1990

This comment was marked as outdated.

@luo2430

luo2430 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@luo2430 不需要这么麻烦,1.6 写法如下:

 engine.resourceManager
    .load<TextureCube>({
      type: AssetType.HDR,
      url: "***.hdr",
    })
    .then((texture) => {
      skyMaterial.texture = texture;
      // HDR output is in RGBM format.
      skyMaterial.textureDecodeRGBM = true;
    });

@zhuxudong 感谢答复,已在 1.6.13 中验证可用,但 dev/2.0 中已经删除了 AssetType.HDR 及其loader逻辑,又该怎么实现呢?

@zhuxudong

Copy link
Copy Markdown
Member

@luo2430 2.0 更简单方便,统一使用AssetType.Texture 替代 Texture2DTextureCubeHDR

GuoLei1990

This comment was marked as outdated.

@luo2430

luo2430 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@luo2430 2.0 更简单方便,统一使用AssetType.Texture 替代 Texture2DTextureCubeHDR

@zhuxudong 能指点一下吗?目前dev/2.0的画面是一片白。

1.6.13

  engine.resourceManager.load<TextureCube>({
    type: AssetType.HDR,
    url: "/suburban_soccer_park_4k.hdr",
  }).then((texture) => {
    const skyMaterial = new SkyBoxMaterial(engine);
    skyMaterial.texture = texture;
    skyMaterial.textureDecodeRGBM = true;
    scene.background.mode = BackgroundMode.Sky;
    scene.background.sky.material = skyMaterial;
    scene.background.sky.mesh = PrimitiveMesh.createCuboid(engine);
  });

dev/2.0

  engine.resourceManager.load<TextureCube>({
    type: AssetType.Texture,
    url: "/suburban_soccer_park_4k.hdr",
  }).then((texture) => {
    const skyMaterial = new SkyBoxMaterial(engine);
    skyMaterial.texture = texture;
    scene.background.mode = BackgroundMode.Sky;
    scene.background.sky.material = skyMaterial;
    scene.background.sky.mesh = PrimitiveMesh.createCuboid(engine);
  });

@GuoLei1990 GuoLei1990 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🫧 尘小沫

结论

本轮完整增量复审了 main@7b8a3c8976ab3222c8d2201c33b9cc13f9121a96...8a44f5afe0324a9d695d6f574d8e69a8edc42a8d 的 4 个 MDX、相对上一轮同 HEAD 新增的作者回复、PR 元信息与 CI,并沿 HDR 来源/导入 → Cube Texture 创建契约 → Sky 运行时消费链路各追一层。代码 HEAD 未变化;最新回复完整验证并展示了 main/1.6.13 的正确消费契约,但没有把它写回文档,也没有清理与最终 diff 冲突的 PR 描述,因此上一轮两个 P2 均未关闭。本轮阻塞级别为非阻塞:0 个 P0/P1、2 个 P2、0 个 P3。当前 Reviewer GuoLei1990 与作者 luo2430 不同,但因没有 P0/P1,实际 review 动作为 COMMENTED;目标 HEAD 为 8a44f5afe0324a9d695d6f574d8e69a8edc42a8d。自动 CR 不替代人工 Reviewer 的合入门禁,仍需人工审核确认。

已关闭问题清单

  • 转换器导出形态与脚本契约不明确(原 P2)— 不再适用。 作者关于外部页面易漂移的解释成立,且当前完整 diff 不再建立第三方转换协议;不得改写为分辨率、六面格式或 compatibility 说明。
  • PR 标题中的 cubetexture 拼写(原 P3)— 已修复。 当前标题保持 cube texture
  • 官方文档推荐第三方转换器(原 P1,代码交付面)— 已修复。 中英文正文均没有 HDRI-to-CubeMap 入口;本轮不再讨论如何使用该工具。
  • Sky/Cube Texture 重复拥有 HDR 来源与导入步骤(原 P2)— 已修复。 8a44f5a 删除了 Sky 中的 Poly Haven、导入流程和重复图片,只保留到 Cube Texture Creation/创建章节的链接,创建事实已收口到 Cube Texture 页。
  • 旧 commit 说明宣称新增第三方转换器(原 P2 的 commit 部分)— 已修复。 8a44f5a 的 headline/body 已改为去重、删除失效链接与链接权威创建章节;同一问题的 PR 描述部分仍未修复,见下方问题。

问题

  • [P2] 在 main 的 Sky 页补回 1.6.13 支持的 HDR 消费示例docs/en/graphics/background/sky.mdxdocs/zh/graphics/background/sky.mdx@@ -34,31 +30,6 hunk 整体删除了 “Code to Set Skybox/代码设置天空盒”,而相邻的程序化天空仍保留脚本示例;Cube Texture 页的脚本只展示六张图片如何得到 TextureCube,没有覆盖单 HDR 的支持路径、SkyBoxMaterialbackground.sky 接线。目标 main 的 packages/core/package.json 是 1.6.13;AssetType.HDRHDRLoader 把单个 .hdr 转成 TextureCube 并编码为 RGBM,而 SkyBoxMaterial.textureDecodeRGBM 默认是 false。作者最新回复已经给出并验证了完整代码。请把这段 1.6.13 消费侧契约写回中英文 Sky 页:AssetType.HDR + url 加载 TextureCube,赋给 skyMaterial.texture,设置 textureDecodeRGBM = true,再绑定 background.sky.material/mesh;来源和编辑器导入继续只由 Cube Texture 页拥有。本轮对 dev/2.0 的实际代码复核显示,直接 .hdrTextureLoader._decodeHDR 产出 Texture2D,而 SkyBoxMaterial.texture 仍要求 TextureCube,这与作者报告的白屏一致,不能作为 main 文档删除消费示例的替代契约;该版本问题应在其分支单独收口,不要在 main 增加跨版本 wrapper、六面 fallback 或 compatibility 路径。
  • [P2] 同步仍宣称新增第三方转换器的 PR 描述 — 当前 PR 描述的开头、Current behavior 和 New behavior 仍写着 “Add HDRI-to-CubeMap converter link”,但完整 diff 与唯一 commit 都已改为删除该方向,并完成了 Sky/Cube 去重和旧脚本删除。这会误导 Reviewer、release note 与后续检索,并形成一份与交付内容冲突的元信息真相。请按最终交付收口描述:删除失效 BimAnt 链接、让 Cube Texture Creation 成为创建步骤 owner,并在完成上一条后记录 1.6.13 支持的 Sky HDR 消费示例;不要为了让旧描述成立而恢复转换器或兼容说明。

架构、熵增与测试治理

在目标 main/1.6.13 链路中,上游来源事实由 Poly Haven 拥有,编辑器导入与通用创建说明由 docs/{en,zh}/graphics/texture/cube.mdx 拥有,运行时 HDR → TextureCube 转换由 HDRLoader 拥有;其 RGBM 产物契约由 HDRLoader._linearToRGBMSkyBoxMaterial.textureDecodeRGBM 共同限定。下游 Sky 页只应拥有 TextureCube → SkyBoxMaterial → background.sky 的消费接线,不应复制来源、导入或六面转换协议。dev/2.0 当前的直接 HDR 加载链路产出 Texture2D,并非 main 的 HDR → TextureCube owner;其 Sky 接线需在对应版本解决,不能催生 main 的跨版本同步层。

相对 base,本 PR 已把来源/导入文档 owner 从 Sky 与 Cube 两处收敛为 Cube 一处,第三方转换器 owner 保持为 0,生产状态、状态机、校验、兼容分支和抽象概念净增均为 0;但 Sky 的程序化消费契约文档 owner 从 1 个减为 0,并仍保留 1 份与最终 diff 冲突的 PR 描述。最新会话没有新增生产状态或第三份真相。按上方方向恢复单一的 1.6.13 消费示例并清理描述后,链路会收敛为“来源/支持的资产输入 → HDRLoader 或编辑器资产管线 → Cube Texture 创建契约 → Sky 消费”,无需 mirror、wrapper 或 legacy 路径。

本 PR 没有生产代码或测试变更,也没有失效 test、fixture、mock 或 snapshot 需要为旧六面路径保留;不得为了旧示例、旧描述、dev/2.0 的未闭合路径或跨版本测试新增 compatibility branch、legacy fallback、镜像状态或第二条转换/校验路径。CI 中 lint、三平台 build、codecov 与前三个 e2e 分片均通过;唯一失败是三次一致的 Text/TypedText 视觉差异 0.00260416666667%,改动未触达对应代码或资产,因此不归因于本次 MDX 增量。

- Replace 6-face texture loading with single HDR file loading
- Add textureDecodeRGBM flag for HDR output format
- Remove BimAnt HDRI reference, keep only Poly Haven
- Simplify cube texture creation instructions with link to dedicated page
@luo2430

luo2430 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@GuoLei1990@zhuxudong 的示例启发,我想到了可以在dev/2.0中使用ktx2作为天空盒纹理,纯代码下也有合适的工具链和工作流,而且效果比我的旧方案好的多,也不会出现分辨率大于512*512时的形变。我想做更多的探讨,如果你们可以接纳这个方案,那文档也许要添加一些新的内容。

@luo2430 luo2430 changed the title docs(graphics): remove broken BimAnt HDRI links across sky and cube texture docs docs: refactor skybox setup docs to use AssetType.HDR loading Jul 31, 2026
GuoLei1990

This comment was marked as outdated.

@luo2430

luo2430 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

生成命令

ktx create --format R8G8B8_SRGB --cubemap --encode basis-lz --assign-tf srgb px.png nx.png py.png ny.png pz.png nz.png output.ktx2

参数说明

  • --format必填。指定像素格式,天空盒推荐 R8G8B8_SRGB
  • --cubemap:可选。启用后表示生成立方体贴图,必须传入 6 个文件,顺序为 px nx py ny pz nz(即 +X, -X, +Y, -Y, +Z, -Z)。
  • --encode:可选。压缩编码,推荐 basis-lzuastc,galacean用的ktx2必须选一个,否则无法正常渲染。
  • --assign-tf:可选。指定传输函数,不写时会提示并使用默认 srgb;显式写出可避免交互提示。

重要:天空盒不要生成 mipmap

天空盒纹理不需要 mipmap,因此不要加 --generate-mipmap,否则渲染时会出现立方体的轮廓伪影。

加载与渲染代码

engine.resourceManager.load<TextureCube>({
  type: AssetType.KTX2,
  url: "/grass-4096_uastc.ktx2",
}).then((texture) => {
  const skyMaterial = new SkyBoxMaterial(engine);
  skyMaterial.texture = texture;
  scene.background.mode = BackgroundMode.Sky;
  scene.background.sky.material = skyMaterial;
  scene.background.sky.mesh = PrimitiveMesh.createCuboid(engine);
});
2026-08-01.144329.mp4

@zhuxudong 1.6.13和dev/2.0都适用,你觉得可以作为主推方式之一吗?

@GuoLei1990 GuoLei1990 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🫧 尘小沫

结论

本轮完整增量复审了 main@7b8a3c8976ab3222c8d2201c33b9cc13f9121a96...19c336d0bcbe9ece427a61f1a9926aab21708006 的 4 个 MDX、相对上一轮同 HEAD 新增的 KTX2 方案讨论、PR 元信息与 CI,并沿 HDR 来源/创建 → AssetType.HDR/HDRLoader 转换 → SkyBoxMaterial/背景消费链路各追一层。目标 HEAD 没有新增代码或文档变更,最新 KTX2 回复尚未进入 diff;本轮未发现新的 P0/P1/P2/P3,代码阻塞级别为非阻塞。当前 Reviewer GuoLei1990 与作者 luo2430 不同,但因没有 P0/P1,实际 review 动作为 COMMENTED;目标 HEAD 为 19c336d0bcbe9ece427a61f1a9926aab21708006。GitHub 当前仍保留历史 CHANGES_REQUESTED 门禁,本次自动 CR 不执行 APPROVE,也不替代人工 Reviewer 的合入门禁,仍需人工审核确认。

已关闭问题清单

  • 转换器导出形态与脚本契约不明确(原 P2)— 不再适用。 作者 2026-07-30T06:46:04Z 关于外部页面易漂移的解释成立,且当前完整 diff 没有建立第三方转换协议;不得改写为分辨率、六面格式或 compatibility 说明。
  • PR 标题中的 cubetexture 拼写(原 P3)— 已修复。 当前标题为 docs: refactor skybox setup docs to use AssetType.HDR loading,术语和交付方向一致。
  • 官方文档推荐第三方转换器(原 P1)— 已修复。 当前中英文正文均没有 HDRI-to-CubeMap 入口,也没有恢复外部转换 wrapper 或第二条协议。
  • Sky/Cube Texture 重复拥有 HDR 来源与导入步骤(原 P2)— 已修复。 Sky 页只链接 Cube Texture Creation/创建章节,Poly Haven、编辑器导入步骤和操作图继续由 Cube Texture 页唯一维护。
  • 交付元信息仍宣称新增第三方转换器(原 P2)— 已修复。 当前 PR 标题、描述和唯一 commit 19c336d 均按最终交付记录单 HDR 加载、RGBM 解码、删除 BimAnt 与创建步骤收口,不再形成与 diff 冲突的元信息真相。
  • main 的 Sky 页缺失 1.6.13 HDR 消费示例(原 P2)— 已修复。 19c336d 在中英文 Sky 页补回 AssetType.HDR + url → TextureCube → SkyBoxMaterial.texture,显式设置 textureDecodeRGBM = true,并完成 background.sky.material/mesh 接线;与目标分支实际 API 一致。

架构、熵增与测试治理

目标 main 对应 1.6.13:上游 HDR 来源由 Poly Haven 拥有,编辑器导入与通用 Cube Texture 创建说明由 docs/{en,zh}/graphics/texture/cube.mdx 拥有;运行时 AssetType.HDRHDRLoader 处理,单 HDR 被转换为 TextureCube 并由 _linearToRGBM 编码。下游 Sky 页只拥有 TextureCube → SkyBoxMaterial → background.sky 的消费接线,SkyBoxMaterial.textureDecodeRGBM 负责启用对应解码契约。

本轮新增会话提出 KTX2 备选路线。实际核对 main 与当前 dev/2.0 后,两者都由 AssetType.KTX2/KTX2Loader 拥有加载协议,并在转码结果包含 6 个 face 时产出 TextureCube;但 ktx create 的输入、色彩格式、压缩编码与 mipmap 策略属于尚未写入本 PR 的候选资产生产协议。它没有改变当前 HDR 文档交付,也不应在未决策时成为 Sky 页的第二个创建 owner;若后续正式采用,应在独立变更中由 Cube Texture 创建文档和 KTX2 加载/测试契约统一收口,Sky 只消费并链接该权威路径。

相对 base,本 PR 将 HDR 来源/编辑器创建说明从 Sky 与 Cube 两个文档 owner 收敛为 Cube 一个,将 Sky 的六面 URL 消费示例替换为 1.6.13 已支持的单 HDR 路径,并移除 BimAnt 外部来源;文档层减少了重复 owner 和一条 Sky 六面转换表达。生产 owner、持久状态、状态机、校验、兼容分支与抽象概念净增均为 0,没有 mirror、wrapper、legacy fallback 或第三份真相;最新 KTX2 讨论也没有形成代码或文档 owner。

本 PR 没有生产代码或测试变更,也没有因权威路径替换而需要保留的失效 test、fixture、mock 或 snapshot,更没有为旧测试增加 compatibility 生产逻辑。同一目标 HEAD 的 lint、三平台 build、codecov 与前三个 e2e 分片通过;唯一失败仍是未触达本次 MDX 链路的 Text/TypedText 视觉差异,因此不归因于本次增量。

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants