Colours
A simple shader that changes the colour of the entity based on the time. The shader is based on the default shader from shadertoy.
Example Links
Calculating a time varying pixel color
This example demonstrates how to calculate a time varying pixel color by using a cosine wave made up of the current time and the UV coordinates.
import ultraviolet.syntax.*
inline def fragment: Shader[FragmentEnv, Unit] =
Shader[FragmentEnv] { env =>
def fragment(color: vec4): vec4 =
val col: vec3 = 0.5f + 0.5f * cos(env.TIME + env.UV.xyx + vec3(0.0f, 2.0f, 4.0f))
vec4(col, 1.0f)
}