= Hydron Force =

#type: node
#context: sop
#internal: rvfx::hydron_force
#icon: /nodes/sop/icons/hydron_force.svg
#tags: rvfx, hydron, force, wind, vortex, gravity, repulsor, curl, curve, gpu

"""Modular GPU force node with interactive viewport gizmos, color-coded wireframe guides, and Houdini POP Curve Force parity for FLIP and Whitewater."""

RVFX Hydron Force creates GPU forces and wireframe guide geometry (`hydron_guides`) that you can combine using standard Houdini *Merge*, *Bypass*, *Transform*, and *Copy to Points* SOPs into Input 3 of [Hydron Solver|Node:sop/rvfx--hydron_solver]. Up to 32 simultaneous analytic forces (Wind, Vortex, Point Gravity/Repulsor, Curl Noise) plus Curve Force can drive FLIP and Whitewater together—or target Whitewater mist alone.

TIP:
    Select this node and press *Enter* over the 3D Viewport to activate the interactive transform gizmo (`Center` and `Rotate`) for Wind, Vortex, Point Gravity/Repulsor, and Curl Noise modes.

TIP:
    For *Curve Force*, connect a polyline, NURBS, or Bezier curve (`>= 2` vertices) to Input 0. Per-point `width` or `pscale` overrides *Max Influence Radius*, and point `@v` drives *Inherit Velocity Scale*.

@inputs

Guide Curve (Optional, for Curve Force):
    Input 0. Required when *Force Type* is `Curve Force`. Accepts open or closed polylines, NURBS, or Bezier curves with at least 2 vertices. Optional point `width`/`pscale` controls local base radius, and point `@v` provides curve velocity for *Inherit Velocity Scale*.

@outputs

Geometry & Groups:
    - Primitive group `hydron_guides`: Color-coded wireframe preview geometry:
      - `Wind`: Cyan arrow along rotated `+Z` (plus bounds sphere rings if *Use Local Bounds* is on).
      - `Vortex`: Orange axis line + dual radius rings around rotated `+Y`.
      - `Point Gravity / Repulsor`: Magenta inward arrows (positive strength) or pink outward arrows (negative strength) + `Core Radius` and `Influence Radius` spheres.
      - `Curl Noise`: Green wireframe box or bounds sphere + 3D curl wave.
      - `Curve Force`: Purple curve + 9 tapered wireframe rings reflecting `Scale Radius Along Length` (`1:1` match with GPU capture radius).

Primitive Attributes:
    - `hydron_force_type` (`string`), `hydron_force_primary` (`int`), `hydron_force_pos` (`vector3`), `hydron_force_dir` (`vector3`), `hydron_force_strength`, `hydron_force_drag`, `hydron_force_radius`, `hydron_force_core_radius`, `hydron_force_falloff`, `hydron_force_suction`, `hydron_force_freq`, `hydron_force_speed`, `hydron_force_octaves`, `hydron_force_use_bounds`, `hydron_force_bounds_radius`, `hydron_force_affect_flip`, `hydron_force_affect_ww`, `hydron_force_ww_scale`.
    - In `Curve Force` mode: `hydron_curve_*` parameters plus 7 baked 64-entry LUT primitive attributes (`hydron_curve_lut_global`, `hydron_curve_lut_follow`, `hydron_curve_lut_suction`, `hydron_curve_lut_orbit`, `hydron_curve_lut_vel`, `hydron_curve_lut_radius_along`, `hydron_curve_lut_force_along`).

@parameters

Force Type:
    #id: force_type
    Selects the GPU force behavior:
    - `Wind` (default): Exponential aerodynamic wind velocity blend along rotated `+Z`.
    - `Vortex`: Cylindrical Rankine swirl around rotated `+Y` with optional radial suction.
    - `Point Gravity / Repulsor`: Radial attractor (positive *Strength*) or repulsor (negative *Strength*).
    - `Curl Noise`: Time-evolving 3D divergence-free turbulent acceleration.
    - `Curve Force`: Pro curve guidance along Input 0 splines with 7 float ramps and wind/force toggle.

Center / Position:
    #id: t
    World-space force origin `{tx, ty, tz}` (default `(0, 0, 0)`; hidden in `Curve Force` mode).

Rotate:
    #id: r
    Euler XYZ orientation in degrees `{rx, ry, rz}` rotating the Wind direction (`+Z`) or Vortex axis (`+Y`) (default `(0, 0, 0)`; hidden in `Curve Force` mode).

Strength:
    #id: strength
    Master force strength (default `5.0`, UI `-50..50`; hidden in `Curve Force` mode). In `Wind` mode sets target wind speed (`m/s`); in `Vortex` sets tangential swirl (`m/s^2`); in `Point Gravity` positive attracts and negative repels (`m/s^2`); in `Curl Noise` sets acceleration amplitude.

