Shadow and reflection collecting¶
Eddy can be used to collect shadows and reflections from volumes in special AOVs, which can then be used for compositing as needed.
Shadow collecting¶
We start with a plate image and a rendered volume we want to composite over the plate:
![]() The plate image.¶ |
![]() The volume to be composited onto the plate.¶ |
The first step is to add the collector object. Any mesh can be used, here we have added a simple box for the ground. This still has the default ‘Diffuse’ material assigned, so we can check it is receiving shadows as expected.
![]() The ground collector object added to the scene with a ‘Diffuse’ material for testing purposes.¶ |
Next we change the material on the ground to ‘Shadow Collector’. This material is also a holdout so the collector will not appear in the main AOV. We must also tag the ground with a tag ‘collector’. Only objects with this tag will appear in the built-in shadow collector AOVs. We also add the shadow collector AOV itself.
![_images/shadow_collector4.png](_images/shadow_collector4.png)
The ground material is set to ‘Shadow Collector’ and has been given the object tag ‘collector’. The AOV node has been set to use ‘collector_shadows’.¶
Tip
The standard ‘collector_shadows’ AOV will collect all the shadows, both direct shadows from light sources and indirect shadows from secondary reflections. The AOV ‘collector_direct_shadows’ can be used if only direct shadows from light sources are desired.
It is also possible to collect shadows from only a particular light or set of lights. The light tag filter on the AOV can be set to the tag of the lights that are wanted.
Now when we render there will be a shadow channel with the collected shadows. Notice that Eddy calculates the color of the shadows too, this is a subtle effect but is more realistic than shadows which are stored in a single alpha value. In this case the color is due to the color of the environment light, but could also be due to the volume itself if the volume material had colored extinction.
![]() The collected shadows.¶ |
The only remaining step is to composite the shadows over the plate. One simple method is to invert the shadows and then multiply the plate with them.
![]() The shadows merged onto the plate.¶ |
Finally we can merge the volume over the plate with shadows.
![]() The final result.¶ |
Advanced usage
The standard shadow collector AOVs store the shadow as a convenient and easy to use value from 0 to 1, where 0 is unshadowed and 1 is completely in shadow. Alternatively the actual radiance of the shadow can be collected, using the ‘collector_shadow_difference’ AOV. This stores the radiance that was effectively subtracted by the shadow, which is more accurate but harder to use as it depends on the material properties of the collector object.
Any material can be used on the collector object, the only requirement is that a holdout shader is also added. In order for the difference shadows to be accurate, the material should match the real object in the plate (at a minimum, match the diffuse albedo).
Note
See the “eddy_shadow_collector_01.nk” example scene to see this in action.
Reflection collecting¶
![]() The plate image.¶ |
![]() The scene to be composited onto the plate.¶ |
Collecting reflections is similar to collecting shadows. Again we add a mesh object which will be used as the reflection collector. This time however we use the ‘Reflection Collector’ material. This has settings for the surface roughness, allowing for both glossy or specular reflections if the roughness is zero, as well as changing the specular color or disabling the Fresnel calculation.
![_images/reflection_collector5.png](_images/reflection_collector5.png)
The ‘Reflection Collector’ material.¶
Hint
The ‘Reflection Collector’ material can also be used to collect shadows, there is no need to add a separate collector object for each.
Note
Any material with specular or glossy reflection can actually be used on the collector mesh. The ‘Reflection Collector’ material is just a convenient default with the most commonly used options. If a different material is used then remember to add a holdout shader to its shader network.
As before with the shadow collecting, we must add a tag ‘collector’ to our collector mesh. This allows the built-in collector AOVs to select it. We then add a AOV and channel to store the reflections, using the built-in ‘collector_reflections’ type.
![_images/reflection_collector6.png](_images/reflection_collector6.png)
The tag ‘collector’ has been assigned to the collector mesh, and an AOV ‘collector_reflections’ has been added.¶
Rendering now will collect the reflections into their channel.
![]() The collected reflections.¶ |
Finally we can merge the channels for the final result.
![]() The final result, with both reflections and shadows.¶ |
Note
See the “eddy_shadow_and_reflection_collector_01.nk” example scene to see this in action.