Found error in Energy for AO. This didnt work correctly for 'sub' and 'add
and sub' methods. Also reduced limit for slider. AO energy of value 50 was useless.
This commit is contained in:
		@@ -2101,8 +2101,8 @@ void ray_ao(ShadeInput *shi, World *wrld, float *shadfac)
 | 
			
		||||
		vec+= 3;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	div= wrld->aoenergy/(float)(actual);
 | 
			
		||||
	shadfac[3] = wrld->aoenergy - (sh*div);
 | 
			
		||||
	div= 1.0/(float)(actual);
 | 
			
		||||
	shadfac[3] = 1.0 - (sh*div);
 | 
			
		||||
	
 | 
			
		||||
	if(wrld->aocolor!=WO_AOPLAIN) {
 | 
			
		||||
		shadfac[0] *= div;
 | 
			
		||||
 
 | 
			
		||||
@@ -1644,14 +1644,14 @@ static void ambient_occlusion(World *wrld, ShadeInput *shi, ShadeResult *shr)
 | 
			
		||||
{
 | 
			
		||||
	float f, shadfac[4];
 | 
			
		||||
	
 | 
			
		||||
	if(wrld->mode & WO_AMB_OCC) {
 | 
			
		||||
	if((wrld->mode & WO_AMB_OCC) && (R.r.mode & R_RAYTRACE)) {
 | 
			
		||||
		ray_ao(shi, wrld, shadfac);
 | 
			
		||||
 | 
			
		||||
		if(wrld->aocolor==WO_AOPLAIN) {
 | 
			
		||||
			if (wrld->aomix==WO_AOADDSUB) shadfac[3] = 2.0*shadfac[3]-1.0;
 | 
			
		||||
			else if (wrld->aomix==WO_AOSUB) shadfac[3] = shadfac[3]-1.0;
 | 
			
		||||
 | 
			
		||||
			f= shadfac[3]*shi->matren->amb;
 | 
			
		||||
			f= wrld->aoenergy*shadfac[3]*shi->matren->amb;
 | 
			
		||||
			shr->diff[0] += f;
 | 
			
		||||
			shr->diff[1] += f;
 | 
			
		||||
			shr->diff[2] += f;
 | 
			
		||||
@@ -1667,7 +1667,7 @@ static void ambient_occlusion(World *wrld, ShadeInput *shi, ShadeResult *shr)
 | 
			
		||||
				shadfac[1] = shadfac[1]-1.0;
 | 
			
		||||
				shadfac[2] = shadfac[2]-1.0;
 | 
			
		||||
			}
 | 
			
		||||
			f= shi->matren->amb;
 | 
			
		||||
			f= wrld->aoenergy*shi->matren->amb;
 | 
			
		||||
			shr->diff[0] += f*shadfac[0];
 | 
			
		||||
			shr->diff[1] += f*shadfac[1];
 | 
			
		||||
			shr->diff[2] += f*shadfac[2];
 | 
			
		||||
 
 | 
			
		||||
@@ -1731,7 +1731,7 @@ static void world_panel_amb_occ(World *wrld)
 | 
			
		||||
		uiDefButS(block, ROW, B_REDR, "Sky Texture", 210, 25, 100, 20, &wrld->aocolor, 2.0, (float)WO_AOSKYTEX, 0, 0, "Does full Sky texture render for diffuse energy");
 | 
			
		||||
		uiBlockEndAlign(block);
 | 
			
		||||
		
 | 
			
		||||
		uiDefButF(block, NUMSLI, 0, "Energy:", 10, 0, 300, 19, &wrld->aoenergy, 0.01, 50.0, 100, 0, "Sets global energy scale for AO");
 | 
			
		||||
		uiDefButF(block, NUMSLI, 0, "Energy:", 10, 0, 300, 19, &wrld->aoenergy, 0.01, 3.0, 100, 0, "Sets global energy scale for AO");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user