Graphics Programs Reference
In-Depth Information
with the
World
materials, but this is another story). In our scene, the
World
is set to
a bright blue sky color and, with a plane, the underwater objects and the ocean bed
as well would have been lit too much from the sides and from the bottom, thereby
giving an unnatural result. A cube, instead, envelops all the underwater elements,
limiting the lighting to the
Sun
lamp passing through the surface and projecting the
image textured caustics—which is a more natural behavior.
The image texture that we assigned to the water material is to obtain a textured
transparency effect. The water surface now is actually opaque and transparent ac-
cordingly to the black and white values of the textures, so as to allow the
Sun
lamp's
light to pass through and project the caustics.
Thanks to the
Is Camera Ray
output of the
Light Path
node, the caustics image tex-
ture is not directly renderable on the ocean surface but still has an effect on the other
materials. Because
Is Camera Ray
is equal to
1
, the rays starting from the cam-
era and directly hitting the ocean surface can render only the "clean" water material
plugged in the second input socket of the
Mix Shader
node, while the transmitted
caustics (plugged in the first socket equal to 0) get rendered.
Finally, the
Fog_underwater
node group is simply an emitter material colored as the
background (in this case, a deep green) and mapped on every underwater material
accordingly to the Z depth of the camera (but it works also out of camera view). The
"density" of the fog is set by the
Multiply
node's second
Value
; for the ocean body,
a value of
0.030
seems good enough. The camera's Z axis
must not be confused
with the global coordinate's Z axis, which in Blender is the vertical blue line visible
in the 3D view. The camera's Z axis, instead, is the ideal line connecting the starting
point of view to any visible element in the scene.
Note that we didn't expose the values of the nodes in the
Fog_underwater
group.
This is so because we can tweak, in edit mode, the internal values of just one node
to automatically update all the fog group instances assigned to the other materials,
and we know that the values exposed on the group interface would overwrite the in-
ternal settings working only for that single node instance.