ModularProceduralMaterials is an Unreal Engine plugin for procedural material creation.

Unreal Engine Marketplace Link

# Videos

Videos on our YouTube channel only use this asset pack for materials and post effects, have look here.

A tutorial can be found here

And here is the link to the official feature video.

# Documentation

The plugin provides materials, material instances, material functions and some example color curves. Half of the material functions are, what i call, “Quick Blocks”, which means they already have parameters added. This helps with prototyping as one does not need to add and name parameters. The quick blocks can simply be added to materials and connected. However, if multiple functions of the same type are added, they share the parameters which might not be intended.

## How to work with the plugin

the fastest way to get started is to duplicate one of the contained material instances and play around with the vast number of parameters. Many options like the UV transforms can be switched on/off in the material editor so its easy to see what they do. The materials usually are made up from 3 parts

- Quick_UVTransformsA: encapsulates all UV transforms. Each one of them can be switched on and off. The corresponding parameters appear in the material editor when turned on.
- A Shape: A Fractal, SDF or a simple texture: uses the UV from the UV transform node as input
- A Coloring function: gradient coloring for fractals, distance coloring for SDFs or none when a texture is used before.

## Fractals

The fractal functions have many parameters to adjust the fractal, how coloring is done and a time value to animate the fractal. The output(s) can be used for coloring. therefor usually a shading output is used, this can be linked to a gradient (or a gradient coloring function) to color the fractal. Fractals may also provide mask or stencil output or iteration output (the iteration of the looping fractal function at pixel position).

- MF_FractalGridy: A non standard fractal.
- MF_FractalJulia: Julia fractal with leave like strucures.
- MF_FractalJuliaA: The default julia fractal implementation.
- MF_Julia:C: Another julia fractal implementation with leave like structures.
- MF_Koch_A: the koch fractal wich produces a snowflake like form.
- MF_Mandelbrot_A: the standard mandelbrot fractal.

Quick Blocks are available for each fractal function as well as an example material and material instance.

## SDF2D (Signed Distance Functions)

Signed distance functions provide a distance to the next edge of a shape for each pixel. Geometric shapes can be drawn with SDFs. The returned value of the SDF function is 0 at the shape’s edge, negative inside the shape and positive outside the shape. The contained SDF functions produce:

- Arc
- Box
- Rounded Box
- Circle
- 2 different cross shapes
- Ellipse
- Eye
- Hexagon
- Octagon
- Pentagon
- Rhombus (diamond)
- 2 different star shapes
- Triangle

The output of the SDF functions can be fed into one of the following functions that generate masks for later coloring:

- Border: creates a simple border for the shape
- Fades: creates a glow on the inside or outside of the shape
- SineWaves: create ripple like lines on outside or inside

A material and material instance is available for each of the SDF shapes as well as a material called 2DSDF_Multi. This material has a value for each of the SDF functions, so they can be easily switched on and of and they can also be mixed. This material also provides the option to have an outside frame where also all SDF functions can be combined. With this you can create a shape containing a uv-morphed subset of shapes inside. The following image shows some examples.

## UV Transforms

The transform functions are to be used on the input UV coordinates. Usually the MF_UVInputNormalized is the starting point, it takes the TextureCoordinates and converts it to the range [-1, 1] so 0 is in the center. Multiple UV transforms can be applied in sequence, order matters in this case.

Following UV Transforms are contained:

- FishEye
- HexagonTiling: best used with hexagon SDF
- Kaleidoscope
- Moebius Inversion
- Object Space Gradient: provides a linear gradient over the size of the object
- Radial
- Spiral
- Toroid: looks like the inside of a donut/torus
- UVBasics: tiling, zoom and rotation of UV coordinates
- Warp: similar to kaleidoscope but a little bit more interesting

The UV transforms are usually contained in every contained material, encapsulated in the “Quick_UVTransformsA” function and can be switched on and of. when turned on, the corresponding UV transform parameters will appear in the material’s parameter list.

## Utility

Utility functions are little helpers that do not belong in any of the other categories.

- ColorCutout: set a given color to be transparent
- GetTime: gets the time with a global multiplier (defined in GlobalMaterialParameters)
- LerpF4: linear interpolation of 2 colors with alpha
- LerpF42D: linear interpolation of 4 colors with alpha
- NoiseA: wrapper around the noise function
- NoiseVoronoi: wrapper areound the noise function, Set to voronoi.
- NormalFromHeight: produce normal and height displacement values from a given height value
- RadialUVSine: radial ripples
- TruchetSquare: the truchet pattern
- UVHash2To1: creates a number from given 2d input. Can be used instead of random to create reproducable pseudo-random values

## Additional Materials

The pack contains a few materials without material functions

- BlackHole: a refractive material with a black area in the middle. Bends light and mimics a black hole
- CircleWithGradient: creates a circle that can be divided into x segments where each segment has a gradient applied. could be used for circular health bars etc.
- CircleWithGradient2: same as the other, only with the option to use a texture
- LocalSineGradient: applies an animated gradient to the mesh. could be used for holo display effects
- UVMorphedTexture: takes a texture and applies all UV transforms to it. Transforms can be turned on/off in the material editor

## Cel Shading post effect

The cel shading post effect material easily turns your game into a cartoon. The cel shading effect works on all geometry like static meshes, characters particle meshes (not all types of sprites), niagara tubes.

The material has options to define:

- Master mix: mixes real image with cel shaded one
- Number of cel shading bands
- Ambient occlusion use or not
- Color adaption: min, max brightness and intensity
- Color change: hue shift, saturation etc
- Outlines: can be turned on/off, have width and more parameters to control
- Screen Space Halftones: this are those dots that are used in cartoons for shading/shadows. The are generated procedurally but there is an option to use a texture if needed. They have also many options to adjust the visual style.
- Distance culling: to avoid artifacts in sky domes and similar objects that do not have actual geometry and are far away

## UV Morph & Coloring Post effects

The asset pack now also contains some post effects that use the UV Morph functions and the color adjustment functions. this can be used to create effects like kaleidoscope vision, repetitions or vortex transitions for cinematic cuts etc. The UV Morph post effect material contains check boxes tu turn on/off all different UV morphs. Thus, all different combinations can be quickly tried out in the material instance editor.