Turned Sky render code in Blender to become fully float, it still returned

bytes for RGB.
This to allow very bright contrasted images to be used for AO as well. As
a first start also the Texture->Colors panel now allows contrast setting
up to 5.0 (was 2.0).
This commit is contained in:
2004-04-24 20:27:29 +00:00
parent 382297b687
commit 5bbd35ff05
7 changed files with 46 additions and 40 deletions

View File

@@ -1544,17 +1544,11 @@ static void traceray(short depth, float *start, float *vec, float *col, VlakRen
}
else { /* sky */
char skycol[4];
VECCOPY(shi.view, vec);
Normalise(shi.view);
RE_sky(shi.view, skycol);
col[0]= skycol[0]/255.0;
col[1]= skycol[1]/255.0;
col[2]= skycol[2]/255.0;
RE_sky(shi.view, col);
}
}
@@ -2121,7 +2115,7 @@ void ray_ao(ShadeInput *shi, World *wrld, float *shadfac)
else sh+= 1.0;
}
else if(wrld->aocolor!=WO_AOPLAIN) {
char skycol[4];
float skycol[4];
float fac, view[3];
view[0]= -vec[0];
@@ -2137,9 +2131,9 @@ void ray_ao(ShadeInput *shi, World *wrld, float *shadfac)
}
else {
RE_sky(view, skycol);
shadfac[0]+= skycol[0]/255.0;
shadfac[1]+= skycol[1]/255.0;
shadfac[2]+= skycol[2]/255.0;
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
shadfac[2]+= skycol[2];
}
}
}

View File

@@ -163,9 +163,9 @@ float mistfactor(float *co) /* dist en height, return alpha */
return (1.0-fac)* (1-R.wrld.misi);
}
void RE_sky(float *view, char *col)
void RE_sky(float *view, float *col)
{
float lo[3], rf, gf, bf;
float lo[3];
if((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
*( (unsigned int *)col)= R.wrld.fastcol;
@@ -206,22 +206,31 @@ void RE_sky(float *view, char *col)
R.inprh= 1.0-R.inprz;
if(R.wrld.skytype & WO_SKYBLEND) {
rf= 255.0*(R.inprh*R.wrld.horr + R.inprz*R.wrld.zenr);
gf= 255.0*(R.inprh*R.wrld.horg + R.inprz*R.wrld.zeng);
bf= 255.0*(R.inprh*R.wrld.horb + R.inprz*R.wrld.zenb);
if (rf>255.0) col[0]= 255;
else col[0]= (char)rf;
if (gf>255.0) col[1]= 255;
else col[1]= (char)gf;
if (bf>255.0) col[2]= 255;
else col[2]= (char)bf;
col[0]= (R.inprh*R.wrld.horr + R.inprz*R.wrld.zenr);
col[1]= (R.inprh*R.wrld.horg + R.inprz*R.wrld.zeng);
col[2]= (R.inprh*R.wrld.horb + R.inprz*R.wrld.zenb);
}
else {
col[0]= 255.0*R.wrld.horr;
col[1]= 255.0*R.wrld.horg;
col[2]= 255.0*R.wrld.horb;
col[0]= R.wrld.horr;
col[1]= R.wrld.horg;
col[2]= R.wrld.horb;
}
}
void RE_sky_char(float *view, char *col)
{
float f, colf[3];
RE_sky(view, colf);
f= 255.0*colf[0];
if(f<=0.0) col[0]= 0; else if(f>255.0) col[0]= 255;
else col[0]= (char)f;
f= 255.0*colf[1];
if(f<=0.0) col[1]= 0; else if(f>255.0) col[1]= 255;
else col[1]= (char)f;
f= 255.0*colf[2];
if(f<=0.0) col[2]= 0; else if(f>255.0) col[2]= 255;
else col[2]= (char)f;
col[3]= 1; /* to prevent wrong optimalisation alphaover of flares */
}
@@ -372,7 +381,7 @@ void scanlinesky(char *rect, int y)
view[2]= -panosi*u + panoco*v;
}
RE_sky(view, (char *)&col);
RE_sky_char(view, (char *)&col);
if(rect[3]==0) *((unsigned int *)rect)= col;
else alphafunc(rect, &col);