Commit: de80ecc8fbd41981d11605c89b9b10b31922ae2d
Author: Campbell Barton
Date: Fri Mar 11 20:30:26 2016 +1100
Branches: blender-v2.77-release
https://developer.blender.org/rBde80ecc8fbd41981d11605c89b9b10b31922ae2d
Fix T47753: World equirectangular regression
D1729 fixed 'View' projection but broke 'Equirectangular'.
This commit also changes equirectangular projection to match Cycles and the
viewport.
===================================================================
M source/blender/render/intern/include/texture.h
M source/blender/render/intern/source/pixelshading.c
M source/blender/render/intern/source/render_texture.c
===================================================================
diff --git a/source/blender/render/intern/include/texture.h
b/source/blender/render/intern/include/texture.h
index 1141449..dfb491f 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -74,7 +74,9 @@ struct ImagePool;
/* texture.h */
void do_halo_tex(struct HaloRen *har, float xn, float yn, float col_r[4]);
-void do_sky_tex(const float rco[3], const float lo[3], const float dxyview[2],
float hor[3], float zen[3], float *blend, int skyflag, short thread);
+void do_sky_tex(
+ const float rco[3], const float view[3], const float lo[3], const
float dxyview[2],
+ float hor[3], float zen[3], float *blend, int skyflag, short thread);
void do_material_tex(struct ShadeInput *shi, struct Render *re);
void do_lamp_tex(LampRen *la, const float lavec[3], struct ShadeInput *shi,
float col_r[3], int effect);
void do_volume_tex(struct ShadeInput *shi, const float xyz[3], int mapto_flag,
float col_r[3], float *val, struct Render *re);
diff --git a/source/blender/render/intern/source/pixelshading.c
b/source/blender/render/intern/source/pixelshading.c
index f577333..97d6b06 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -521,7 +521,16 @@ void shadeSkyView(float col_r[3], const float rco[3],
const float view[3], const
/* Careful: SKYTEX and SKYBLEND are NOT mutually exclusive! If
*/
/* SKYBLEND is active, the texture and color blend are added.
*/
if (R.wrld.skytype & WO_SKYTEX) {
- do_sky_tex(rco, view, dxyview, hor, zen, &blend, skyflag,
thread);
+ float lo[3];
+ copy_v3_v3(lo, view);
+ if (R.wrld.skytype & WO_SKYREAL) {
+
+ mul_m3_v3(R.imat, lo);
+
+ SWAP(float, lo[1], lo[2]);
+
+ }
+ do_sky_tex(rco, view, lo, dxyview, hor, zen, &blend, skyflag,
thread);
}
if (blend>1.0f) blend= 1.0f;
diff --git a/source/blender/render/intern/source/render_texture.c
b/source/blender/render/intern/source/render_texture.c
index 29d8f17..d1f7920 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -3014,13 +3014,14 @@ void do_halo_tex(HaloRen *har, float xn, float yn,
float col_r[4])
/* ------------------------------------------------------------------------- */
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
-void do_sky_tex(const float rco[3], const float lo[3], const float dxyview[2],
float hor[3], float zen[3], float *blend, int skyflag, short thread)
+void do_sky_tex(
+ const float rco[3], const float view[3], const float lo[3], const
float dxyview[2],
+ float hor[3], float zen[3], float *blend, int skyflag, short thread)
{
const bool skip_load_image = (R.r.scemode & R_NO_IMAGE_LOAD) != 0;
MTex *mtex;
Tex *tex;
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
- const float *co;
float fact, stencilTin=1.0;
float tempvec[3], texvec[3], dxt[3], dyt[3];
int tex_nr, rgb= 0;
@@ -3031,6 +3032,8 @@ void do_sky_tex(const float rco[3], const float lo[3],
const float dxyview[2], f
for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
if (R.wrld.mtex[tex_nr]) {
+ const float *co;
+
mtex= R.wrld.mtex[tex_nr];
tex= mtex->tex;
@@ -3092,8 +3095,8 @@ void do_sky_tex(const float rco[3], const float lo[3],
const float dxyview[2], f
}
break;
case TEXCO_EQUIRECTMAP:
- tempvec[0]= atan2f(lo[0], lo[2]) / (float)M_PI;
- tempvec[1]= 1.0f - 2.0f*saacos(lo[1]) /
(float)M_PI;
+ tempvec[0]= -atan2f(lo[2], lo[0]) / M_PI;
+ tempvec[1]= atan2f(lo[1], hypot(lo[0], lo[2]))
/ M_PI_2;
tempvec[2]= 0.0f;
co= tempvec;
break;
@@ -3119,6 +3122,9 @@ void do_sky_tex(const float rco[3], const float lo[3],
const float dxyview[2], f
// copy_v3_v3(shi->dygl, shi->dyco);
// mul_m3_v3(R.imat, shi->dyco);
break;
+ case TEXCO_VIEW:
+ co = view;
+ break;
}
/* placement */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs