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:
authorLukas Stockner <lukas.stockner@freenet.de>2015-04-26 00:49:17 +0300
committerThomas Dinges <blender@dingto.org>2015-04-26 00:51:56 +0300
commit60c5a2f2d21da2373cccebe3de025440c16b44a6 (patch)
treeb0c4d50f26919c6ac732adb4ca5c50f73925f42c /intern/cycles/kernel/kernel_projection.h
parent01dda9a434f393fbd6787e9d1c3baf21374151e4 (diff)
Cycles: Add Mirror ball mapping to camera panorama options
The projection code was already in place, so this just exposes the option. Differential Revision: https://developer.blender.org/D1079
Diffstat (limited to 'intern/cycles/kernel/kernel_projection.h')
-rw-r--r--intern/cycles/kernel/kernel_projection.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_projection.h b/intern/cycles/kernel/kernel_projection.h
index bd18fd21354..62922df3286 100644
--- a/intern/cycles/kernel/kernel_projection.h
+++ b/intern/cycles/kernel/kernel_projection.h
@@ -163,6 +163,10 @@ ccl_device float3 mirrorball_to_direction(float u, float v)
dir.x = 2.0f*u - 1.0f;
dir.z = 2.0f*v - 1.0f;
+
+ if(dir.x*dir.x + dir.z*dir.z > 1.0f)
+ return make_float3(0.0f, 0.0f, 0.0f);
+
dir.y = -sqrtf(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
/* reflection */
@@ -191,6 +195,8 @@ ccl_device float3 panorama_to_direction(KernelGlobals *kg, float u, float v)
switch(kernel_data.cam.panorama_type) {
case PANORAMA_EQUIRECTANGULAR:
return equirectangular_range_to_direction(u, v, kernel_data.cam.equirectangular_range);
+ case PANORAMA_MIRRORBALL:
+ return mirrorball_to_direction(u, v);
case PANORAMA_FISHEYE_EQUIDISTANT:
return fisheye_to_direction(u, v, kernel_data.cam.fisheye_fov);
case PANORAMA_FISHEYE_EQUISOLID:
@@ -205,6 +211,8 @@ ccl_device float2 direction_to_panorama(KernelGlobals *kg, float3 dir)
switch(kernel_data.cam.panorama_type) {
case PANORAMA_EQUIRECTANGULAR:
return direction_to_equirectangular_range(dir, kernel_data.cam.equirectangular_range);
+ case PANORAMA_MIRRORBALL:
+ return direction_to_mirrorball(dir);
case PANORAMA_FISHEYE_EQUIDISTANT:
return direction_to_fisheye(dir, kernel_data.cam.fisheye_fov);
case PANORAMA_FISHEYE_EQUISOLID: