RectLight: textured light under a non-uniform scale samples and looks up the texture with the unscaled size

未关闭
#331 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
57/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp

调研方向

Read lib/rendering/pbr/light/RectLight.cc and Light.cc, especially RectLight::update(), updateParamAndTransforms(), and updateTransforms(). Reproduce the mismatch with a textured RectLight scaled by (2, 1, 1) and compare light-only with BSDF-only sampling. Done means both sampling paths agree for the scaled textured light, as they do for the unscaled equivalent.

由索引模型根据 Issue 内容生成。

描述

Summary. A textured RectLight whose node_xform scales it non-uniformly samples and looks up its texture with the unscaled size: light sampling and BSDF sampling disagree. Without the texture, or without the scale, both agree. Version 2026.29.1, scalar mode.

Reproduce. Diffuse floor, RectLight with width 1, height 1, a texture, scale(2, 1, 1) in node_xform, max_depth 1:

light light_samples only bsdf_samples only
width 1, scale(2, 1, 1), textured 0.0907 0.0715
width 2, no scale, textured 0.0892 0.0891

Cause. RectLight::update() (lib/rendering/pbr/light/RectLight.cc) sets mHalfWidth/mHalfHeight from the attributes and passes them by value to updateParamAndTransforms() (Light.cc). That function first calls updateTransforms(), which for a non-uniform scale multiplies mWidth/mHeight (and mHalfWidth/mHalfHeight) by the scale, and then builds the texture uv mapping (getScaleOffset) from the stale, unscaled values it was given. So sample() maps uv in [0, 1] to the middle part of the light only, while reporting the density of the whole area, and intersect() gives uv outside [0, 1] on the outer parts.

Fix (untested). Compute the uv mapping after updateTransforms(), e.g. pass the scaled half sizes, or set the uv scale and offset from the members after the call.

主要语言
CMake
星标
4.7k
派生
321
平均合并
13 分钟
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenMoonRay/openmoonray 的其他 Issue

查看 OpenMoonRay/openmoonray 的全部 Issue

相似的 Issue

更多 Computer Graphics Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。