Producing layer images from variants (preview)
Forma Render's batch rendering API allows you to produce layer images from Forma variants and supports custom Forma scripts.
Batch rendering identifies which renderer to show and hide by turning selected Forma variants on and off. Make sure each variant you select has a corresponding inverse that changes the visibility of the material under the same feature set. For example, selected and deselected.
You can find default settings and sample scripts in your Samples folder. Sample scripts modify the behavior of the batch render window to output base shots and Forma variant layers.
The product color variant, which you can set up in Forma, determines the base shots. All of the features you select in the batch window are taken away from the color variant. For example, if you have an image of a car without doors, the API outputs the doors as their own image layers in separate files.
Note
The batch rendering API is an experimental feature. You can share feedback with your Unity support contact.
Enabling the sample batch layers API in your project
To enable the sample batch layers API:
- Select Forma Render from your Unity Package Manager.
- Install the sample scripts from Samples.
- Go to Samples > Forma Render > {version} > Sample Scripts > Runtime > BatchRendering.
- Add the
FormaRenderBatchLayersscript to any GameObject in your project. - Specify a valid Unity layer/tag in the
Isolated Output Layerfield of theFormaRenderBatchLayerscomponent. The batch renderer uses this to show or hide mesh renderers while still capturing reflections and shadows. - (Optional) Specify the unique feature set code that the product uses for color variations.
- Click Play.
- Go to the batch rendering window.
- Take a normal shot to serve as the base shot.
- Create a new batch in the batch rendering window.
- Drag and drop the following:
- The base shot into the first column of your new batch.
- The color variation feature set into the second column of your new batch.
- Any features you want to break out into layers.
- Click Render.
Producing layers with a transparent background
To produce layer images with a transparent background, you must:
- Take your base shot in an HDR dome.
- Enable the No Background AOV in the batch profile.
For examples of HDR domes, see PolyHaven.
Producing layers with depth or distance
To produce layer images with depth or distance, you must enable the Distance AOV in the batch profile. The output is a 32-bit floating-point metric EXR file, which you can view using an online EXR viewer.
Producing layers with ambient occlusion and reflections
To produce layers with ambient occlusion and reflections, you must:
- Enable raytracing and HDRP with DirectX12.
- Use the RTAO and RTR volumes.