Table of Contents

Class PuddleSplat

Namespace
DFA.Puddlecraft

A reusable puddle shape: a square heatmap of depth from 0 (dry) to 1 (deepest). Splats are placed in a scene with a PuddleSplatInstance (Puddle Splat component), which can be moved, scaled and rotated at any time without changing the splat itself.

[Icon("Packages/com.dfa.puddlecraft/editor/icons/splat-asset.png")]
public sealed class PuddleSplat : ScriptableObject
Inheritance
PuddleSplat

Fields

DefaultResolution

Heatmap resolution of new splats, in pixels.

public const int DefaultResolution = 256

Field Value

int

MaxResolution

Largest heatmap resolution, in pixels.

public const int MaxResolution = 512

Field Value

int

MinResolution

Smallest heatmap resolution, in pixels.

public const int MinResolution = 32

Field Value

int

Properties

hasData

True when the splat has depth data at its resolution.

public bool hasData { get; }

Property Value

bool

procedural

Settings for procedural splats. Call Regenerate after changing them from code.

public ProceduralSplatSettings procedural { get; }

Property Value

ProceduralSplatSettings

resolution

Width and height of the heatmap in pixels, MinResolution to MaxResolution. Setting it resamples or regenerates the depth data.

public int resolution { get; set; }

Property Value

int

source

Where the shape comes from. Setting it refreshes the depth data, regenerating it for Procedural.

public SplatSource source { get; set; }

Property Value

SplatSource

textureSource

Settings for splats imported from an image. Images are imported in the editor.

public TextureSplatSettings textureSource { get; }

Property Value

TextureSplatSettings

version

Increases every time the depth data changes.

public int version { get; }

Property Value

int

Methods

GetPixel(int, int)

Depth of one pixel, 0 to 1.

public float GetPixel(int x, int y)

Parameters

x int
y int

Returns

float

GetTexture()

GPU copy of the depth data (R8, linear). Owned by the splat; do not destroy it.

public Texture2D GetTexture()

Returns

Texture2D

Regenerate()

Rebuilds the depth data from the procedural settings. Does nothing for other sources.

public void Regenerate()

Sample(Vector2)

Bilinear depth at a UV in the splat square. Outside 0 to 1 the splat is dry.

public float Sample(Vector2 uv)

Parameters

uv Vector2

Returns

float