This is a side project I've been working on: Ambigram Generator (https://www.ambigramgenerator.me/). It generates rotational ambigrams, which are words or phrases that read the same when inverted (rotated 180 degrees).
The Technical Challenge: Why is Ambigram Generation Hard? The core challenge isn't just about flipping letters; it's about solving a complex substitution cipher problem while maintaining legibility and aesthetic coherence.
Character Pair Mapping (The Logic): The system relies on a massive, pre-rendered and manually optimized database of character pair combinations (e.g., 'A' flips to 'V' or 'L' flips to 'J'). The difficulty lies in optimizing the system to prioritize aesthetically pleasing pairings over just mechanically correct ones. Our current engine holds hundreds of pairing rules derived from hand-drawn ambigram work.
Aesthetic Coherence (The Design): Unlike a simple font swap, generating an ambigram requires that the 'A' from one side perfectly melds into a 'T' on the inverted side. We implemented a weight and stress system for each transition, preferring connections that share visual weight and line thickness.
The Feedback Loop: Early versions used rudimentary stroke merging, which failed for 90% of inputs. The current iteration uses an SVG-based rendering pipeline with custom path merging logic to smooth out the joins between characters like 'N' and 'Z' when inverted.
Key Trade-offs and Open Questions Trade-off: Speed vs. Quality: We could use a full ML/AI approach for higher flexibility, but the latency and cost would be prohibitive for a simple, fun tool. We opted for a highly optimized, rule-based system for near-instant results.
Trade-off: Font Flexibility: The system is currently tied to a single optimized, high-contrast serif typeface. Making it work across multiple fonts requires rebuilding the entire character-pair database, which is a massive undertaking.
Open Question for the Community: The current system uses a brute-force approach on the character dictionary. Has anyone here worked on a similar combinatorial design problem? I'd love input on whether a Constraint Satisfaction Problem (CSP) solver could be a more efficient long-term solution for finding valid character pairings.
We're offering this tool for fun and to revive interest in this niche art form. Feel free to try generating your own name and let me know which letter pairings look the worst, or if you have any suggestions on the SVG path smoothing logic!
Thanks!
Franklinjobs617•2h ago
I'm the creator of Ambigram Generator (https://www.ambigramgenerator.me/). It generates rotationally symmetrical ambigrams—words or phrases that read the same when inverted (rotated 180 degrees).
The Engineering Deep Dive: From SVG to 3D Print While the 2D generation relies on a complex rule-based dictionary for character pairing and SVG path merging (a significant combinatorial challenge in itself), the most interesting part for makers and engineers is the 3D functionality.
1. 3D Model Generation and WebGL: Once the optimal 2D ambigram is generated, we extrude the 2D SVG vector path into a 3D mesh. This involves:
Mesh Extrusion: Using Three.js to handle the complex geometry of the merged character paths. We implemented custom logic to ensure clean, manifold geometry, crucial for the next step.
Real-time Preview: The 3D view is rendered using WebGL, allowing users to interactively rotate the model to confirm the ambigram symmetry from all angles. We also include a feature to generate a looping GIF preview that cycles through angles, providing an immediate, shareable demonstration of the effect.
2. The Bridge to the Physical World: STL Export The generator's core utility is the ability to export the resulting 3D model as an STL file. This transforms the generated word into a physical object ready for 3D printing.
Key Challenge: STL files require closed, watertight meshes (manifold geometry). Any flaws in the initial SVG or the extrusion process (like overlapping faces or open edges) will result in a non-printable file. We spent considerable time tuning the extrusion depth and simplifying the mesh to produce robust, validated STL files.
Open Questions for the Makers/3D Community I'd appreciate any feedback on the 3D pipeline:
Slicing Optimization: Have any makers here found particular settings (e.g., specific wall thickness or infill patterns) that work best for printing these highly detailed and symmetrical text models?
WebAssembly for Geometry: Currently, all geometry processing is client-side in JS. Would integrating a C++/Rust geometry library via WebAssembly be a worthwhile effort to speed up complex mesh generation before export?
Try generating an ambigram and check out the 3D preview and STL export feature!