[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16829] trunk/blender/source/blender/ render/intern: Bugfix #17711
Ton Roosendaal
ton at blender.org
Mon Sep 29 19:55:13 CEST 2008
Revision: 16829
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16829
Author: ton
Date: 2008-09-29 19:55:11 +0200 (Mon, 29 Sep 2008)
Log Message:
-----------
Bugfix #17711
SunSky didn't include skycolor in raytrace.
Note: there seems to be an error in sunsky when looking straight down,
so this option requires raytracing stuff not in outer space. :)
Modified Paths:
--------------
trunk/blender/source/blender/render/intern/include/pixelshading.h
trunk/blender/source/blender/render/intern/source/pixelshading.c
trunk/blender/source/blender/render/intern/source/rayshade.c
Modified: trunk/blender/source/blender/render/intern/include/pixelshading.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/pixelshading.h 2008-09-29 17:46:25 UTC (rev 16828)
+++ trunk/blender/source/blender/render/intern/include/pixelshading.h 2008-09-29 17:55:11 UTC (rev 16829)
@@ -56,7 +56,7 @@
void shadeSkyPixel(float *collector, float fx, float fy);
void shadeSkyView(float *colf, float *rco, float *view, float *dxyview);
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
-
+void shadeSunView(float *colf, float *view);
/* ------------------------------------------------------------------------- */
#endif
Modified: trunk/blender/source/blender/render/intern/source/pixelshading.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/pixelshading.c 2008-09-29 17:46:25 UTC (rev 16828)
+++ trunk/blender/source/blender/render/intern/source/pixelshading.c 2008-09-29 17:55:11 UTC (rev 16829)
@@ -570,27 +570,37 @@
}
/* shade sky according to sun lamps, all parameters are like shadeSkyView except sunsky*/
-void shadeSunView(struct SunSky *sunsky, float *colf, float *rco, float *view, float *dxyview)
+void shadeSunView(float *colf, float *view)
{
- float colorxyz[3];
+ GroupObject *go;
+ LampRen *lar;
+ float sview[3];
+ int do_init= 1;
+
+ for(go=R.lights.first; go; go= go->next) {
+ lar= go->lampren;
+ if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
+ float sun_collector[3];
+ float colorxyz[3];
- /**
- sunAngle = sqrt(sunsky->sunSolidAngle / M_PI);
-
- sunDir[0] = sunsky->toSun[0];
- sunDir[1] = sunsky->toSun[1];
- sunDir[2] = sunsky->toSun[2];
- */
+ if(do_init) {
+
+ VECCOPY(sview, view);
+ Normalize(sview);
+ MTC_Mat3MulVecfl(R.imat, sview);
+ if (sview[2] < 0.0)
+ sview[2] = 0.0;
+ Normalize(sview);
+ do_init= 0;
+ }
- Normalize(view);
- MTC_Mat3MulVecfl(R.imat, view);
- if (view[2] < 0.0)
- view[2] = 0.0;
- Normalize(view);
-
- GetSkyXYZRadiancef(sunsky, view, colorxyz);
-
- xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &colf[0], &colf[1], &colf[2], sunsky->sky_colorspace);
+ GetSkyXYZRadiancef(lar->sunsky, sview, colorxyz);
+ xyz_to_rgb(colorxyz[0], colorxyz[1], colorxyz[2], &sun_collector[0], &sun_collector[1], &sun_collector[2],
+ lar->sunsky->sky_colorspace);
+
+ ramp_blend(lar->sunsky->skyblendtype, colf, colf+1, colf+2, lar->sunsky->skyblendfac, sun_collector);
+ }
+ }
}
@@ -599,8 +609,6 @@
*/
void shadeSkyPixel(float *collector, float fx, float fy)
{
- GroupObject *go;
- LampRen *lar;
float view[3], dxyview[2];
/*
@@ -648,19 +656,9 @@
shadeSkyView(collector, NULL, view, dxyview);
collector[3] = 0.0f;
}
-
- for(go=R.lights.first; go; go= go->next) {
- lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
- float sun_collector[3];
-
- calc_view_vector(view, fx, fy);
- Normalize(view);
-
- shadeSunView(lar->sunsky, sun_collector, NULL, view, NULL);
- ramp_blend(lar->sunsky->skyblendtype, collector, collector+1, collector+2, lar->sunsky->skyblendfac, sun_collector);
- }
- }
+
+ calc_view_vector(view, fx, fy);
+ shadeSunView(collector, view);
}
/* aerial perspective */
Modified: trunk/blender/source/blender/render/intern/source/rayshade.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rayshade.c 2008-09-29 17:46:25 UTC (rev 16828)
+++ trunk/blender/source/blender/render/intern/source/rayshade.c 2008-09-29 17:55:11 UTC (rev 16829)
@@ -397,6 +397,7 @@
Normalize(shi->view);
shadeSkyView(col, isec->start, shi->view, NULL);
+ shadeSunView(col, shi->view);
}
}
@@ -1627,6 +1628,7 @@
}
else { /* WO_AOSKYTEX */
shadeSkyView(skycol, isec.start, view, dxyview);
+ shadeSunView(skycol, shi->view);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
shadfac[2]+= skycol[2];
@@ -1751,6 +1753,7 @@
}
else { /* WO_AOSKYTEX */
shadeSkyView(skycol, isec.start, view, dxyview);
+ shadeSunView(skycol, shi->view);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
shadfac[2]+= skycol[2];
More information about the Bf-blender-cvs
mailing list