naive normal direction

This commit is contained in:
hodasemi 2018-11-26 10:41:27 +01:00
parent 9a0df4e4ab
commit 4264f2dfa3

View file

@ -113,5 +113,12 @@ vec3 calculate_normal(vec4 terrain_position) {
vec3 p2 = (points[1] - terrain_position).xyz;
// calculate normal
return normalize(cross(p1, p2));
vec3 normal = normalize(cross(p1, p2));
// naively assume that a normal always has to look upwards
if (normal.y < 0.0) {
return -normal;
} else {
return normal;
}
}