}
/* Oren Nayar diffuse */
-/* nl is either dot product, or return value of area light */
+
+/* 'nl' is either dot product, or return value of area light */
+/* in latter case, only last multiplication uses 'nl' */
float OrenNayar_Diff_i(float nl, float *n, float *l, float *v, float rough )
{
float i, nh, nv, vh, realnl, h[3];
realnl= n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
if(realnl<=0.0) return 0.0;
- if(nl<0.0) nl= 0.0; /* value from area light */
+ if(nl<0.0) return 0.0; /* value from area light */
vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; /* Dot product between view vector and halfway vector */
if(vh<=0.0) vh= 0.0;
A = 1 - (0.5 * ((rough * rough) / ((rough * rough) + 0.33)));
B = 0.45 * ((rough * rough) / ((rough * rough) + 0.09));
- b*= 0.95; /* prevent tangens from shooting to inf, nl here can be not a dot product here. */
+ b*= 0.95; /* prevent tangens from shooting to inf, 'nl' can be not a dot product here. */
/* overflow only happens with extreme size area light, and higher roughness */
i = nl * ( A + ( B * t * sin(a) * tan(b) ) );
VecAddf(col, shr.diff, shr.spec);
+ /* exposure correction */
+ if(R.wrld.exposure!=0.0 || R.wrld.range!=1.0) {
+ col[0]= R.wrld.linfac*(1.0-exp( col[0]*R.wrld.logfac) );
+ col[1]= R.wrld.linfac*(1.0-exp( col[1]*R.wrld.logfac) );
+ col[2]= R.wrld.linfac*(1.0-exp( col[2]*R.wrld.logfac) );
+ }
+
/* MIST */
if( (R.wrld.mode & WO_MIST) && (shi.matren->mode & MA_NOMIST)==0 ){
alpha= mistfactor(shi.co);
uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
- uiDefBut(block, MENU|SHO, 1, "Physics %t|None %x1|Sumo %x2|ODE %x3 |Dynamo %x4|",
- 10,180,140,19, &wrld->pad1, 0, 0, 0, 0, "Physics Engine");
+ /* disabled, pad1 should not be used even! */
+ // uiDefBut(block, MENU|SHO, 1, "Physics %t|None %x1|Sumo %x2|ODE %x3 |Dynamo %x4|",
+ // 10,180,140,19, &wrld->pad1, 0, 0, 0, 0, "Physics Engine");
/* Gravitation for the game worlds */
uiDefButF(block, NUMSLI,0, "Grav ", 150,180,150,19, &(wrld->gravity), 0.0, 25.0, 0, 0, "Sets the gravitation constant of the game world");
uiDefButF(block, NUMSLI,B_MATPRV,"AmbR ", 10,50,145,19, &(wrld->ambr), 0.0, 1.0 ,0,0, "Sets the amount of red ambient colour");
uiDefButF(block, NUMSLI,B_MATPRV,"AmbG ", 10,30,145,19, &(wrld->ambg), 0.0, 1.0 ,0,0, "Sets the amount of green ambient colour");
uiDefButF(block, NUMSLI,B_MATPRV,"AmbB ", 10,10,145,19, &(wrld->ambb), 0.0, 1.0 ,0,0, "Sets the amount of blue ambient colour");
- uiBlockEndAlign(block);
- uiDefButF(block, NUMSLI,0, "Expos ", 160,10,145,19, &(wrld->exposure), 0.2, 5.0, 0, 0, "Sets the lighting time and exposure");
+ uiBlockBeginAlign(block);
+ uiBlockSetCol(block, TH_BUT_SETTING1);
+ uiDefButF(block, NUMSLI,0, "Exp ", 160,30,145,19, &(wrld->exposure), 0.0, 1.0, 0, 2, "Sets amount of exponential color correction for light");
+ uiDefButF(block, NUMSLI,0, "Range ", 160,10,145,19, &(wrld->range), 0.2, 5.0, 0, 2, "Sets the color amount that will be mapped on color 1.0");
}