3D and Materials: twisted walls and bevels are drawn back to front

At 180° and 360° of twist, Extrude & Bevel and Inflate drew some wall
strips in the wrong order, and a far strip showed through a near one.
Each strip ran the whole length of an outline edge and was sorted by
the depth of its center, while a twisted wall can cross it far from
that center. The caps were sorted the same way.

Twisted walls and bevels are now drawn in pieces about as long as a
wall slice is wide (fewer near the 32,768-facet limit), and twisted
bevel steps turn at most 6° each, as wall slices do. A cap, or
Inflate's flat back, that faces the viewer is drawn after the walls,
and edge-on pieces of a twisted wall keep their own depth. Pieces that
face the viewer are drawn where their strip as a whole faces away, so
a twisted solid seen from behind shows its walls' corners around the
back cap. Untwisted solids give the same facets as on main.

Over 80 twisted squares, the facet seen over a point lay up to 79.7 pt
behind a nearer facet on main and now lies at most 5.0 pt behind.
"Twisted" in 72 pt type, extruded with a 360° twist, takes 12,311
facets instead of 7,622 and 3.1 ms instead of 1.9 ms.

Docs: docs/three-d.md.
This commit is contained in:
dotCooCoo
2026-10-16 04:04:51 +07:00
committed by bflatastic
parent 04ed30a23d
commit 446ccb1fd0
3 changed files with 347 additions and 51 deletions
+3
View File
@@ -121,6 +121,9 @@ out, perspective). No Adobe software, assets, presets or bevel shapes were used.
- The bevel shapes and their names are our own; custom bevel paths are not supported.
- Visibility is a painter's algorithm: faces of a closed solid turned away are left out, the rest drawn back to
front. Concave solids seen at steep angles can overlap wrongly; open (hollow) solids show both sides.
Twisted walls and bevels are drawn in pieces about as long as a wall slice is wide (fewer near the limit of
32,768 facets), and a cap or flat back turned toward the viewer is drawn over them. The piece drawn on top can
still lie a few points behind another nearby piece.
- Shading is flat per facet: an inflated rim seen almost edge-on shows faint banding where the facets get finer.
- Paths and compound paths only: convert type, images and groups to outlines first. One 3D effect per object.
- Curves are followed within 1/2000 of the shape's size (at least 0.05 pt), so a small curve takes a few points