Examples
Examples

UV Gradient


Description

This example contains a game object with a model component. The model component uses the /builtins/assets/meshes/quad.gltf mesh, which is a rectangle 1 by 1 unit large. The game object is scaled to the dimensions of the screen so that the mesh covers the entire screen.

stretched game object

The shader is very basic and sets the fragment color based on the UV position, thus creating a color gradient. This is a good starting point when experimenting with graphical effects using a shader.

Scripts

uvgradient.fp

#version 140

in mediump vec2 var_texcoord0;
out vec4 out_fragColor;

void main()
{  
    out_fragColor = vec4(var_texcoord0.x, var_texcoord0.y, 0.5, 1.0f);
}

This example was created by Defold Foundation.

Download ⤓

 

Do you want to see more examples? Why not write a few yourself and submit a pull request? We love contributions.

Add example ↗