Skip to content

Scale hidden line tolerance to model size and add optional full wireframe toggle#7

Open
dirlligafu wants to merge 1 commit into
6wheel:mainfrom
dirlligafu:fix-hidden-line-depth-eps-scale
Open

Scale hidden line tolerance to model size and add optional full wireframe toggle#7
dirlligafu wants to merge 1 commit into
6wheel:mainfrom
dirlligafu:fix-hidden-line-depth-eps-scale

Conversation

@dirlligafu

@dirlligafu dirlligafu commented Jul 11, 2026

Copy link
Copy Markdown

Why?

Some models render with interior geometry visibly bleeding through the exterior ("x-ray" look, see #6) even though hidden-line removal is supposed to hide anything blocked from view. The actual cause isn't the model (normals, winding, etc. all checked out fine on the reported model). It's that the tolerance used to decide whether an edge is hidden behind a surface was a fixed absolute value, tuned for a "normal-size car" scale. Models exported at a very different unit scale (common for a lot of free/community downloads) end up with a tolerance larger than the entire model, so the occlusion test can never actually hide anything.

What was added / modified

  • renderer.py: depth_eps now defaults to a value derived from the model's own size (half_span * 0.0075) instead of a fixed 0.018, so the occlusion test scales automatically with whatever unit scale a given model was exported at.
  • Added an explicit "Show hidden lines (full wireframe, ignores what's blocked from view)" checkbox (Detail & Output section), for anyone who wants a full x-ray/wireframe render on purpose. Off by default, so the normal case is a clean render with no setup needed.
  • app.py / templates/index.html: wired the new option through global preferences, request parsing, and the render call.

Testing

Reproduced the exact issue on the model from #6, confirmed the fix resolves it, and confirmed the new toggle reproduces the old full-wireframe look on demand when turned on. Also tested against several other models at normal scale to confirm no regression (huge X4 Foundations Carrier ships and small scout vessels models, all behaved as expected)

Closes #6

Preview

All lines hidden

image

All lines visible (none hidden)

image

Extra option in section 5 :

image

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.

X-Ray

1 participant