I have a simple shader that scales a mesh based on a length value, works fine, but if I use Ambient Occlusion in Scalable Ambient Obscurance mode then I get the ambient occlusion applied to the unscaled mesh so I get a ghost of the original mesh and not the scaled one. If I switch to Multi Scale Volumetric Obscurance then it works just fine. Is there a tag or something needed in the shader to make this work correctly or is there an issue in in the Ambient Occlusion image effect. This is with the standard pipeline in Unity 2019.4 with version 3.0.3 of the Post Processing Package.
Screenshots showing the issue.
Original Mesh:
Scalable AO
Multi Scale Vol AO
At what point during the rendering process does your mesh get scaled? That will be the issue here. Can’t comment on exactly when Unity’s SAO does all of its depth-related testing but I would guess that’s happening before your mesh deformation?
It happens in the Vertex Fragment part of the shader.
If it’s happening in the vert/frag of your surface shader then I can only assume your shader doesn’t write correctly to whatever buffers SAO (depth/depthnormals/normal Gbuffer/?) is reading from. Best way to confirm is to open up frame debugger and see what the inputs to SAO look like in its first/second pass.
Its odd that one form of AO works fine the other not, assume they just need a depth buffer.