How would you get the contents of the previous frame in a frag shader. I assume this could be done by either storing data between frames in the shader or by passing the value in through a C# script, but I’m not sure how to do either. Any help would be appreciated. Thanks in advance!
What about the previous frame are you trying to get?
For something “simple” like the surface position, you’d need to cache the previous frame’s object to world matrix (and possibly the world to object matrix) and pass it along to the shader. Unity already does this for generating motion vectors, along with the previous frame’s view project matrix for cameras, but it doesn’t let you send this data to arbitrary shader passes. Then you’d need to do the object to world transform in the vertex shader and pass the data to the fragment shader.
For more complex things, it depends on what kind of data you need. But generally it’s some form of “cache the values you would be sending to the shader, and send them again manually as new material properties to calculate again”, or rendering data to render textures, either screen space or via unique object UVs (ala “object space rendering”), that you cache and sample from.