yum/3ner

A toon shader for Unity's BIRP.

git clone https://git.yummers.dev/yum/3ner

yumfix readmea6a3d3f

master
5 files

files

FoldEditorWindow.cs27.5 KiB
FoldOperations.cs12.1 KiB
FoldPipelineBuilder.cs6.1 KiB
README.md3.0 KiB
package-lock.json85 B

Fold - Vertex Deformation Pipeline Builder

A visual editor and fluent API for building vertex deformation pipelines.

Quick Start

Using the Editor Window

Open Tools > yum_food > Fold to access the dockable pipeline editor:

  1. Select a target material
  2. Click "Add Operation" to add deformation operations
  3. Configure parameters for each operation
  4. Reorder operations with ▲▼ buttons
  5. Click "Apply to Material" to write the pipeline to the material

Use "Load Presets" for common pipelines.

Using the Fluent API

using UnityEngine;

// Apply to a material
FoldPipelineBuilder.Create()
    .For(material)
    .TubeToPlane(Vector3.zero, Vector3.right, Vector3.forward, 1f)
    .NormConversion(2f, 1f, 1f)
    .Apply();

Available Operations

TubeToPlane(p, r, s, t)

Unfolds a tube into a plane.

PlaneToTube(p, r, s, t)

Folds a plane into a tube.

PlaneToHemiOctahedron(p, r, s, t)

Maps a plane to a hemi-octahedron (half octahedron) shape.

Useful for creating dome-like or hemisphere projections from planar geometry.

PointAlign(po, pp, r, t)

Aligns geometry to a point.

AxisAlign(po, pp, r, t)

Aligns geometry along an axis.

NormConversion(inputK, outputK, t)

Converts between different norms (L1, L2, L∞).

Common conversions:

Seal(A, k, st, t)

Sealing operation for closing geometry.

SineWaves()

Applies sine wave deformation.

FBM()

Applies fractal Brownian motion deformation.

Custom(opcode, f0-f3, v0-v3)

For advanced use cases or custom opcodes.

Pipeline Chaining

Operations are applied in the order they're chained:

FoldPipelineBuilder.Create()
    .For(material)
    .TubeToPlane(...)     // Step 1
    .NormConversion(...)  // Step 2
    .PointAlign(...)      // Step 3
    .Seal(...)            // Step 4
    .Apply();             // Execute

The shader supports up to 16 operations per material.

Clearing Deformations

In the Fold window, click "Clear All" to remove all operations from the pipeline.

Via code:

targetMaterial.SetFloat("_Vertex_Deformation_Enabled", 0f);