Generating Gradients

From Shader Forge Wiki
Jump to: navigation, search

Gradients are an extremely useful fundamental in compute graphics, and many types of gradients can be generated on the GPU. Doing these in the shader has many of the classic advantages of generating things procedurally in a shader, in that the gradients do not suffer from bit precision issues cause by texture formats and compression.

UV Gradients

The UV interpolation between vertices forms a natural gradient. On a quad with the default UV mapping, this forms a simple gradient on across the horizontal or vertical axis. We can use this information to generate more advanced gradients with a bit of math.

Sf gradient 1.png

Circular Gradient

Sf gradient dot.png

Box Gradient

Sf boxgradient.png

Adjusting Gradients

Once a gradient is generated, you can easily invert the values using the OneMinus node, or adjust the contrast with a Pow function or easing equation.

Simple Gradient Skybox

Here - [[1]]

--Jason Booth (talk) 19:37, 13 March 2014 (UTC)