Skip to content

Fix named camera spaces - #2150

Open
AlexeySmolenchuk wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
AlexeySmolenchuk:testrender--add-transform-spaces
Open

Fix named camera spaces#2150
AlexeySmolenchuk wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
AlexeySmolenchuk:testrender--add-transform-spaces

Conversation

@AlexeySmolenchuk

Copy link
Copy Markdown
Contributor

Description

  • Fixed "camera", "screen", "NDC", and "raster" transformation spaces.
  • Moved them to named spaces and fetch on the Optix side.
  • Fixed camera FOV. Here are the before/after results for 90°.
    image
  • The code was implying that the FOV is horizontal...
void
SimpleRaytracer::camera_params(const Matrix44& world_to_camera,
                               ustringhash projection, float hfov, float hither,
                               float yon, int xres, int yres)
{
    m_world_to_camera  = world_to_camera;
    m_projection       = projection;
    m_fov              = hfov;

...but implemented as vertical

    float k    = OIIO::fast_tan(fov * float(M_PI / 360));
    cx         = right * (xres * k / yres);
    cy         = (cx.cross(dir)).normalize() * k;
  • Switched Optix texture to the cached version of ImageBuff

Tests

Most of the tests with testrender will fail because of the FOV fix and reinterpretation, but I can recalculate FOV in .xml scenes to make them look similar to previous results. It won't be a perfect match and would require updating ref images anyway.

Checklist:

  • I have read the guidelines on contributions and code review procedures.
  • I have read the Policy on AI Coding Assistants
    and if I used AI coding assistants, I have an Assisted-by: TOOL / MODEL
    line in the pull request description above.
  • I have updated the documentation if my PR adds features or changes
    behavior.
  • I am sure that this PR's changes are tested in the testsuite.
  • I have run and passed the testsuite in CI before submitting the
    PR, by pushing the changes to my fork and seeing that the automated CI
    passed there. (Exceptions: If most tests pass and you can't figure out why
    the remaining ones fail, it's ok to submit the PR and ask for help. Or if
    any failures seem entirely unrelated to your change; sometimes things break
    on the GitHub runners.)
  • My code follows the prevailing code style of this project and I
    fixed any problems reported by the clang-format CI test.

Signed-off-by: Alexey Smolenchuk <alexey.smolenchuk@gmail.com>
@AlexeySmolenchuk
AlexeySmolenchuk force-pushed the testrender--add-transform-spaces branch from fcb4507 to a2b7543 Compare August 23, 2026 23:07
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.

1 participant