I’m rendering some world-space UI in a CustomPass with After Post Process injection point, it works but the objects keep jittering due to TAA being enabled. How to render objects without this jitter (but keep TAA on) ?
Would love to know the answer to this, if there is one.
We use HDRP UI camera stacking to get rid of a bunch of issues…
But, world space UI will jitter like crazy if you use DLSS, FSR or TAA, etc.
I found a way to do this, but its ugly…
First, duplicate your main camera and disable it. Something like this:
// Duplicate main camera for World UI custom pass
var uiCameraObject = new GameObject("UI Camera");
uiCameraObject.transform.SetParent(transform);
uiCameraObject.transform.SetLocalPositionAndRotation(float3.zero, quaternion.identity);
var uiCamera = uiCameraObject.AddComponent<Camera>();
uiCamera.enabled = false; // not rendering, just using it get its matrices.
uiCamera.CopyFrom(camera); // Copy camera parameters
_worldUIPass.UICamera = uiCamera; // Assign to custompass
Then use CustomPassUtils.RenderFromCamera to render your World UI, like so:
// Render to RT from UICamera
CoreUtils.SetRenderTarget(ctx.cmd, RT, RT, ClearFlag.Color);
CustomPassUtils.RenderFromCamera(ctx, UICamera, layerMask, renderQueueFilter: renderQueueType);
RTHandles.SetReferenceSize(RT.width, RT.height); // This is needed to make dynamic scaling work properly in AfterPostProcess injection point.
// Render back to cameraColorBuffer
CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraColorBuffer);
_material.SetTexture(MainTexturePropID, RT);
CoreUtils.DrawFullScreen(ctx.cmd, _material);
I’m rendering to an RT first because I’m using MSAA for world UI.
Would still prefer a more documented way to do this though…