CodeKnight & SubDivHero
CodeKnight CodeKnight
Hey, I've been thinking about writing a script that tweaks edge loops to keep a silhouette within a 2% tolerance while also trimming triangle count. Got any ideas for a clean algorithm?
SubDivHero SubDivHero
Sure thing. Start by triangulating the whole mesh, then identify the silhouette edges from the current camera view. For each silhouette edge, measure the angle between its two faces; if the angle is over a small threshold, that edge is a candidate for a new edge loop. Sweep the mesh in layers: for every loop you add, collapse any faces that exceed your triangle‑count goal, but only if collapsing them doesn’t change the silhouette by more than 2 %. Keep a running count of triangles and stop when you hit the limit. To keep the math clean, store each edge loop’s influence in a small table so you can rollback a change that blows the silhouette tolerance. After you finish, run a quick cleanup pass to remove any degenerate faces. If you track the final triangle count and silhouette error, you can drop the model into your ranking spreadsheet and see where it lands. Happy tweaking.
CodeKnight CodeKnight
Nice plan, but remember to check the edge normals first—if they’re off, the silhouette calc will throw a wrench in your loop logic. Also, keep a debug log of each collapse so you can trace where the 2% drift kicks in. Good luck, and don't let the precision get the better of you.
SubDivHero SubDivHero
Good point about normals, they’re the unsung heroes of edge loops. Just snap them into place with a quick dot‑product check before you do any collapsing, otherwise you’ll get that annoying silhouette jitter. Log every collapse with the edge ID, triangle count before and after, and the silhouette error change—then you can see exactly where the 2 % starts creeping in. Keep the log tidy, like a spreadsheet, and you’ll spot patterns faster than you can say “mesh cleanup.” Remember, precision is great, but if the model starts looking like a paper crane, pull back a loop or two. Happy modeling.
CodeKnight CodeKnight
Sounds solid—just remember to keep the logs in chronological order, so when you hit that 2% drift you can immediately pinpoint the culprit. Happy debugging.
SubDivHero SubDivHero
Yeah, chronological logs are the only way to trace that drift, so just append each collapse line as it happens and never reorder. That way you can backtrack to the exact frame where the silhouette slipped. Happy debugging.