Commit 0430939
authored
feat: add custom-normals-shade example (post-4.1 shading contract) (#97)
A prop's silhouette lives or dies on which edges shade hard and which
shade smooth, and since Blender 4.1 that is mesh data: face smooth flags
plus a sharp_edge attribute. AI-generated code still emits the removed API
(mesh.use_auto_smooth, shade_auto_smooth), so this example pins the truth
on both supported versions: the legacy API is AttributeError on 4.5 LTS
and 5.1; set_sharp_from_angle marks sharp exactly the edges an
independent dihedral recompute predicts (188/388 across 3 meshes);
evaluated loop normals weld across smooth edges and split by the dihedral
across sharp ones (0.0 deviation); and per-loop custom normals survive
depsgraph evaluation within their int16 storage quantization (1.407e-04 —
asserting float-exactness is a real, caught bug).
Version-gated divergence, probed on both binaries: the legacy
shade_auto_smooth operator needs the bundled Smooth-by-Angle node-group
asset — headless on 4.5 it returns {'CANCELLED'} with the mesh untouched
(silent flat shading for scripts that ignore the return set), while 5.1
FINISHES with the NODES modifier. The data API is the portable path.
Falsified: threshold drift (exit 5, 4 extra edges), smooth flags lost
after marking (exit 6, 3.83e-01), float-exact custom normals (exit 7,
1.407e-04 vs 1e-6). Check output identical on Blender 4.5.11 LTS and
5.1.2 except the asserted operator divergence.
Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>1 parent 872a725 commit 0430939
12 files changed
Lines changed: 1571 additions & 4 deletions
File tree
- .cursor-plugin
- .github/workflows
- docs/gallery
- assets
- contact-sheets
- custom-normals-shade
- examples
- custom-normals-shade
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
| 507 | + | |
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
613 | 634 | | |
614 | 635 | | |
615 | 636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
Loading
0 commit comments