Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-06-26 22:03:57 +0400
committerTon Roosendaal <ton@blender.org>2004-06-26 22:03:57 +0400
commit263d0823d3fb28088dd5e0042deb7f27676a125c (patch)
treeb7ee325d7f03d2b0c874fb78023a155d51e65c05 /source/blender/radiosity
parent2a6c8a2797ab3f629d6ab7c36e5e33cc3f7af9d3 (diff)
Changes in code to allow double sided energy, but it's not possible
to activate it. Added comment in code how to enable it for those who like to play (search for translu) What doesnt work - according to me not satisfying - is fact that radiosity hemicubes alias badly on short distances, so interior light doesn't spread well.
Diffstat (limited to 'source/blender/radiosity')
-rw-r--r--source/blender/radiosity/extern/include/radio_types.h1
-rw-r--r--source/blender/radiosity/intern/source/radfactors.c11
-rw-r--r--source/blender/radiosity/intern/source/radpreprocess.c3
-rw-r--r--source/blender/radiosity/intern/source/radrender.c29
4 files changed, 35 insertions, 9 deletions
diff --git a/source/blender/radiosity/extern/include/radio_types.h b/source/blender/radiosity/extern/include/radio_types.h
index 4d5e56d7a15..910b50e4373 100644
--- a/source/blender/radiosity/extern/include/radio_types.h
+++ b/source/blender/radiosity/extern/include/radio_types.h
@@ -70,6 +70,7 @@ typedef struct RadView {
#define RAD_SHOOT 2
#define RAD_SUBDIV 4
#define RAD_BACKFACE 8
+#define RAD_TWOSIDED 16
typedef struct RNode { /* length: 76 */
diff --git a/source/blender/radiosity/intern/source/radfactors.c b/source/blender/radiosity/intern/source/radfactors.c
index fb66f994cbc..cbe861fa443 100644
--- a/source/blender/radiosity/intern/source/radfactors.c
+++ b/source/blender/radiosity/intern/source/radfactors.c
@@ -524,6 +524,7 @@ void rad_init_energy()
void progressiverad()
{
RPatch *shoot;
+ float unshot[3];
int it= 0;
rad_printstatus();
@@ -539,8 +540,16 @@ void progressiverad()
drawpatch_ext(shoot, 0x88FF00);
+ if(shoot->first->f & RAD_TWOSIDED) {
+ VECCOPY(unshot, shoot->unshot);
+ VecMulf(shoot->norm, -1.0);
+ if(makeformfactors(shoot))
+ applyformfactors(shoot);
+ VecMulf(shoot->norm, -1.0);
+ VECCOPY(shoot->unshot, unshot);
+ }
+
if( makeformfactors(shoot) ) {
-
applyformfactors(shoot);
it++;
diff --git a/source/blender/radiosity/intern/source/radpreprocess.c b/source/blender/radiosity/intern/source/radpreprocess.c
index 80c6294db02..1f2f8bc2a89 100644
--- a/source/blender/radiosity/intern/source/radpreprocess.c
+++ b/source/blender/radiosity/intern/source/radpreprocess.c
@@ -459,6 +459,9 @@ void rad_collect_meshes()
rp->emit[1]*= rp->ref[1];
rp->emit[2]*= rp->ref[2];
+// uncommented, this is not satisfying, but i leave it in code for now (ton)
+// if(ma->translucency!=0.0) rn->f |= RAD_TWOSIDED;
+
nodevert= (VeNoCo **)&(rn->v1);
for(b=0; b<rp->type; b++) {
rp->cent[0]+= (*nodevert)->v[0];
diff --git a/source/blender/radiosity/intern/source/radrender.c b/source/blender/radiosity/intern/source/radrender.c
index 61d069ce587..6c94d3f8da9 100644
--- a/source/blender/radiosity/intern/source/radrender.c
+++ b/source/blender/radiosity/intern/source/radrender.c
@@ -127,9 +127,8 @@ static void backface_test_rr(VlakRen *shoot)
for(a=0; a<R.totvlak; a++) {
if((a & 255)==0) vlr= R.blovl[a>>8]; else vlr++;
if(vlr->radface) {
- rf= vlr->radface;
if(vlr!=shoot) {
-
+ rf= vlr->radface;
VecSubf(tvec, shoot->radface->cent, rf->cent);
if( tvec[0]*rf->norm[0]+ tvec[1]*rf->norm[1]+ tvec[2]*rf->norm[2] < 0.0) {
@@ -244,7 +243,8 @@ static void applyformfactors_rr(VlakRen *shoot)
r= (*fp)*unr*ref[0];
g= (*fp)*ung*ref[1];
b= (*fp)*unb*ref[2];
-
+
+ // if(rf->flag & RAD_BACKFACE) {
rf->totrad[0]+= r;
rf->totrad[1]+= g;
@@ -267,21 +267,32 @@ static void progressiverad_rr()
{
extern void RE_local_timecursor(int); // RE_callbacks.c
VlakRen *shoot;
+ float unshot[3];
int it= 0;
shoot= findshoot_rr();
while( shoot ) {
-
- /* backfaces receive no energy, but are zbuffered */
+
+ /* backfaces receive no energy, but are zbuffered... */
backface_test_rr(shoot);
+
+ /* ...unless it's two sided */
+ if(shoot->radface->flag & RAD_TWOSIDED) {
+ VECCOPY(unshot, shoot->radface->unshot);
+ VecMulf(shoot->radface->norm, -1.0);
+ makeformfactors_rr(shoot);
+ applyformfactors_rr(shoot);
+ VecMulf(shoot->radface->norm, -1.0);
+ VECCOPY(shoot->radface->unshot, unshot);
+ }
+
/* hemi-zbuffers */
makeformfactors_rr(shoot);
/* based at RG.formfactors array, distribute shoot energy over other faces */
applyformfactors_rr(shoot);
-
+
it++;
RE_local_timecursor(it);
- // printf("\r Radiosity step %d", it); fflush(stdout);
clear_backface_test_rr();
@@ -359,7 +370,9 @@ printf(" Rad elems: %d emittors %d\n", RG.totelem, RG.totpatch);
RG.min[b]= MIN2(RG.min[b], rf->cent[b]);
RG.max[b]= MAX2(RG.max[b], rf->cent[b]);
}
-
+
+// uncommented; this isnt satisfying, but i leave it in the code for now (ton)
+// if(vlr->mat->translucency!=0.0) rf->flag |= RAD_TWOSIDED;
vlr->radface= rf++;
}