threejs-lighting

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Lighting and Shadows

光照与阴影

Use the project's installed versions and existing architecture. These instructions supplement the user's task; they do not authorize unrelated changes or external actions.
Establish the intended mood and material readability before adding lights. For a PBR subject, test an environment plus a controlled key light. Metallic surfaces need reflected surroundings; increasing ambient intensity is not a substitute for meaningful reflection.
Use environment preprocessing and mapping appropriate to the renderer/version. Decide whether background and illumination should share an image. Dispose owned preprocessing resources and replaced environments without releasing shared loader cache entries.
Enable shadows only on lights and objects that need them. Tighten directional/spot shadow coverage before raising map resolution. Inspect the shadow camera with helpers; adjust bias and normal bias in relation to scene scale. Excessive bias detaches contact shadows. Point-light shadows require multiple views and can be expensive.
Choose baked lighting for static scenes when dynamic lights add little value. Keep shadow updates demand-driven for static arrangements where supported. Add contact-shadow approximations only when they remain believable during interaction.
Verify shadow acne, detached feet, thin surfaces, moving objects at shadow-frustum edges, dark metallic surfaces, and texture seams. Compare the scene with and without shadows on a target device before accepting the cost.
使用项目已安装的版本和现有架构。这些说明用于补充用户任务,并不授权进行无关更改或外部操作。
在添加灯光之前,先确定预期的氛围和材质可读性。对于 PBR 主体,测试环境光与受控主光的组合。金属表面需要反射周围环境;提高环境光强度不能替代有意义的反射。
采用适合当前 renderer 和版本的环境预处理与映射方式。决定背景和照明是否共用同一张图像。释放自行拥有的预处理资源以及被替换的环境资源,但不要释放共享的 loader 缓存条目。
仅在需要阴影的灯光和对象上启用阴影。先收紧 directional light 或 spot light 的阴影覆盖范围,再提高 shadow map 的分辨率。使用 helper 检查 shadow camera,并根据场景规模调整 bias 和 normal bias。过大的 bias 会使接触阴影与物体分离。Point light 阴影需要从多个视角渲染,成本可能很高。
当动态灯光带来的收益很小时,为静态场景选择烘焙光照。在支持的情况下,让静态布置的阴影更新由需求驱动。仅当接触阴影在交互过程中仍然可信时,才添加近似效果。
检查 shadow acne、脚部与地面分离、薄表面、处于 shadow frustum 边缘的移动对象、深色金属表面以及纹理接缝。接受其性能开销之前,在目标设备上比较启用和禁用阴影时的场景表现。

API reference

API 参考

Consult the official documentation for exact signatures and revision-specific behavior. If documentation access is unavailable, inspect installed types/source and state any remaining uncertainty.
有关准确的函数签名和特定版本的行为,请查阅官方文档。如果无法访问文档,请检查已安装的类型定义或源代码,并说明仍然存在的不确定性。