Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-03-11 12:30:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-03-11 12:36:59 +0300
commitc149b6b7d72f9d399a8e49160be8a2788b3f2c0e (patch)
tree0f4168eed3cd921fc62729027c0d6eb673fcf14d /source/blender/render
parentb5b269ac11679d52d3d062e1f584fef83acaefc0 (diff)
Fix T47753: World equirectangular regression
D1729 fixed 'View' projection but broke 'Equirectangular'. This commit also changes equirectangular projection to match Cycles and the viewport.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/include/texture.h4
-rw-r--r--source/blender/render/intern/source/pixelshading.c11
-rw-r--r--source/blender/render/intern/source/render_texture.c14
3 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index 1141449f2ab..dfb491f46b0 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 f577333fcd7..97d6b060e0a 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 807686ab65c..5cb5c340d98 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -3109,14 +3109,15 @@ 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;
const bool texnode_preview = (R.r.scemode & R_TEXNODE_PREVIEW) != 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;
@@ -3127,6 +3128,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;
@@ -3188,8 +3191,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;
@@ -3215,6 +3218,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 */