Skip to content

Commit

Permalink
Fix AO values, which were inverted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Rideout committed Aug 22, 2015
1 parent 65e173c commit 8b34794
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lighting.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ heman_image* heman_lighting_compute_occlusion(heman_image* heightmap)
horizon_scan(heightmap, result, startpts, dx, dy);
}

// Invert the occlusion values and make sure they are valid.
for (int i = 0; i < width * height; i++) {
result->data[i] = 1.0f - result->data[i];
assert(result->data[i] >= 0.0 && result->data[i] <= 1.0f);
}

free(startpts);
return result;
}

0 comments on commit 8b34794

Please sign in to comment.