Stylized Water 3 – River Modeler Documentation

Documentation is a draft

This asset is pending release

Stylized Water 3 - River Modeler (Extension)

River Modeler for Stylized Water 3
Version: 1.0.0
Review

4.Scripting #

Familiarity with C# and OOP programming is assumed. Support cannot be extended to coding help. Some specific functionality and use cases really need to be handled on a project-specific basis with some creative thinking.

Events

There are two events to subscribe to, that fire before the river is rebuild and after…
RiverModeler.onPreRebuildRiver += OnRiverRebuild;
RiverModeler.onPostRebuildRiver += OnRiverRebuild;

Never call the Rebuild() function from these methods! This creates an infinite loop.

Sampling the river surface

Generally, you can sample the same spline used by a river to get its position/direction/normal using Spline.Evalutate(t);. But the River Modeler component contains a helper function that simplifies this:

RiverModeler.FindNearestPointOnRiver(float3 worldPosition, out float3 point, out float3 direction, out float3 normal, out float t, float sampleDistance = 1f);

This function is fairly optimized, since it first checks if the input position falls within a river’s segment, before actually sampling the spline section. Plus, it only analyzes the spline section the segment belongs to, not the entire spline!

This is excellent to use for controlling particle effects, swimming behaviour or buoyancy physics!

Procedural Splines

If you’re looking to generate a spline from a set of points, that is certainly possible. Unity’s Splines API contains this function which can be used for it:

FitSplineToPoints(List<float3> positions, float errorThreshold, bool closed, out Spline spline);

If you have the Spline Extensions asset installed, you can use a multithreaded variant that’s x26 times faster

CreateSplineFromPoints.Execute(List<float3> positions, float errorThreshold, bool closed, out Spline spline, float3 up = default);

The Spline Mesher Pro documentation has a section about best practise for this, worth reading.

Yes No Suggest edit
Last updated on August 28, 2026
0 of 0 users found this section helpful
If you're familiar with this asset, please consider leaving a review!
Your support is what makes complementary updates possible!
Suggest Edit