Skip to content

Fix B-spline curve silhouette gradients - #1906

Draft
fknfilewalker wants to merge 8 commits into
mitsuba-renderer:masterfrom
fknfilewalker:bsplinecurve-fix
Draft

Fix B-spline curve silhouette gradients#1906
fknfilewalker wants to merge 8 commits into
mitsuba-renderer:masterfrom
fknfilewalker:bsplinecurve-fix

Conversation

@fknfilewalker

@fknfilewalker fknfilewalker commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR fixes bugs related to the bsplinecurve shape plugin in connection with the projective integrator.

  • Fixes the mismatch between texture UVs and curve parameterization UVs for the bsplinecurve shape
    that caused the projective integrator to produce wrong gradients.
  • Rebuild the position/normal partials from the consistent local frame and
    its analytic derivatives instead of the Frenet torsion, which depends on
    the discontinuous third derivative and injected spurious gradients at the
    segment borders.

Debug Views

Fixed Metal (Broken) LLVM (Broken)
grad_comparison_fixed grad_comparison_metal_broken grad_comparison_llvm_broken

@wjakob

wjakob commented Jun 24, 2026

Copy link
Copy Markdown
Member

cc @ziyi-zhang

@fknfilewalker
fknfilewalker marked this pull request as draft June 26, 2026 11:10
@fknfilewalker

Copy link
Copy Markdown
Contributor Author

Still has some issues at the curve openings.

Fixes a number of issues in the `bsplinecurve` shape plugin that made the
projective integrators produce wrong boundary and interior gradients.

* Store `ss.uv` in the primitive parameterization (segment-local `v`,
  azimuth) so that the projective integrators can reconstruct the
  foreground interaction through `pi.prim_uv`.
* Rebuild the position/normal partials from the consistent local frame and
  its analytic derivatives instead of the Frenet torsion, which depends on
  the discontinuous third derivative and injects spurious gradients at the
  segment borders.
* Bracket the silhouette azimuths on the full circle instead of a fixed
  half circle around the seed: both roots can lie on the same side, which
  silently dropped the boundary gradient of entire `v`-ranges of a bent
  tube seen head-on.
* Account for the azimuthal drift of the silhouette curve in the interior
  pdf, and for the number of roots found by the projection.
* Flip `ss.n` at concave folds so that it always points from the
  foreground to the background side of the image-space edge.
* Recover the `v`-motion of the interaction point from the full first
  fundamental form instead of projecting onto `dp_dv` alone.
* Keep grazing hits and the open curve ends when culling backfaces, and
  add the missing segment index bounds checks.
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