open-watercolor-sim 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_watercolor_sim/__init__.py +14 -0
- open_watercolor_sim/brush/__init__.py +4 -0
- open_watercolor_sim/brush/configs.py +57 -0
- open_watercolor_sim/brush/watercolor_engine.py +954 -0
- open_watercolor_sim/viewer.py +305 -0
- open_watercolor_sim-0.1.1.dist-info/METADATA +86 -0
- open_watercolor_sim-0.1.1.dist-info/RECORD +11 -0
- open_watercolor_sim-0.1.1.dist-info/WHEEL +5 -0
- open_watercolor_sim-0.1.1.dist-info/entry_points.txt +2 -0
- open_watercolor_sim-0.1.1.dist-info/licenses/LICENSE +171 -0
- open_watercolor_sim-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Open Watercolor Sim.
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Shuoqi Chen
|
|
5
|
+
SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
"""
|
|
7
|
+
from .brush.watercolor_engine import WatercolorEngine
|
|
8
|
+
from .brush.configs import SimParams
|
|
9
|
+
from .viewer import launch_viewer
|
|
10
|
+
|
|
11
|
+
__version__ = "0.1.0"
|
|
12
|
+
__author__ = "Shuoqi Chen"
|
|
13
|
+
__license__ = "Apache-2.0"
|
|
14
|
+
__all__ = ["WatercolorEngine", "SimParams", "launch_viewer"]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Open Watercolor Sim.
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Shuoqi Chen
|
|
5
|
+
SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
"""
|
|
7
|
+
from dataclasses import dataclass, field
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class SimParams:
|
|
12
|
+
"""User-adjustable parameters for the watercolor simulation."""
|
|
13
|
+
|
|
14
|
+
# --- [NORMAL] Brush Properties ---
|
|
15
|
+
brush_radius: float = field(default=40.8, metadata={"help": "The radius of the brush in pixels.", "category": "Normal", "min": 5.0, "max": 200.0})
|
|
16
|
+
pigment_load: float = field(default=1.578, metadata={"help": "Amount of pigment deposited with each stroke.", "category": "Normal", "min": 0.0, "max": 2.0})
|
|
17
|
+
water_release: float = field(default=2.000, metadata={"help": "Amount of water deposited with each stroke.", "category": "Normal", "min": 0.0, "max": 2.0})
|
|
18
|
+
|
|
19
|
+
# --- [NORMAL] Physics Behavior ---
|
|
20
|
+
diffusion: float = field(default=0.400, metadata={"help": "How fast pigment and water spread across the paper.", "category": "Normal", "min": 0.0, "max": 1.0})
|
|
21
|
+
canvas_evaporation: float = field(default=0.200, metadata={"help": "Rate at which the canvas dries (water loss).", "category": "Normal", "min": 0.0, "max": 1.0})
|
|
22
|
+
gravity: float = field(default=1.486, metadata={"help": "Downward force affecting wet paint flow.", "category": "Normal", "min": 0.0, "max": 5.0})
|
|
23
|
+
granulation: float = field(default=0.784, metadata={"help": "Strength of pigment settling into paper grain.", "category": "Normal", "min": 0.0, "max": 1.0})
|
|
24
|
+
|
|
25
|
+
# --- [NORMAL] Visuals ---
|
|
26
|
+
color_rgb: Tuple[float, float, float] = field(default=(0.8, 0.102, 0.8), metadata={"help": "Current brush color (normalized RGB).", "category": "Normal"})
|
|
27
|
+
edge_darkening: float = field(default=1.903, metadata={"help": "Strength of the wet-edge darkening effect.", "category": "Normal", "min": 0.0, "max": 2.0})
|
|
28
|
+
|
|
29
|
+
# --- [ADVANCED] Internal Media Physics ---
|
|
30
|
+
max_wet_pigment: float = field(default=0.18, metadata={"help": "Max pigment mass suspended in water.", "category": "Advanced", "min": 0.01, "max": 1.0})
|
|
31
|
+
max_stain_pigment: float = field(default=0.5, metadata={"help": "Max pigment mass absorbed by paper.", "category": "Advanced", "min": 0.1, "max": 2.0})
|
|
32
|
+
water_diffusion_coeff: float = field(default=0.4, metadata={"help": "Base coefficient for water spread.", "category": "Advanced", "min": 0.0, "max": 2.0})
|
|
33
|
+
pigment_diffusion_coeff: float = field(default=0.22, metadata={"help": "Base coefficient for pigment spread.", "category": "Advanced", "min": 0.0, "max": 2.0})
|
|
34
|
+
gravity_coeff: float = field(default=8.0, metadata={"help": "Base coefficient for gravity force.", "category": "Advanced", "min": 0.0, "max": 20.0})
|
|
35
|
+
drying_coeff: float = field(default=1.5, metadata={"help": "Base coefficient for drying speed.", "category": "Advanced", "min": 0.0, "max": 5.0})
|
|
36
|
+
|
|
37
|
+
# --- [ADVANCED] Flow Dynamics ---
|
|
38
|
+
drip_threshold: float = field(default=0.45, metadata={"help": "Wetness threshold before paint begins to drip.", "category": "Advanced", "min": 0.0, "max": 1.0})
|
|
39
|
+
drip_rate_coeff: float = field(default=2.5, metadata={"help": "Speed of dripping once threshold is met.", "category": "Advanced", "min": 0.0, "max": 10.0})
|
|
40
|
+
turbulence_coeff: float = field(default=0.8, metadata={"help": "Strength of noise-driven flow direction.", "category": "Advanced", "min": 0.0, "max": 5.0})
|
|
41
|
+
advection_coeff: float = field(default=10.0, metadata={"help": "Strength of pigment transport by water flow.", "category": "Advanced", "min": 0.0, "max": 20.0})
|
|
42
|
+
velocity_damping: float = field(default=0.15, metadata={"help": "How fast water flow slows down.", "category": "Advanced", "min": 0.0, "max": 1.0})
|
|
43
|
+
pressure_coeff: float = field(default=3.5, metadata={"help": "Internal pressure affecting water movement.", "category": "Advanced", "min": 0.0, "max": 10.0})
|
|
44
|
+
max_velocity_coeff: float = field(default=80.0, metadata={"help": "Maximum flow velocity allowed.", "category": "Advanced", "min": 10.0, "max": 200.0})
|
|
45
|
+
|
|
46
|
+
# --- [ADVANCED] Paper & Interaction ---
|
|
47
|
+
absorption_coeff: float = field(default=0.12, metadata={"help": "Base rate of water absorption into paper.", "category": "Advanced", "min": 0.0, "max": 1.0})
|
|
48
|
+
settle_coeff: float = field(default=0.32, metadata={"help": "Base rate of pigment settling (staining).", "category": "Advanced", "min": 0.0, "max": 1.0})
|
|
49
|
+
paper_texture_scale: float = field(default=2.2, metadata={"help": "Scale of the procedural grain.", "category": "Advanced", "min": 0.1, "max": 10.0})
|
|
50
|
+
wet_darken_coeff: float = field(default=0.05, metadata={"help": "Visual darkening of wet areas.", "category": "Advanced", "min": 0.0, "max": 0.5})
|
|
51
|
+
pigment_absorb_floor: float = field(default=0.10, metadata={"help": "Minimum opacity for absorbed pigment.", "category": "Advanced", "min": 0.0, "max": 0.5})
|
|
52
|
+
pigment_neutral_density: float = field(default=0.35, metadata={"help": "Lightness bias for pigment rendering.", "category": "Advanced", "min": 0.0, "max": 1.0})
|
|
53
|
+
|
|
54
|
+
# --- Internal State (Not for direct UI control but persistent) ---
|
|
55
|
+
bloom_variance: float = field(default=12.0, metadata={"help": "Inner randomness for brush edges.", "category": "Advanced", "min": 0.0, "max": 50.0})
|
|
56
|
+
stroke_life: float = field(default=8.0, metadata={"help": "Active simulation time after a stroke.", "category": "Advanced", "min": 1.0, "max": 60.0})
|
|
57
|
+
|