diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 67126c50233..7a577d22685 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -672,6 +672,7 @@ typedef struct Scene { #define R_BAKE_CLEAR 1 #define R_BAKE_OSA 2 #define R_BAKE_TO_ACTIVE 4 +#define R_BAKE_NORMALIZE_AO 8 /* bake_normal_space */ #define R_BAKE_SPACE_CAMERA 0 diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index 22ddebe356c..039faf119df 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1322,7 +1322,7 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass) static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, float *co, float *n, int thread, int onlyshadow, float *skycol) { - float nn[3], bn[3], dxyview[3], fac, occ, occlusion, correction; + float nn[3], bn[3], fac, occ, occlusion, correction; int aocolor; aocolor= re->wrld.aocolor; @@ -1351,6 +1351,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f } #if 0 else { /* WO_AOSKYTEX */ + float dxyview[3]; bn[0]= -bn[0]; bn[1]= -bn[1]; bn[2]= -bn[2]; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 051f9ed4e89..f3bbfb47bc8 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1832,7 +1832,11 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int if(bs->type==RE_BAKE_AO) { ambient_occlusion(shi); - ambient_occlusion_to_diffuse(shi, shr.combined); + + if(R.r.bake_flag & R_BAKE_NORMALIZE_AO) + VECCOPY(shr.combined, shi->ao) + else + ambient_occlusion_to_diffuse(shi, shr.combined); } else { shade_input_set_shade_texco(shi); diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 1290236a4ff..055674097b0 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -2082,6 +2082,8 @@ static void render_panel_bake(void) if(G.scene->r.bake_mode == RE_BAKE_NORMALS) uiDefButS(block, MENU, B_DIFF, "Normal Space %t|Camera %x0|World %x1|Object %x2|Tangent %x3", 10,70,190,20, &G.scene->r.bake_normal_space, 0, 0, 0, 0, "Choose normal space for baking"); + else if(G.scene->r.bake_mode == RE_BAKE_AO) + uiDefButBitS(block, TOG, R_BAKE_NORMALIZE_AO, B_DIFF, "Normalized", 10,70,190,20, &G.scene->r.bake_flag, 0.0, 0, 0, 0, "Bake ambient occlusion normalized, without taking into acount material settings"); #if 0 uiBlockBeginAlign(block);