I’m trying to port a (post process) shader from HLSL to unity, which calls for getting the eye position, and the normalized cross product derivatives of that. Because Unity is deferred, I have to get the eye position from the depth/normal buffer (I assume?), and so I just used the normal buffer and looked at the result of the derivatives.
I know it’s been a year, this is mostly for posterity. A few things in your post jump out at me:
(1) First of all, if you want to do ambient obscurance, or scalable ambient occlusion, Unity has this image effect available to you already. Install the image effects package and look for AmbientObscurance. You can attach this component to your camera.
(2) To answer your question, you don’t need the full “depth/normal buffer” (G-buffer) when using deferred lighting. If you wanted you could set your camera’s depthTextureMode to DepthTextureMode.Depth which would give your shader a pure depth texture instead of the depth/normals one. (Your shader would have to tap _CameraDepthTexture instead of _CameraDepthNormalsTexture). This doesn’t speed up things in deferred lighting but if you have a quality fallback to forward lighting it will prevent an excessive extra rendering pass.
(3) Your code is pretty wild: you are evaluating the derivative of view normals, but only after transforming them by the ModelView matrix. ModelView takes an object from local (model) space to camera (view) space, but your normals are already in view space. So this is like double-dipping.
The Unity Ambient Obscurance image effect is probably exactly what you want, but feel free to PM me if you want to chat.