- Fix for bug #17825: baking SSS is not supported, but it didn't give

proper results, should bake as if SSS was disabled.
- Fix for GLSL to handle failing shadow buffer creation better.
- Fix for sky/atmosphere version patch, was not doing files from 2.46
  and newer.
This commit is contained in:
2008-10-12 13:32:28 +00:00
parent 23a02bbead
commit 96e9debe1f
5 changed files with 32 additions and 22 deletions

View File

@@ -7767,23 +7767,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* sun/sky */
if(main->versionfile < 246) {
Lamp *la;
Object *ob;
bActuator *act;
for(la=main->lamp.first; la; la= la->id.next) {
la->sun_effect_type = 0;
la->horizon_brightness = 1.0;
la->spread = 1.0;
la->sun_brightness = 1.0;
la->sun_size = 1.0;
la->backscattered_light = 1.0;
la->atm_turbidity = 2.0;
la->atm_inscattering_factor = 1.0;
la->atm_extinction_factor = 1.0;
la->atm_distance_factor = 1.0;
la->sun_intensity = 1.0;
}
/* dRot actuator change direction in 2.46 */
for(ob = main->object.first; ob; ob= ob->id.next) {
for(act= ob->actuators.first; act; act= act->next) {
@@ -7946,6 +7932,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
if (main->versionfile < 248) {
Lamp *la;
for(la=main->lamp.first; la; la= la->id.next) {
if(la->atm_turbidity == 0.0) {
la->sun_effect_type = 0;
la->horizon_brightness = 1.0;
la->spread = 1.0;
la->sun_brightness = 1.0;
la->sun_size = 1.0;
la->backscattered_light = 1.0;
la->atm_turbidity = 2.0;
la->atm_inscattering_factor = 1.0;
la->atm_extinction_factor = 1.0;
la->atm_distance_factor = 1.0;
la->sun_intensity = 1.0;
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

View File

@@ -1362,10 +1362,14 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
static void gpu_lamp_shadow_free(GPULamp *lamp)
{
if(lamp->tex)
if(lamp->tex) {
GPU_texture_free(lamp->tex);
if(lamp->fb)
lamp->tex= NULL;
}
if(lamp->fb) {
GPU_framebuffer_free(lamp->fb);
lamp->fb= NULL;
}
}
GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)

View File

@@ -59,7 +59,7 @@ void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area,
void free_sss(struct Render *re);
int sample_sss(struct Render *re, struct Material *mat, float *co, float *col);
int has_sss_tree(struct Render *re, struct Material *mat);
int sss_pass_done(struct Render *re, struct Material *mat);
#endif /*SSS_H*/

View File

@@ -1568,7 +1568,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->col[2]= shi->b*shi->alpha;
shr->col[3]= shi->alpha;
if((ma->sss_flag & MA_DIFF_SSS) && !has_sss_tree(&R, ma)) {
if((ma->sss_flag & MA_DIFF_SSS) && !sss_pass_done(&R, ma)) {
if(ma->sss_texfac == 0.0f) {
shi->r= shi->g= shi->b= shi->alpha= 1.0f;
shr->col[0]= shr->col[1]= shr->col[2]= shr->col[3]= 1.0f;
@@ -1722,7 +1722,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->alpha= shi->alpha;
/* from now stuff everything in shr->combined: ambient, AO, radio, ramps, exposure */
if(!(ma->sss_flag & MA_DIFF_SSS) || !has_sss_tree(&R, ma)) {
if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
shr->combined[0]+= shi->ambr;
shr->combined[1]+= shi->ambg;
shr->combined[2]+= shi->ambb;
@@ -1772,7 +1772,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
/* modulate by the object color */
if((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) {
if(!(ma->sss_flag & MA_DIFF_SSS) || !has_sss_tree(&R, ma)) {
if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
float obcol[4];
QUATCOPY(obcol, shi->obr->ob->col);

View File

@@ -1023,8 +1023,8 @@ int sample_sss(Render *re, Material *mat, float *co, float *color)
return 0;
}
int has_sss_tree(struct Render *re, struct Material *mat)
int sss_pass_done(struct Render *re, struct Material *mat)
{
return (re->sss_hash && BLI_ghash_lookup(re->sss_hash, mat));
return ((re->flag & R_BAKING) || (re->sss_hash && BLI_ghash_lookup(re->sss_hash, mat)));
}