#SSAO with Render Objects that modifies Camera

1 messages · Page 1 of 1 (latest)

wispy siren
#

I'm looking into an FPS camera solution that does the following:

  • Does not rely on camera stacking :tick:
  • Preserves shadows :tick:
  • Looks good with AO ❌

When using AO with Render Objects, anything that's being rendered "differently" always appears underneath the ambient occlusion. I've been looking for fixes for this for a while and have no idea how to solve it.

#

The best I can do with this, is to set opaques to render before pre-passes, which just makes the ao not visible through the gun, which unfortunately still means the gun looks flat

heady olive
#

If you can update to Unity 6.2+ there's a new "Prepass Layer Mask" on the Universal Renderer Asset, which should let you keep the object rendering into prepasses (i.e. camera depth and normal textures) used by the SSAO

#

Though that likely only works if the RenderObjects isn't using any depth/camera overrides -
If you need that, probably need a custom renderer feature to replicate the RenderObjects but into the camera depth/normals textures - which can be accessed through the UniversalResourceData

wispy siren
#

I'm using that right now, actually, and I can confirm that it doesn't work

#

The prepass layer mask DOES allow me to filter out/add back in the AO, but it doesn't follow the reprojection from the camera

#

I appreciate the pointer towards the resource data. Do you know any resources that might help point me towards a solution?

heady olive
#

I also have an Custom Renderer Features tutorial/article, though it was aimed at 2022 versions. It was partially updated with some Unity6/RenderGraph snippets though so might help.
Mostly this part but swap out the textures used by SetRenderAttachment, adjust overrides further in InitRendererLists & camera projection overrides in ExecuteDrawPass

wispy siren
#

thank you SO much. Rendering is... not my forte, so I do super appreciate all this

#

I think i've found where it does the camera stuff

#

line 148 onwards

#

This is going waaay over my head lmao

#

super appreciate the resources too

oak ledge
# wispy siren I'm looking into an FPS camera solution that does the following: * Does not rely...

An alternative method is to shrink or squash (and optionally move) the first person mesh relative to camera
(1) (2)
It sidesteps rendering order and shadow clipping issues entirely as the meshes are not rendered separately
Downside is that shadows from the world are not precise, and because clipping is not impossible you may need an additional method for obstacle avoidance (as shown in action in the second video)

wispy siren
#

indeed, tis exactly what I am doing now. Clipping is mostly avoided because the model is much smaller, but I may need to see if its possible to calculate shadows on those objects based on the "original" scale

oak ledge
#

I looked into it a bit and it seemed possible but quite complex