Skip to content

Clarify MeshRasterizer zbuf as view-space depth#2023

Open
kenshi84 wants to merge 1 commit intofacebookresearch:mainfrom
kenshi84:zbuf-doc
Open

Clarify MeshRasterizer zbuf as view-space depth#2023
kenshi84 wants to merge 1 commit intofacebookresearch:mainfrom
kenshi84:zbuf-doc

Conversation

@kenshi84
Copy link
Copy Markdown

The mesh rasterizer docs said Fragments.zbuf contained NDC z values, but
the implementation preserves view-space z in MeshRasterizer.transform and
rasterizes that depth. This change aligns the documented contract with the
actual behavior and removes a few nearby inconsistencies that had drifted in
related renderer docs.

Update the mesh rasterization docs to describe zbuf as barycentrically
interpolated view-space depth rather than a raw face vertex z value. Also
clarify that MeshRasterizer.transform produces vertices with x/y in NDC
space while keeping z in view space.

Fix adjacent wording in the clipping helpers and OpenGL rasterizer docs so
they no longer describe the same depth values as world-space z or as generic
distance-from-camera values. Update the renderer getting-started note to
match the API docs.

Add a regression test that rasterizes a mesh with a perspective camera and
checks that fragments.zbuf matches interpolated view-space z, while
differing from both world-space z and projected NDC z.

This change does not modify rasterization behavior; it only corrects the
documentation and adds coverage for the existing convention.

(This whole patch was generated by Codex v0.113.0 with gpt-5.4 xhigh)

  The mesh rasterizer docs said `Fragments.zbuf` contained NDC z values, but
  the implementation preserves view-space z in `MeshRasterizer.transform` and
  rasterizes that depth. This change aligns the documented contract with the
  actual behavior and removes a few nearby inconsistencies that had drifted in
  related renderer docs.

  Update the mesh rasterization docs to describe `zbuf` as barycentrically
  interpolated view-space depth rather than a raw face vertex z value. Also
  clarify that `MeshRasterizer.transform` produces vertices with x/y in NDC
  space while keeping z in view space.

  Fix adjacent wording in the clipping helpers and OpenGL rasterizer docs so
  they no longer describe the same depth values as world-space z or as generic
  distance-from-camera values. Update the renderer getting-started note to
  match the API docs.

  Add a regression test that rasterizes a mesh with a perspective camera and
  checks that `fragments.zbuf` matches interpolated view-space z, while
  differing from both world-space z and projected NDC z.

  This change does not modify rasterization behavior; it only corrects the
  documentation and adds coverage for the existing convention.

(This whole patch was generated by Codex v0.113.0 with gpt-5.4 xhigh)
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant