diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2014-08-27 12:51:50 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2014-08-27 12:51:50 +0400 |
commit | 146ed67d5591e0058f24c30c81044b413cd66de4 (patch) | |
tree | 04b08cbd2914d5abc91e22567d3ed645251414f2 /intern/cycles/kernel/kernel_camera.h | |
parent | 9b9ddb46697b56213cb1e968ac0c8ddefc5ee79e (diff) |
Cycles Aperture Ratio - option to produce anamorphic bokeh
Thanks for Aldo Zang for the help with the fix for the panorama/fisheye
depth of field calculation and the overall math.
Reviewed By: sergey, dingto
Subscribers: juicyfruit, gregzaal, #cycles, dingto, matray
Differential Revision: https://developer.blender.org/D753
Diffstat (limited to 'intern/cycles/kernel/kernel_camera.h')
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 6b03abe9708..5c83358a56d 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -21,16 +21,22 @@ CCL_NAMESPACE_BEGIN ccl_device float2 camera_sample_aperture(KernelGlobals *kg, float u, float v) { float blades = kernel_data.cam.blades; + float2 bokeh; if(blades == 0.0f) { /* sample disk */ - return concentric_sample_disk(u, v); + bokeh = concentric_sample_disk(u, v); } else { /* sample polygon */ float rotation = kernel_data.cam.bladesrotation; - return regular_polygon_sample(blades, rotation, u, v); + bokeh = regular_polygon_sample(blades, rotation, u, v); } + + /* anamorphic lens bokeh */ + bokeh.x *= kernel_data.cam.inv_aperture_ratio; + + return bokeh; } ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float raster_y, float lens_u, float lens_v, Ray *ray) @@ -183,7 +189,8 @@ ccl_device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float /* calculate orthonormal coordinates perpendicular to D */ float3 U, V; - make_orthonormals(D, &U, &V); + U = normalize(make_float3(1.0f, 0.0f, 0.0f) - D.x * D); + V = normalize(cross(D, U)); /* update ray for effect of lens */ ray->P = U * lensuv.x + V * lensuv.y; |