== Wind ==

Wind Drag:
    #id: wind_drag
    Exponential drag rate (`1/s`) pulling particles toward the Wind velocity (default `1.0`, UI `0..50`).

== Vortex ==

Vortex Radius:
    #id: vortex_radius
    Outer cylindrical influence radius in meters (default `0.75 m`, UI `0.01..50`).

Vortex Suction:
    #id: vortex_suction
    Radial inward pull (`m/s^2`; negative pushes outward; default `0.0`, UI `-100..100`).

== Point Gravity / Repulsor ==

Core Radius:
    #id: core_radius
    Softening core radius in meters preventing infinite acceleration near the center (default `0.15 m`, UI `0.005..20`).

Falloff:
    #id: falloff_mode
    Distance attenuation profile: `Constant` (default), `Linear`, or `Inverse Square`.

Influence Radius:
    #id: influence_radius
    Outer cutoff radius in meters (`0.0 = infinite`, default `0.0`, UI `0..100`).

== Curl Noise ==

Frequency:
    #id: curl_freq
    Spatial noise frequency (`1/m`, default `1.5`, UI `0.01..50`).

Speed:
    #id: curl_speed
    Temporal noise evolution speed (default `0.5`, UI `0..20`).

Octaves:
    #id: curl_octaves
    FBM curl octaves (`1..3`, default `2`).

== Curve Force ==

Treat As Wind:
    #id: curve_treat_as_wind
    When `On` (default), treats combined Follow, Suction, Orbit, and Inherited velocity as a target wind velocity blended exponentially via *Air Resistance* (matching Houdini POP Curve Force). When `Off`, applies raw accelerations directly.

Air Resistance:
    #id: curve_air_resistance
    Wind blend rate (`1/s`) when *Treat As Wind* is enabled (default `4.0`, UI `0..10`).

Follow Strength:
    #id: curve_follow_scale
    Velocity/force scale along the curve tangent (default `10.0`, unlocked UI `0..2`).

Suction Strength:
    #id: curve_suction_scale
    Radial inward pull toward the closest point on the curve (default `5.0`, unlocked UI `0..2`).

Orbit Strength:
    #id: curve_orbit_scale
    Tangential swirl around the curve axis (default `0.0`, unlocked UI `0..2`).

Inherit Velocity Scale:
    #id: curve_inherit_vel_scale
    Multiplier on Input 0 curve point `@v` velocity inheritance (default `0.0`, unlocked UI `0..2`).

Max Influence Radius:
    #id: curve_radius
    Base capture radius in meters around the curve when point `width`/`pscale` is absent (default `0.25 m`, UI `0.001..20`).

Max Speed:
    #id: curve_max_speed
    Optional velocity clamp inside the curve influence zone (`0.0 = uncapped`, default `0.0`, UI `0..100`).

Global Force Falloff:
    #id: curve_global_falloff
    Radial falloff ramp from curve center (`0`) to outer radius (`1`) applied across all curve force components (default plateau `0 -> 1.0`, `0.6 -> 0.85`, `1.0 -> 0.0`).

Follow Force Falloff / Suction Force Falloff / Orbit Force Falloff / Velocity Force Falloff:
    #id: curve_follow_falloff
    Independent radial falloff ramps (`0` center to `1` edge, default flat `1.0`) modulating Follow, Suction, Orbit, and Inherited Velocity respectively.

Scale Radius Along Length / Force Along Length:
    #id: curve_radius_along
    Arc-length ramps (`u = 0` curve start to `u = 1` curve end, default flat `1.0`) tapering the influence radius (previewed live by the 9 wireframe rings) and modulating overall force along the curve.

== Local Bounds ==

Use Local Bounds:
    #id: use_bounds
    Confines non-curve forces to a smooth cubic falloff inside a local sphere of *Bounds Radius* (default `Off`).

Bounds Radius:
    #id: bounds_radius
    Local bounding sphere radius in meters when *Use Local Bounds* is enabled (default `1.5 m`, UI `0.01..100`).

== Masking & Display ==

Affect FLIP:
    #id: affect_flip
    Applies this force to FLIP liquid particles (default `On`).

Affect Whitewater:
    #id: affect_ww
    Applies this force to Whitewater Bubbles, Foam, and Spray (default `On`). Turn *Affect FLIP* off and *Affect Whitewater* on for dedicated mist-only wind fields.

WW Force Scale:
    #id: ww_scale
    Additional multiplier applied specifically to Whitewater particles (default `1.0`, UI `0..10`).

Show Guide:
    #id: show_guide
    Generates color-coded wireframe guide geometry in `hydron_guides` (default `On`).

@related
- [Node:sop/rvfx--hydron_solver]
- [Node:sop/rvfx--hydron_mesher]
- [Node:sop/rvfx--hydron_whitewater]
