Skip to content

[field] Fixing GetSceneBounds including the bounds of a field without samples - #47

Merged
sherholz merged 1 commit into
OpenPathGuidingLibrary:develfrom
wantonsushi:fix-unset-scene-bounds
Nov 8, 2026
Merged

sherholz merged 1 commit into
OpenPathGuidingLibrary:develfrom
wantonsushi:fix-unset-scene-bounds

Conversation

@wantonsushi

Copy link
Copy Markdown
Contributor

Found this bug when calling SurfaceVolumeField::getSceneBounds() without calling SetSceneBounds(). getSceneBounds() merges the surface and volume field's bounds, even if there are no volume samples. In this case, m_sceneBounds is then either uninitialized, or stale, since resetField() keeps the old bounds.

You can reproduce this bug in a scene without volumes by calling Update with surface samples only, GetSceneBounds() returns the surface bounds extended by uninitialized memory. Likewise, after Reset(), a field that gets no new samples still adds its old bounds.

The fix is to initialize and reset m_sceneBounds as embree::empty, that way merging is a no-op.

… samples

Signed-off-by: Euan Hughes <realeuanhughes@gmail.com>

@sherholz sherholz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would be interested how you found these problems in a practical use case.

@sherholz
sherholz merged commit 1f6af85 into OpenPathGuidingLibrary:devel Nov 8, 2026
2 checks passed
@wantonsushi

Copy link
Copy Markdown
Contributor Author

@sherholz I've been adding OpenPGL to my renderer, noting the bugs I find along the way. This came up while I was debugging: I called GetSceneBounds() without setting the bounds, and Valgrind caught it. In the end my renderer sets the bounds and never calls GetSceneBounds(). So I didn't hit it in a practical case, and I concede this is more of a cleanup than anything.

#48 I found by looking for other uninitialized BBoxes.

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.

2 participants