Skip to content

Vulkan RT: smooth vertex-normal shading and normal-pool offset fix - #14

Merged
brianmk merged 2 commits into
fix/vulkan-ortho-two-sided-ringfrom
fix/vulkan-smooth-normals
Sep 11, 2026
Merged

Vulkan RT: smooth vertex-normal shading and normal-pool offset fix#14
brianmk merged 2 commits into
fix/vulkan-ortho-two-sided-ringfrom
fix/vulkan-smooth-normals

Conversation

@brianmk

@brianmk brianmk commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Coin-side counterpart of brianmk/FreeCAD-vulkan#30.

Changes

  • Normal pool stores each triangle's three vertex normals; the ray-query tracer
    barycentric-interpolates them (SBT closest-hit uses the averaged vertex normal)
    so curved solids shade smoothly.
  • Fix ensureNormalPoolCapacity(): growing the pool reset normalPoolUsed to 0,
    so every command that triggered a grow got offset 0 and read the last-written
    geometry's normals (the cylinder cap picked up the sphere's radial normals and
    shaded as a per-triangle fan). Preserve existing records across a grow.
  • Fall back to the viewport clear color for the RT sky when no gradient is set.
  • Skip the overlay depth clear for full-frame overlays (selection / preselect)
    so highlights are not drawn over occluding geometry.
  • Re-key a cached geometry only when the geometry matches, so an overlay command
    reusing a traced command's draw-list slot no longer restarts path tracing.
  • Grant contents: write to the documentation workflow so
    peaceiris/actions-gh-pages can publish the gh-pages branch (the default
    GITHUB_TOKEN is read-only, which was failing the default-branch run with a
    403).

Verification

  • Pool offsets before: box=0, cylinder=0, sphere=0. After: box=0, cylinder=48,
    sphere=4368.
  • Path-traced render: cylinder cap is a smooth uniform disk (fan gone).
  • Coin, FreeCADGui, FreeCADMain build green; changed TUs compile clean
    under clang++ -Werror.

- The normal pool now stores each triangle's three vertex normals and the
  ray-query tracer barycentric-interpolates them (the SBT closest-hit path
  uses the averaged vertex normal, since GL_EXT_ray_tracing exposes no
  barycentrics), so curved solids shade smoothly instead of per-triangle.
- Fix ensureNormalPoolCapacity(): growing the pool reset normalPoolUsed to
  zero, so every command that triggered a grow was assigned offset 0 and
  read the last-written geometry's normals -- the cylinder cap picked up
  the sphere's radial normals and shaded as a per-triangle fan.  Preserve
  the existing records across a grow and stop resetting the used counter.
- Fall back to the viewport clear color for the RT sky when no background
  gradient is configured.
- Skip the overlay depth clear for full-frame overlays (selection and
  preselect highlights) so they are not drawn over occluding geometry.
- Re-key a cached geometry only when the geometry matches, so an overlay
  command reusing a traced command's draw-list slot no longer restarts
  path-tracing accumulation.
The default GITHUB_TOKEN is read-only, so peaceiris/actions-gh-pages
failed with a 403 pushing the generated site to the gh-pages branch.
@brianmk
brianmk merged commit e0d4948 into fix/vulkan-ortho-two-sided-ring Sep 11, 2026
8 checks passed
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.

1 participant