Fabrizio Bergamo

Real-Time FX & Tech Art

Quantize Function

Description

A small material function that quantizes a Gradient Input, given a set number of Steps.
Provides three outputs:

  • One included
  • One excluded
  • Zero excluded

I made this function because I needed the output with “one included”, to get the full range of values.
Quantizing is a simple function, but its basic form:

floor(GradientSteps)/Stepsfloor(Gradient * Steps) / Steps

Returns without a result that does not include one.

The same can be applied for other contexts, not only materials, such as having it as a Niagara Dynamic Input.

Results

Input

The gradient input.

Outputs

Here are the 3 outputs.
You can find the technique to visualize a gradient here.

Graph

Snippet

Get the text file, or get it from Epic’s Developers Community


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *