Pen-and-ink molecular visualization with real-time cross-hatching.
SketchMol renders molecular structures in an artistic pen-and-ink style, inspired by the spite cross-hatching project and the Microsoft Research paper on real-time hatching (Praun et al., 2001).
- Cross-hatching shading - 6-level progressive hatching based on lighting
- Interactive viewer - Real-time OpenGL viewer with mouse/keyboard controls
- Multiple input formats - PDB, XYZ, and SMILES strings
- CPK colors - Optional element-based coloring
- Paper textures - Customizable background textures
- Export - PNG and PDF output
conda env create -f env/sketchmol.yaml
conda activate sketchmol# From a PDB file
python sketchmol.py molecule.pdb
# From a SMILES string
python sketchmol.py "CCO" # ethanol
# From an XYZ file
python sketchmol.py structure.xyz# Render to PNG
python sketchmol.py molecule.pdb --render -o output.png
# With CPK colors
python sketchmol.py "c1ccccc1" --render --cpk-colors -o benzene.png
# Custom size
python sketchmol.py molecule.pdb --render --width 1920 --height 1080 -o hires.png| Control | Action |
|---|---|
| Arrow keys | Rotate molecule |
| WASD | Pan view |
| +/- | Zoom in/out |
| Mouse drag (left) | Rotate |
| Mouse drag (right) | Pan |
| Scroll wheel | Zoom |
| R | Reset view |
| Z | Toggle Z-axis rotation mode |
| F1/F2/F3 | Toggle auto-rotate X/Y/Z |
| Q / Esc | Quit |
--render Render to file instead of interactive viewer
-o, --output Output filename (default: molecule.png)
--width Width in pixels (default: 800)
--height Height in pixels (default: 600)
--paper Paper texture file
--ink R,G,B Ink color (default: 41,41,202)
--cpk-colors Use element-based CPK colors
--show-symbols Show element labels next to atoms
--label-size Label size: small, medium, or large (default: small)
--no-outline Disable atom outlines
--solid-render Solid shading instead of cross-hatching
--radius-scale Atom radius scale factor (default: 0.15)
- Cross-hatching technique inspired by spite/cross-hatching
- Based on "Real-Time Hatching" by Praun et al. (Microsoft Research, 2001)
MIT License - see LICENSE for details.


