Cycles: support for environment texture "Mirror Ball" projection mode, next to

existing "Equirectangular". This projection is useful to create light probes
from a chrome ball placed in a real scene. It expects as input a photograph of
the chrome ball, cropped so the ball just fits inside the image boundaries.

Example setup with panorama camera and mixing two (poor quality) photographs
from different viewpoints to avoid stretching and hide the photographer:
http://www.pasteall.org/pic/28036
This commit is contained in:
Brecht Van Lommel
2012-03-08 19:52:58 +00:00
parent 0f3e1821ea
commit 9b8dae71a5
11 changed files with 205 additions and 52 deletions

View File

@@ -171,11 +171,20 @@ __device void svm_node_tex_environment(KernelGlobals *kg, ShaderData *sd, float
{
uint id = node.y;
uint co_offset, out_offset, alpha_offset, srgb;
uint projection = node.w;
decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &srgb);
float3 co = stack_load_float3(stack, co_offset);
float2 uv = direction_to_equirectangular(co);
float2 uv;
co = normalize(co);
if(projection == 0)
uv = direction_to_equirectangular(co);
else
uv = direction_to_mirrorball(co);
float4 f = svm_image_texture(kg, id, uv.x, uv.y);
float3 r = make_float3(f.x, f.y, f.z);