Repository navigation
Honor camera near/far and report the Far Limit as Miss Depth - #385
Merged
Merged
Conversation
ANARI 1.1 gives perspective and orthographic cameras `near`/`far` clip distances but VisRTX ignored them, and the spec never says what `channel.depth` holds for a pixel with no hit. The renderers disagreed: fast/interactive left FLT_MAX, while debug/quality wrote the primary ray's `t.upper`, which a cutting plane could shorten to the cut distance (or 0 for a ray that never enters the visible half-space). Cameras now read `near`/`far` as clip planes measured from `position` along `direction`, and every primary ray is bounded by them. A Miss reports that ray's Far Limit: the distance along it to the far plane (far / cos for perspective, exactly far for orthographic), the ray buffer's `ray.tmax`, or FLT_MAX when nothing bounds the ray. Cutting planes no longer change what a Miss reports. An invalid ray buffer now misses with an empty interval at FLT_MAX instead of [0, 0]. Invalid near/far pairs warn and are ignored. ADR 0011 records why `far` is a plane and why unset `far` reports FLT_MAX rather than +inf; the render-pipeline glossary gains Miss, Far Limit and Miss Depth. TestCameraNearFar covers every renderer subtype.
tarcila
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ANARI 1.1 defines
near/farclip distances onperspectiveandorthographiccameras, but VisRTX ignored them. The spec also never says whatchannel.depthholds for a pixel with no hit, and the RTX renderers disagreed on it:FLT_MAX.t.upper. A cutting plane could shorten that to the cut distance, or to 0.This PR makes them consistent:
near/faras clip planes measured frompositionalongdirection, and every primary ray is bounded by them. Surfaces and volumes outside the range are clipped.far / cosθfor perspective;farfor orthographic;ray.tmaxfor the ray-buffer camera;FLT_MAXwhen nothing bounds the ray, which matches what apps see today by default.FLT_MAXinstead of[0, 0].near/far: a pair that breaks the spec's rules (0 < near < farperspective,0 ≤ near < farorthographic) produces a warning and is ignored. A value left unset is always valid.testrenderer: reports the far limit instead of a hard-coded1.0.ADR 0011 records the design choices: treating
faras a plane rather than a sphere, andFLT_MAXrather than+infwhenfaris unset. The render-pipeline glossary gains Miss, Far Limit and Miss Depth.The GL device is out of scope: its depth channel is window-space [0,1].
Testing
TestCameraNearFarruns against thedefault,debug,fast,interactiveandqualityrenderers. It covers:faris unset (misses reportFLT_MAX);far(far sphere clipped, misses reportfar / cosθ) and perspectivenear;far, and orthographicnear = 0;ray.tmax, and the invalid ray buffer;near/farpairs (warning, no clipping).