In Unreal Engine 5, to render only the fur/hair groom to a separate render pass with appropriate shadows and lighting, you'll need to set up a custom render pass that isolates the groom while ensuring it still interacts with the scene's lighting and shadowing systems. Here's a step-by-step guide to achieve this using the Composure compositing plugin, which is designed for advanced rendering workflows like this:
1. Enable the Composure Plugin
First, make sure the Composure plugin is enabled in your project:
- Go to Edit > Plugins.
- In the Search box, type Composure.
- Enable the Composure plugin.
- Restart the editor if prompted.
2. Set Up Composure Compositing Elements
Composure allows you to create layers (compositing elements) that can be rendered separately and then combined. You'll create a layer for the hair groom and one for the rest of the scene.
Create a Compositing Element for the Hair Groom:
- Right-click in the Content Browser, and go to Composure > Compositing > CG Layer Element. Name it something like
HairGroomLayer.
- Open the
HairGroomLayer asset.
- In the Details panel, under Transform Passes, you can configure the rendering settings.
Specify the Hair Groom Components:
- In the
HairGroomLayer, look for the Include Actors or Include Components section.
- Add your hair groom actor or component to this list. This ensures only the hair groom is rendered in this compositing element.
3. Configure Visibility and Lighting Interaction
To ensure the hair groom receives shadows and lighting from the rest of the scene without rendering the other objects in the hair groom pass, you'll need to adjust the visibility settings of other actors:
For Other Scene Objects:
- Select the actors that you don't want to appear in the hair groom render pass but still want them to affect lighting and shadows.
- In the Details panel, uncheck Render in Main Pass (found under Rendering > Advanced). This makes them invisible in the render pass but still present for lighting calculations.
- Ensure that Visible in Ray Tracing and Visible in Reflection Captures are checked if you're using ray tracing features.
For Lights and Shadow Casters:
- Make sure all light sources and shadow-casting objects are included in the scene as usual so that the hair groom receives proper lighting and shadows.
4. Repeat for the Background Layer
Create another compositing element for the rest of the scene (excluding the hair groom):
- Right-click in the Content Browser, and create another CG Layer Element named
BackgroundLayer.
- In
BackgroundLayer, include all actors except the hair groom.
- Ensure that the hair groom does not appear in this layer by excluding it.
5. Create a Composure Composite
Now, create a composite that combines these layers:
- Right-click in the Content Browser, go to Composure > Compositing > Composite, and name it
FinalComposite.
- Open
FinalComposite and add both HairGroomLayer and BackgroundLayer as inputs.
- Arrange the layers so that the hair groom is composited over the background.
6. Set Up the Composure Output
- In the
FinalComposite, configure the output settings to match your project’s resolution and format.
- You can specify whether to output to a render target or directly to a file sequence.
7. Render with the Movie Render Queue
Use the Movie Render Queue to render your composure setup:
- Open the Movie Render Queue from Windows > Cinematics.
- Add a new render job and select your
FinalComposite level sequence (if you have one set up) or the current level.
- In the render settings, ensure that you're rendering the composure composite.
- Configure the output settings (resolution, frame range, etc.).
8. Verify and Adjust
- Perform a test render to verify that the hair groom is correctly isolated and that it still receives shadows and lighting from the rest of the scene.
- If adjustments are needed, tweak the visibility and rendering settings of the actors or the compositing elements.
Alternative Method: Using Custom Depth and Stencil Layers
If you prefer not to use Composure or need a simpler setup, you can use custom depth and stencil layers to mask the hair groom. However, note that the Groom system might not support custom depth out of the box, so this method may require additional setup or might not capture all the lighting interactions.
Important Tips:
- Lighting Consistency: Ensure that the lighting settings are consistent across all layers to prevent mismatches in the composite.
- Performance Considerations: Composure can impact performance since it involves additional rendering passes.
- Post-Processing Effects: Be mindful of post-processing effects that might affect the final composite differently in each layer.
Summary
By using Composure to create separate compositing elements for the hair groom and the rest of the scene, you can render the hair groom to a separate pass while still retaining the full lighting and shadow interactions from the scene. This method provides flexibility and high-quality results suitable for advanced rendering workflows.