I want to implement a heightmap-based water simulation algorithm in Unity. I know exactly how I would approach this in pure low-level C++ and OpenGL (and also Shadertoy), and most of it is straightforward to port to Unity.
The algorithm needs terrain height information with a heightmap. I'd like it to be flexible, so I don't want to force the user to use a terrain heightmap that has to exactly fit the area where the water is supposed to go. Instead, I'd like the user to model terrain and other static geometry in any way they want and then be able to hit a button to directly bake that geometry to a heightmap by rendering the current editor scene to a texture that is then saved as a game asset. The ortographic volume for this would be specified on the prefab that I'd create for the water simulation.
So, in short, my question is: How can I trigger a render to texture of the current scene at editor time (and save this as an asset)? And, if possible, can I specify to render only objects with a given Tag (to avoid dynamic objects in the bake)?