refactor: clean up renderer.py internals - #424
Merged
Merged
Conversation
Drop the two Args namedtuples and the `def f(*args)` signatures that unpacked positionally, in favour of explicit parameters. Single returns, nested defs lifted out, `transparancies` typo fixed, over-length lines wrapped. Also removes dead code found on the way: `rays` was threaded through four call levels unread, `compute_new_rays` took a `reflectance` it never used, the closest-hit argmin ran twice per bounce, and `same_shape` was computed twice per light. Adds a `Surfaces` namedtuple so points/normals/eyes stop travelling as a positional triple. No behaviour change. pytest paz/graphics/: 252 passed, 1 skipped.
oarriaga
force-pushed
the
refactor/renderer-style
branch
from
August 2, 2026 17:30
9dea724 to
481f4f3
Compare
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.
renderer.py had drifted from our style rules: two
Argsnamedtuples, severaldef f(*args)signatures unpacked positionally, nested defs, early returns, atypo. Cleaned those up, and dropped dead code found on the way —
rayswasthreaded through four call levels unread,
compute_new_raystook areflectanceit never used, the closest-hit argmin ran twice per bounce.Added a
Surfacesnamedtuple so points/normals/eyes stop travelling as apositional triple. 661 to 606 lines, no behaviour change.
pytest paz/graphics/: 252 passed, 1 skipped (GPU only) — the image/depth/gradient snapshots are the guard. Also smoke-checked the jitted render path,
render_masks, and thecompute_soft_occlusionpatch the shape-renderingexamples use.
Not doing here: splitting the
shadows=flag into separate functions (breaksthe public API and every example), and swapping in
geometry.refract(its TIRbranch differs, would change pixels). Related, for later: we compute
reflectance >= 1.0for TIR and apply it to throughput but not to the bouncedirection.