Hi,

I just use simple colored Polygon2Ds to create a landscape. Now I try to shade them, but I don't know how to get the size of the given polygon. As I don't have textures, so UV's wont work at all.

My goal would be to put a gradient on the polygon using its basecolor.

My current example:

varying vec2 position;

void vertex(){
    position = VERTEX;
}

void fragment() {
c = position / size; // Something like that
	COLOR = vec4(c, 0.0, 1.0);
}

But the result

Welcome to the forums @prometheus!

You could try using FRAGCOORD to get the position of the pixel within the fragment function. There is also some other variables you can try using (like SCREEN_UV) for other different ways to texture without UVs that are mentioned in the documentation. :smile:

Thank you for the hint - seems ok so far.

2 years later