A modern, interactive web application that brings the ancient Japanese art of Suminagashi (paper marbling) to your browser. Create beautiful, flowing patterns with dynamic color palettes using cutting-edge web technologies.
Suminagashi (ๅขจๆตใ, "floating ink") is a traditional Japanese paper marbling technique that dates back to the 12th century. Artists drop ink onto water's surface, manipulate the patterns with brushes or breath, then transfer the design onto paper. This digital recreation captures the essence of this meditative art form.
- Interactive Canvas: Click anywhere to create marbling drops
- Vertical Tine Tool: Carve elegant vertical deformations into existing patterns
- Smooth Falloff: Non-linear quintic smoothing for natural edges
- Adjustable Strength: Control displacement intensity (0-400 pixels)
- Variable Sharpness: Adjust influence radius and concentration (1-256)
- Diminishing Returns: Prevents over-carving with cumulative displacement limits
- Dual Interaction Modes: Toggle between Drops and Tine modes
- Keyboard Shortcut: Press
Tto switch modes instantly - Visual Feedback: Clear mode indicators and status text
- Keyboard Shortcut: Press
- 15 Beautiful Color Palettes: Carefully curated themes including:
- Traditional Japanese Suminagashi (indigo & gray)
- Turkish Ebru Classic (vibrant traditional colors)
- Venetian Marble (warm stone tones)
- Cherry Blossom (soft pink gradients)
- Ocean, Forest, Sunset, and more!
- Dynamic Color Selection: Each drop randomly selects from themed palettes
- Real-time Marbling Simulation: Drops interact to create organic patterns
- Screenshot Capture: Save your artwork as PNG images
- Responsive Design: Works on desktop, tablet, and mobile
- Quality Modes: Performance, Balanced, and High DPR presets for browser rendering
- Layout Sync: Canvas CSS size and framebuffer size stay synchronized on resize and orientation changes
- Autosave: Restores the last used controls, preset, and export options on reload
- WebAssembly Performance: Compiled C++ code for near-native speed
- WebGL Rendering: Hardware-accelerated graphics
- Modern Web Interface: Dark theme with developer-friendly design
- Cross-platform: Runs in any modern web browser
suminasashi_web_final/
โโโ ๐ src/
โ โโโ main.cpp # Entry point and loop selection
โ โโโ app.cpp # App lifecycle, drawing, viewport sync
โ โโโ app.h # App interface and runtime state
โ โโโ web_exports.cpp # JS-callable C exports
โ โโโ screenshot.cpp # Native screenshot helpers
โ โโโ Drops.cpp # Drop physics and rendering
โ โโโ drops.h # Drop class declaration
โ โโโ colors.cpp # Color palette management
โ โโโ colors.h # ColorPalette class declaration
โโโ ๐ docs/ # Web deployment
โ โโโ index.html # Modern web interface
โ โโโ app.js # Browser runtime bridge and layout manager
โ โโโ suminasashi.js # Compiled WebAssembly
โ โโโ suminasashi.wasm # Binary WebAssembly module
โโโ ๐ build/ # Build artifacts
โโโ CMakeLists.txt # Build configuration
โโโ README.md # This file
-
Emscripten SDK
git clone https://github.com/Sandeep-003/Suminagashi.git cd emsdk ./emsdk install latest ./emsdk activate latest source ./emsdk_env.sh
-
CMake (3.10+)
-
Modern C++ Compiler (C++17 support)
-
Clone the repository
git clone https://github.com/Sandeep-003/Suminagashi.git cd Suminagashi -
Activate Emscripten environment
source path/to/emsdk/emsdk_env.sh # Linux/macOS # or path\to\emsdk\emsdk_env.bat # Windows
-
Configure and build
mkdir build && cd build emcmake cmake .. emmake cmake --build .
-
Deploy to web
cp web/suminasashi.js ../docs/ cp web/suminasashi.wasm ../docs/
The browser shell reads the wasm bundle with a cache-busting query string, so replace both files together during deployment.
The repository is set up to publish from GitHub Actions using the site in docs/.
- Push to
mainor run the workflow manually from the Actions tab. - The workflow builds the web target with Emscripten, copies the generated
suminasashi.jsandsuminasashi.wasminto a temporary Pages site, and deploys it. - In the repository settings, enable Pages with the source set to GitHub Actions if it is not already enabled.
For faster development cycles, you can build natively:
mkdir build-native && cd build-native
cmake ..
make
./suminasashi- Visit the live demo or serve locally
- Click on canvas to create drops
- Watch patterns emerge as drops interact
- Save screenshots using the button
- Experiment with different clicking patterns
- Left Click (Drops Mode): Create a new drop with random color
- Left Click (Tine Mode): Apply vertical carving deformation at cursor position
- T Key: Toggle between Drops and Tine interaction modes
- Strength Slider: Adjust tine displacement intensity (0-400 pixels)
- Sharpness Slider: Control tine influence radius and falloff steepness (1-256)
- Screenshot Button: Save current canvas as PNG
- Clear Button: Reset the canvas
- Fullscreen Button: Toggle fullscreen mode
- Quality Buttons: Switch between Performance, Balanced, and High canvas scaling
- Preset Menu: Load curated palette and control presets
- Export Options: Set filename prefix and timestamped export naming
- Reset View / Fit Canvas: Re-sync the browser layout or restore the current preset
The application features 15 carefully designed color palettes:
| Palette | Description | Colors |
|---|---|---|
| Sunset | Warm coral, orange, golden tones | ๐ ๐ก๐ค |
| Ocean | Cool blues and teals | ๐ต๐ฆ๐ |
| Traditional Japanese | Classic indigo and gray | โซ๐ตโช |
| Turkish Ebru | Vibrant traditional marbling colors | ๐ด๐ก๐ข๐ต |
| Venetian Marble | Warm stone and earth tones | ๐ค๐ซโช |
| Cherry Blossom | Soft pink gradients | ๐ธ๐๐ฉท |
| Jade Garden | Teal and aquamarine tones | ๐ข๐๐ท |
| Royal Purple | Luxurious purple and gold | ๐ฃ๐ก๐ |
| Midnight Blues | Deep blue gradients | ๐๐ต๐ |
| Earth Tones | Natural browns and beiges | ๐ซ๐ค๐ค |
| Copper Verdigris | Metallic copper with oxidized green | ๐ซ๐ข๐ |
| Wine & Cream | Deep reds with creamy whites | ๐ทโช๐ด |
class ColorPalette {
using ColorValue = std::array<int, 4>; // RGBA
using Palette = std::vector<ColorValue>;
public:
ColorPalette(); // Random palette selection
ColorValue getColor(); // Random color from current palette
static void addPalette(const Palette& palette);
static const std::vector<Palette>& getAllPalettes();
};class Drop {
Vector2 center;
double radius;
color clr;
std::vector<Vector2> vertices;
std::vector<Vector2> baseVertices; // Stable reference for cumulative operations
public:
Drop(float x, float y, color clr, double radius, int n);
void Draw_drops();
void marble(const Drop& other); // Interaction with other drops
void applyVerticalTine(float x, float strength, float sharpness, bool commitBase=true);
void wavy_transformation(); // Visual effects
void applyEdgeNoise(float amplitude, float frequency, float time);
void animateShape(float time, float amplitude, float speed, int harmonics=1);
};- Initialization: Setup Raylib window and WebGL context
- Input Handling: Detect mouse clicks for drop creation
- Physics Update: Calculate drop interactions and marbling effects
- Rendering: Draw all drops with WebGL acceleration
- Screenshot: Capture WebGL framebuffer for image export
- Emscripten: Compiles C++ to WebAssembly
- WebGL: Hardware-accelerated graphics rendering
- Memory Management: Efficient handling of drop collections
- JavaScript Bridge: Seamless integration with web interface
- Particle Systems: Add floating particles for atmosphere
- Advanced Shaders: Custom GLSL shaders for more realistic effects
- Animation Curves: Smooth transitions and easing
- Multiple Brush Types: Different drop styles and sizes
The next major evolution will incorporate realistic fluid dynamics:
class FluidSimulator {
// Navier-Stokes equations for fluid motion
void updateVelocityField(float dt);
void advectColor(float dt);
void applyViscosity(float dt);
void projectDivergenceFree();
// Surface tension effects
void calculateSurfaceTension();
void applyCapillaryWaves();
};- ๐ Realistic Flow: Implement Navier-Stokes equations for authentic fluid motion
- ๐ง Surface Tension: Accurate droplet behavior and coalescence
- ๐ Vorticity: Swirling patterns and turbulence
- โ๏ธ Viscosity: Different ink viscosity properties
- ๐ฏ Advection: Color transport through fluid medium
- ๐ Grid-based Solver: High-performance fluid grid simulation
- ๐ฌ Multi-phase Flow: Oil-water interactions
- ๐ Real-time Visualization: Velocity field visualization
- Eulerian Grid: Uniform grid for velocity and pressure fields
- FLIP/PIC Hybrid: Particle-in-Cell method for detail preservation
- GPU Acceleration: Compute shaders for parallel processing
- Adaptive Time Steps: Stable simulation with variable timesteps
- 3D Marbling: Three-dimensional fluid simulation
- VR/AR Support: Immersive marbling experiences
- AI Pattern Generation: Machine learning for pattern suggestions
- Collaborative Mode: Multi-user real-time marbling
- Physical Simulation: Paper absorption and texture effects
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow C++17 standards
- Maintain consistent code style
- Add comments for complex algorithms
- Test on multiple browsers
- Update documentation
- Screenshot may not work on some older browsers
- Mobile touch performance could be optimized
- Clear canvas function needs C++ implementation
- Memory usage grows with many drops (need cleanup)
- "Fluid Simulation for Computer Graphics" - Robert Bridson
- "Real-time Fluid Dynamics for Games" - Jos Stam (GDC 2003)
- "Particle-based Viscoelastic Fluid Simulation" - Clavet et al.
- Suminagashi History: Wikipedia
- Turkish Ebru Techniques: Traditional marbling methods
- Modern Paper Marbling: Contemporary artistic approaches
Sandeep Saurav
- GitHub: @Sandeep-003
- Portfolio: [Your Portfolio Link]
- Email: [Your Email]
This project is licensed under the MIT License - see the LICENSE file for details.
- Raylib Community for the amazing graphics library
- Emscripten Team for WebAssembly compilation
- Traditional Suminagashi Artists for the inspiration
- Open Source Community for tools and libraries
โญ Star this repository if you found it interesting! โญ
Made with โค๏ธ and lots of โ by Sandeep
