I’m trying to do an outline render feature in URP with SPI. I’ve set up a custom pass rendering to a buffer and have everything working with Multi Pass, but Single Pass Instanced completely confuses me.
I’m rendering specific layer with overrideMaterial which is unlit white. Works well when I render to camera target, one sphere is rendered to both eyes once, as it should be.
But if I configure a render target and check in frame debugger, my sphere is duplicated with a small offset.
class CustomRenderPass : ScriptableRenderPass
{
private RenderTargetHandle _destination;
private List<ShaderTagId> _shaderTagIdList = new List<ShaderTagId>() { new ShaderTagId("UniversalForward") };
private FilteringSettings _filteringSettings;
private RenderStateBlock _renderStateBlock;
private Material _overrideMaterial;
public CustomRenderPass(RenderTargetHandle destination, int layerMask, Material overrideMaterial)
{
_destination = destination;
_filteringSettings = new FilteringSettings(RenderQueueRange.opaque, layerMask);
_renderStateBlock = new RenderStateBlock(RenderStateMask.Nothing);
_overrideMaterial = overrideMaterial;
}
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
{
cmd.GetTemporaryRT(_destination.id, cameraTextureDescriptor);
//ConfigureTarget(_destination.Identifier());
ConfigureClear(ClearFlag.All, Color.clear);
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
SortingCriteria sortingCriteria = renderingData.cameraData.defaultOpaqueSortFlags;
DrawingSettings drawingSettings = CreateDrawingSettings(_shaderTagIdList, ref renderingData, sortingCriteria);
drawingSettings.overrideMaterial = _overrideMaterial;
context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref _filteringSettings, ref _renderStateBlock);
}
}
If I then perform full screen blit like in this guide, I get two spheres in both eyes.
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/manual/renderer-features/how-to-fullscreen-blit-in-xr-spi.html
Can you help me understand what I’m doing wrong here?