Corona Distance Shader - C4D
The Corona Distance Shader lets you create "smart" materials that know how far away they are from objects in the scene. Use this to add waves around a coastline, wear-and-tear where objects meet, dirt and noise under window sills, and more.
How does it work?
The Corona Distance Shader applies different colors to a material based on the distance from one object to another. These colors can be then mapped to various material or object properties such as opacity, displacement, or scattering distribution, or can be used as masks, just like any other map.
The Corona Distance Shader can be used with both 2D textures (such as bitmaps or procedural maps on the object surface) and 3D volumes (such as objects using the Corona Volume material).
How is it any different from Corona AO Shader?
There are some major differences:
- Corona Distance Shader cannot be used within a single object.
Corona AO Shader can be used to color different parts of a single object or multiple objects based on their distance from each other (convex or concave areas). The Corona Distance map can only be used based on the distance between two or more different objects.
- Corona AO is raytraced, so it is computed only during the actual rendering.
This means that the Corona AO Shader cannot be used, for example, as a distribution map to scatter instances using a Cloner object, as a displacement map, or as a bump map. Corona Distance can be used in such cases, and it will update in real-time, even in the viewport.
- The quality of the Corona AO Shader will improve progressively during rendering, so it will first appear noisy, and will then gradually become noise-free with each subsequent render pass. CoronaDistance is computed in one go, and will immediately render noise-free.
The Corona Distance Shader is extremely versatile and can be used in various cases, depending on the needs. Here are only a few example ideas, that can be developed further:
Wear and tear on objects which are close to each other:
A Noise map is used to vary the distance scale, producing the "rust" effect. In this case, the Corona Distance Shader is feeding the Opacity channel.
The material tag is stacked over the base material.
The material Rust_A is measuring the distance from the sides of the cylinder that acts as the Distance Object through the Corona Distance Shader. The material Rust_B is measuring the distance from the floor through the Corona Distance Shader.
Foam close to the shore:
A Noise map is used to vary the distance scale, producing the "variation" at the edge of the foam. In this case, the Corona Distance Shader is feeding the Opacity channel.
The material tag is stacked over the base material. The foam material is measuring the distance from the landscape objects that are acting as the Distance Objects through the Corona Distance Shader.
Cutting-out objects with Corona Volume material applied:
In this case, it's a "boolean-like" example; there is an invisible object (Corona Renderer's logo) cutting through the volume. Corona Distance Shader is used in the Absorption slot of the Corona Volume material to define the areas that should be transparent and the ones' that should be solid.
The material tag is applied cloud object, and then, the Corona Distance shader measures the distance between the Corona Render logo and the cloud and uses it to cut out the object.
Using the Distance shader to affect Cloner objects.
Objects and setup:
You can use the Corona Distance Shader to affect the result of a cloner.
The setup of the Distance Shader is pretty straightforward.
Use a Shader Effector to affect the Cloner, then add the Distance Shader using the
Custom Shader channel and modify the effector parameters.
Finally, add the objects to the Distance Shader.