In this recipe, we will create a material to give the effect of an object immersed in a substance becoming more and more opaque as the depth increases, for example, murky water.
The murky water effect as it appears in the final rendering
Start Blender and open the 9931OS_09_start.blend
file. Then follow these steps:
0.500
.1.17000
. Then press Shift + D to duplicate it, rename it as bed
, and move the Location value of Z to -2.00000
.Let's go ahead and create the different materials:
Suzanne
. In the Material window under the main Properties panel, switch the Diffuse BSDF shader with a Mix Shader node. In the first Shader slot, select a Diffuse BSDF shader node, and in the second Shader slot, select a Glossy BSDF shader node.0.100
. Then set the Fac value of the Mix Shader node to 0.600
.bed
.0.800
, G to 0.659
, and B to 0.264
. Then set the Strength value to 0.100
.water
.0.600
and the IOR to value 1.333
. Then set the Color values for R to 0.185
, G to 0.611
, and B to 0.800
.The murky water material network
The effect happening on the water
material is due to the Ray Length output, which returns the length of the light rays passing through an object, thus giving the thickness of that object. In our case, the distance from the water mesh surface to the far distance (from the Camera point of view, because the light rays originate from the Camera).
The gradient of the ColorRamp is mapped on the length of this Ray Length output (also clamped and inverted by the same ColorRamp node), connected to the Fac input socket of the Mix Shader node in order to work as a stencil map to smoothly blend the amount of the Glass shader with the amount of the Transparent BSDF shader node.
Thus, the transition from the Transparent shader to the Glass shader returns the impression of a volume of water becoming murkier as the distance of the object from the surface increases.