OpenGL and the infinite position of the light?

Is it possible to shade polygons so that each polygon is displayed with the same angle of light, regardless of their position relative to the light?

I need to move the sunlight, but the map is very large, and I do not want the light to look different in any other place, it should be symmetrical everywhere.

+3
source share
1 answer

Directional light (against a point or spot) "casts off rays" in parallel, effectively simulating a light source from an infinite distance.

To set this direction, you set the w-component of the light x, y, z, w to position 0.

GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };

+10
source

Source: https://habr.com/ru/post/1726457/


All Articles