From e19dab2622b89471dba3000bd42b5598fc4ebee8 Mon Sep 17 00:00:00 2001 From: TriBlade9 Date: Wed, 14 Jan 2015 23:34:44 +1000 Subject: Added configurable ambient_occlusion_gamma. Default is 2.2 (same as previous hardcoded values). --- src/mapblock_mesh.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/mapblock_mesh.cpp') diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 0e5a883f2..8afca73a5 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -288,9 +288,15 @@ static u16 getSmoothLightCombined(v3s16 p, MeshMakeData *data) if (ambient_occlusion > 4) { - //table of precalculated gamma space multiply factors - //light^2.2 * factor (0.75, 0.5, 0.25, 0.0), so table holds factor ^ (1 / 2.2) - static const float light_amount[4] = { 0.877424315, 0.729740053, 0.532520545, 0.0 }; + static const float ao_gamma = rangelim( + g_settings->getFloat("ambient_occlusion_gamma"), 0.25, 4.0); + + // Table of gamma space multiply factors. + static const float light_amount[3] = { + powf(0.75, 1.0 / ao_gamma), + powf(0.5, 1.0 / ao_gamma), + powf(0.25, 1.0 / ao_gamma) + }; //calculate table index for gamma space multiplier ambient_occlusion -= 5; -- cgit v1.2.3