In the visual effects industry it is common to shoot a picture of a
mirror ball (aka a "light probe") on set, as well as a gray ball
for lighting reference.
Ideally, one shoots these at multiple exposures and uses a tool
1 to combine
these into a single high dynamic range image and/or
unwrap the mirrored/gray ball into a spherical environment map.
However, it is often difficult to regain the proper orientation of
spherical map so it matches the camera used to render the CG scene.
Furthermore, a single photo of a mirror/gray ball contains poor data
for certain angles that one want to avoid seeing in the final render.
These shaders are intended to simplify a special case: When the
mirror/gray ball is already shot from the exact camera angle
that the final image will be rendered from.
It simply utilizes the mental ray camera coordinate space and applies
the mirror/gray ball in this space, hence the orientation of the
reflections will always 'stick' to the rendering camera.
This shader is intended as an environment shader, since it looks
up based on the ray direction. It will map the proper direction to a
point on the mirrored ball and retrieve its color.
The texture parameter should point to an image of a mirrored ball
that is cropped so the ball exactly touches the edges of the image.
Ideally it should point directly to a mental ray color texture but it
can also be another shader.
If necessary, the shader can apply an inverse gamma correction to
the texture by the degamma parameter. If gamma is handled
by other shaders in the chain, or if the global mental ray gamma
is used, use a value of 1.0, which means "unchanged".
The color is multiplied by the multiplier and
if the texture parameter points to a literal mental ray texture,
the blur parameter can be used to blur it.
This shader is can be used either as an environment shader or a
texture shader, since it looks up based on the direction of the surface
normal. It will map the normal vector direction to a point on the gray
ball and retrieve its color.
The parameters are identical to mip_mirrorball.
Here are the photos used for the example renderings:
Introduction
Mirror Ball
declare shader "mip_mirrorball" (
color texture "texture",
scalar "multiplier" default 1.0,
scalar "degamma" default 1.0,
scalar "blur" default 0.0,
)
apply texture, environment
version 3
end declare
Gray Ball
declare shader "mip_grayball" (
color texture "texture",
scalar "multiplier" default 1.0,
scalar "degamma" default 1.0,
scalar "blur" default 0.0,
)
apply texture, environment
version 3
end declare
Examples
![]() The mirror ball photo | ![]() The gray ball photo |
Here are a few objects with an environment made using mip_mirrorball. The objects are also lit by final gathering based on same environment:
![]() One angle | ![]() Another angle |
What is noteworthy in the above images is how the orientation of reflections stay constant parallel to the camera. Therefore, this shader is only intended to be used when the rendering camera direction (roughly) matches the direction from which the mirror ball was photographed.
When using the gray ball shader:
![]() Raw mip_grayball shader | ![]() Using ambient occlusion |
The left image is the raw output of the mip_grayball shader, but in the right the shader is put into the bright slot of the mib_amb_occlusion shader, where it is occluded and looked up with bent normals2.
More usage tips can be found on page matteuseagetips.