Today I woke up and wanted to try to implement a nice effect with unity: Post Processed Water... The point is that, I never really messed with shaders in Unity, and now I am wondering how i can access a Camera Inverse view matrix. The idea is to render the scene to a frame buffer( as in post process examples) and then apply a shader to this scene, but I need to know the Matrix for the camera that rendered. Any help?
I have absotively no experience with shaders, and Im not even sure what an inverse view matrix would produce, but couldnt you just calculate it yourself? Or have an online matrix calc find the inverse for you? Sorry if im off base here, just trying to chip in
Yes, but calculating a Camera View/InverseView/Frustrum.... Matrix is quite heavy on the CPU, as it involves calculating a 4X4 matrix... Since all those matrices are required for rendering calculations, Unity is surely calculating it ( unless they came out with a revolutionary rendering engine, of course ) and it would be wasted cpu cicles to calculate it again just because I don't know how to access it
The list of all built-in state variables available in shaders is available here: SL-BuiltinStateInPrograms I advise you to also have a look into UnityCG.cginc and AutoLight.cginc. But more importantly - what do you want to achieve?