Ultimate Water 2D / Docs v1.0.0Web demo Back to website
DiffusionWorks/Documentation/Sprite Reflection

Sprite Reflection

Why Sprite Reflection exists

Add Sprite Reflection (SpriteReflection) to a character or other 2D renderer that needs to appear correctly in a water reflection while crossing the surface. A normal planar reflection always mirrors around the water surface. That works while a sprite is above water, but once the sprite moves below the surface its reflected image can separate from the character or appear on the wrong side.

Sprite Reflection marks selected renderers for a temporary reflection-proxy pass. The water system copies or temporarily positions those renderers only for the reflection camera, then restores the originals. It does not create a second permanent gameplay object and it does not render a reflection independently of the water’s reflection system.

How the waterline chooses the reflection axis

The sprite waterline represents the height where the character or object meets the water surface. The system compares that line with the bottom of the renderer:

  • When the adjusted renderer bottom is above the sprite waterline, the reflection uses the waterline as its axis. The character therefore mirrors from the surface in the expected way.
  • When the adjusted renderer bottom reaches or moves below the sprite waterline, the reflection switches to the renderer’s bottom edge. The reflected image stays attached beneath the character as it descends, preserving the visual impression that the character is still sitting on top of the reflected surface instead of leaving a detached reflection behind.

In implementation terms, the active axis is the lower of the sprite waterline and the renderer’s adjusted bottom edge. The switch is automatic as the sprite crosses the line.

Set up the water and marker

  1. Enable the water’s sprite-reflection proxy option.
  2. Include the object’s GameObject layer in 2D Reflection Layer Mask and its sorting layer in 2D Reflection Sorting Layers.
  3. Add Sprite Reflection to the character or object.
  4. Enable Include Children if the visible character is assembled from child renderers.
  5. Place the sprite waterline at the visual surface-contact height and test the object above, touching, and below it.

Simple Water provides a shared Waterline Offset measured from its reflection axis. Main Fake Perspective reflection settings expose the equivalent sprite-waterline configuration. A marker normally uses the water’s shared line so every marked object switches consistently.

Marker parameters

Setting Purpose
Include Children Reflects eligible renderers on the marked object and below it. Use this for characters built from several SpriteRenderers.
Copy Sprite Material Copies the SpriteRenderer material and MaterialPropertyBlock to the temporary proxy so tinting, shader properties, and other per-renderer appearance survive in the reflection.
Reflection Offset Adds an offset to the renderer-bottom reference before the system chooses between the bottom-edge and waterline axes. Use it when transparent padding, a pivot, feet, or the visible bottom of the art does not match the renderer bounds.
Override Waterline Gives this marker its own switching line instead of the water’s shared sprite waterline. Use it for an object with an unusual contact point, not as the default workflow.
Waterline Y World-space Y position of the marker-specific waterline when Override Waterline is enabled. Although the scripting property is named waterlineOffset, this per-marker value stores a world-space height.
Show Waterline Gizmo Draws the marker’s override line in the Scene view while selected.

Reflection Offset does not move the actual water surface. It corrects where the sprite’s bottom is considered for the switching test. A positive or negative adjustment can align the changeover with the character’s feet or another intended contact point.

Shared waterline or per-object override

Use the shared waterline for most characters and props. It gives the scene one consistent surface-contact height and is easier to maintain when the water moves. Enable Override Waterline only when one marked object needs a different line because of its art, bounds, or intended contact point.

When using an override, place Waterline Y where that object should visually hit the surface and enable Show Waterline Gizmo while tuning it. Test the entire transition rather than checking only a stationary above-water reflection: the important behavior is the axis switch as the renderer bottom crosses the line.