diff options
author | Ton Roosendaal <ton@blender.org> | 2004-04-21 19:44:37 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-04-21 19:44:37 +0400 |
commit | f80809825e6b8a6ed61887547c4f091ae6eb5fdf (patch) | |
tree | 290b3f598bc47a0f928d93a64c6de04e8e6ec7e0 /source/blender/radiosity | |
parent | ebd762b5e78754468450bf262307a55af8c0e205 (diff) |
Fix for radio render.
Somewhere after 2.28c I fixed some thing in radio rendering that prevented
textures to be applied to radio energy.
Now it is a normal 'diffuse' energy again, and multiplied with actual
(textured) material color.
Small fix: the radiosity steps show up as numbers printed in time-cursor.
Diffstat (limited to 'source/blender/radiosity')
-rw-r--r-- | source/blender/radiosity/intern/source/radrender.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/radiosity/intern/source/radrender.c b/source/blender/radiosity/intern/source/radrender.c index d1849e45e5a..61d069ce587 100644 --- a/source/blender/radiosity/intern/source/radrender.c +++ b/source/blender/radiosity/intern/source/radrender.c @@ -265,6 +265,7 @@ static void applyformfactors_rr(VlakRen *shoot) /* main loop for itterations */ static void progressiverad_rr() { + extern void RE_local_timecursor(int); // RE_callbacks.c VlakRen *shoot; int it= 0; @@ -279,7 +280,8 @@ static void progressiverad_rr() applyformfactors_rr(shoot); it++; - printf("\r Radiosity step %d", it); fflush(stdout); + RE_local_timecursor(it); + // printf("\r Radiosity step %d", it); fflush(stdout); clear_backface_test_rr(); @@ -288,7 +290,9 @@ static void progressiverad_rr() shoot= findshoot_rr(); } - printf("\n Unshot energy:%f\n", 1000.0*maxenergy); + printf(" Unshot energy:%f\n", 1000.0*maxenergy); + + RE_local_timecursor((G.scene->r.cfra)); } static RadFace *radfaces=NULL; @@ -476,6 +480,9 @@ static void make_vertex_rad_values() RadFace *rf; int a; + RG.igamma= 1.0/RG.gamma; + RG.radfactor= RG.radfac*pow(64*64, RG.igamma)/128.0; /* compatible with radio-tool */ + /* accumulate vertexcolors */ for(a=0; a<R.totvlak; a++) { if((a & 255)==0) vlr= R.blovl[a>>8]; else vlr++; @@ -483,6 +490,16 @@ static void make_vertex_rad_values() if(vlr->radface) { rf= vlr->radface; + /* apply correction */ + rf->totrad[0]= RG.radfactor*pow( rf->totrad[0], RG.igamma); + rf->totrad[1]= RG.radfactor*pow( rf->totrad[1], RG.igamma); + rf->totrad[2]= RG.radfactor*pow( rf->totrad[2], RG.igamma); + + /* correct rf->rad values for color */ + if(vlr->mat->r > 0.0) rf->totrad[0]/= vlr->mat->r; + if(vlr->mat->g > 0.0) rf->totrad[1]/= vlr->mat->g; + if(vlr->mat->b > 0.0) rf->totrad[2]/= vlr->mat->b; + vecaddfac(vlr->v1->rad, vlr->v1->rad, rf->totrad, rf->area); vlr->v1->accum+= rf->area; vecaddfac(vlr->v2->rad, vlr->v2->rad, rf->totrad, rf->area); @@ -497,15 +514,12 @@ static void make_vertex_rad_values() } /* make vertex colors */ - RG.igamma= 1.0/RG.gamma; - RG.radfactor= RG.radfac*pow(64*64, RG.igamma)/128.0; /* compatible with radio-tool */ - for(a=0; a<R.totvert; a++) { if((a & 255)==0) v1= R.blove[a>>8]; else v1++; if(v1->accum>0.0) { - v1->rad[0]= RG.radfactor*pow( v1->rad[0]/v1->accum, RG.igamma); - v1->rad[1]= RG.radfactor*pow( v1->rad[1]/v1->accum, RG.igamma); - v1->rad[2]= RG.radfactor*pow( v1->rad[2]/v1->accum, RG.igamma); + v1->rad[0]/= v1->accum; + v1->rad[1]/= v1->accum; + v1->rad[2]/= v1->accum; } } |