NSQ Limitations & Roadmap#
This page is the canonical, single source of truth for the non-sequential
(NSQ) engine’s pre-release status, its capability envelope, its known
limitations, and the development roadmap. The package __init__ docstring,
the gallery overview, and the
developer guide all link here rather than
keeping their own copies. See NSQ Validation Report for what the engine
is actually checked against in CI (closed-form benchmarks and invariants).
Pre-release status#
NSQ has never shipped in a tagged Optiland release — it exists on
master as an actively-developed feature. The public API may therefore
still change without a deprecation cycle; once NSQ ships in a tagged
release, Optiland’s usual API-stability guarantee applies. Differentiability
is interior-correct for refractive and reflective surfaces;
visibility gradients are not yet supported (see Limitations).
Capability envelope#
NSQ ships two engines for two jobs:
Forward mode (NumPy backend). 1 × 107+ rays at
max_depth16, fully batched with live ray compaction and hard pixel binning. This is the production path for illumination and stray-light analysis, and the only backend that supports bounded ghost-path splitting.Gradient mode (PyTorch backend). ~1 × 105 rays at
max_depth16 on a single GPU. A full autograd graph is built through the Monte Carlo loop, so memory scales asO(num_rays × max_depth)(compaction is disabled to keep fixed tensor shapes). This is the path for optimization and ML layers.
Switch engines through optiland.backend:
import optiland.backend as be
be.set_backend("torch") # enables gradient mode
Physics coverage, as of this page:
Capability |
Status |
|---|---|
Fresnel reflection/refraction |
Differentiable, both backends. |
AR / thin-film coatings |
Implemented via |
Mirror reflectance |
Required, explicit (constant, wavelength-dependent, or coating). No implicit perfect-mirror default. |
Bulk (Beer-Lambert) absorption |
Implemented, differentiable w.r.t. |
Diffuse/scatter BSDFs |
Lambertian (with a differentiable reflect/transmit split via
|
Medium sidedness |
Geometric ( |
Detectors |
Unified intersection pass, |
Rare-path sampling |
Importance biasing (both backends), bounded splitting (NumPy only), unbiased Russian roulette. |
Reproducibility |
Counter-based PCG32, bit-identical random decisions across
|
Photometric units |
Radiometric core (W) with a lumen/lux conversion layer
( |
Diagnostics |
Self-diagnosing |
Volumetric scattering |
Not implemented (roadmap item 5). |
Polarization |
Not implemented (roadmap item 6). |
Visibility gradients |
Zero (roadmap item 1) — see Limitations below. |
Limitations#
Visibility gradients are zero — the biggest physics gap. When a ray silhouette moves across a surface boundary (vignetting, occlusion, which-surface-hit), that boundary contributes no gradient. The detached-sample / attached-weight estimator differentiates interior interactions (Fresnel, refraction, dispersion, BSDF lobes, absorption) but not the discrete visibility decision. Reparameterization (roadmap #1) closes this gap. A dedicated test (
tests/nonsequential/test_nsq_geometric_gradients.py) explicitly asserts this behaviour.Mesh geometry is forward-only. Analytic conics (
ConicGeometry,SphereGeometry,ParaboloidGeometry) are differentiable;MeshGeometryis not — callingbackward()through a mesh interaction will raise.Source geometry is not differentiable. Source sampling (aperture position, emission angle, emitter extent) runs in NumPy, so
aperture_radius,half_angle_degand the extended-source dimensions cannot carry gradients. Passing arequires_gradtensor for one of these raisesNotImplementedErrorrather than detaching silently, so a dead design variable is never mistaken for a live one. Sourcetotal_fluxis differentiable.SpectralDetectorextents are likewise detached (the detector accumulates into a NumPy histogram);IrradianceDetectorextents andtotal_fluxare differentiable.No polarization. Stokes tracking is not present yet (roadmap #6), so polarization-sensitive coatings (
BaseCoatingPolarized) raise rather than being silently averaged to a scalar.No volumetric scattering. Bulk absorption (Beer-Lambert) is implemented; a photon being scattered within a volume, rather than only attenuated, is not (roadmap #5).
Gradient-mode memory cap. The ~1 × 105-ray envelope is a hard constraint of the naive autograd strategy. Path Replay Backpropagation (roadmap #3) lifts this cap.
No acceleration structure. Intersection is
O(rays × surfaces)per bounce on both backends — fine for the scene sizes NSQ targets today, but a scaling limit for very high surface-count scenes. Abenchmarks/nonsequential/harness measures this rather than estimating it, so a future BVH/batched-traversal effort has a baseline (roadmap #7).
Roadmap#
Ordered by priority. Each item names the seam or reference paper.
Reparameterization for visibility gradients — warped-area reparameterization (Loubet et al. 2019; Bangaru et al. 2020) so silhouette / vignetting / which-surface-hit gradients become correct. Closes the single biggest physics limitation.
Optimization integration — wire NSQ into Optiland’s
Variable/ operand system and optimizers for end-to-end illumination and stray-light design.Path Replay Backpropagation (PRB) — constant-memory, unbiased gradients via the
gradient_modeseam already present inTorchBackend(Vicini et al. 2021); lifts the ~1 × 105-ray cap.GUI integration — NSQ scene building and visualization in
optiland_gui.Volumetric scattering — beyond the Beer-Lambert absorption already implemented, actual in-volume scatter events.
Polarization — Stokes tracking through Fresnel coatings, done properly.
Acceleration structure — a BVH or batched-traversal scheme, sized against the
benchmarks/nonsequential/measurements rather than guessed.Dr.Jit / Mitsuba 3 / OptiX backend — high-performance
TracerBackendplugin consuming the sameSceneIRthe reference backends interpret.
Get involved#
Try it and tell us what you build. If you use NSQ for illumination design, stray-light analysis, or differentiable optics, open a GitHub issue and describe your use case — your feedback directly shapes the roadmap.
Contribute. The roadmap items above (especially reparameterization, PRB, and
GUI integration) are open for contributors. Development happens on master;
PRs target master directly. The canonical engine reference is the
developer guide.
References#
Loubet, Holzschuch & Jakob, Reparameterizing Discontinuous Integrands for Differentiable Rendering, SIGGRAPH Asia 2019.
Bangaru, Li & Durand, Unbiased Warped-Area Sampling for Differentiable Rendering, SIGGRAPH Asia 2020.
Vicini, Speierer & Jakob, Path Replay Backpropagation of Light Paths, SIGGRAPH 2021.