diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2015-04-26 00:49:17 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2015-04-26 00:51:56 +0300 |
commit | 60c5a2f2d21da2373cccebe3de025440c16b44a6 (patch) | |
tree | b0c4d50f26919c6ac732adb4ca5c50f73925f42c /intern/cycles/kernel | |
parent | 01dda9a434f393fbd6787e9d1c3baf21374151e4 (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')
-rw-r--r-- | intern/cycles/kernel/kernel_projection.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 1 |
2 files changed, 9 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: diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 238b4b0bfdc..05cfb0adc71 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -426,6 +426,7 @@ enum CameraType { enum PanoramaType { PANORAMA_EQUIRECTANGULAR, + PANORAMA_MIRRORBALL, PANORAMA_FISHEYE_EQUIDISTANT, PANORAMA_FISHEYE_EQUISOLID }; |