Added an option to bake AO normalized, without material settings taken
into account. The normalized result can often be easier to integrate into different materials, e.g. for games.
This commit is contained in:
parent
4100861f24
commit
6ea0adb462
@ -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
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user