Fix #20914: non-normalized AO baking was not working anymore.

This commit is contained in:
2010-02-07 15:24:10 +00:00
parent 3bd78cf8f6
commit f9917af00b
3 changed files with 9 additions and 3 deletions

View File

@@ -86,8 +86,8 @@ void shade_lamp_loop(struct ShadeInput *shi, struct ShadeResult *shr);
void shade_color(struct ShadeInput *shi, ShadeResult *shr);
void ambient_occlusion_to_diffuse(struct ShadeInput *shi, float *diff);
void ambient_occlusion(struct ShadeInput *shi);
void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr);
ListBase *get_lights(struct ShadeInput *shi);
float lamp_get_visibility(struct LampRen *lar, float *co, float *lv, float *dist);

View File

@@ -2135,7 +2135,13 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int
if(bs->type==RE_BAKE_AO) {
ambient_occlusion(shi);
VECCOPY(shr.combined, shi->ao)
if(R.r.bake_flag & R_BAKE_NORMALIZE) {
copy_v3_v3(shr.combined, shi->ao);
}
else {
zero_v3(shr.combined);
environment_lighting_apply(shi, &shr);
}
}
else {
if (bs->type==RE_BAKE_SHADOW) /* Why do shadows set the color anyhow?, ignore material color for baking */

View File

@@ -1050,7 +1050,7 @@ static void ambient_occlusion_apply(ShadeInput *shi, ShadeResult *shr)
}
}
static void environment_lighting_apply(ShadeInput *shi, ShadeResult *shr)
void environment_lighting_apply(ShadeInput *shi, ShadeResult *shr)
{
float f= R.wrld.ao_env_energy*shi->amb;