Capture a Screenshot Through a Camera in the Lightweight Render Pipeline

Hey friends!

I'm working on a project in version 2019.2 using the LWRP, and I'm writing a tool that allows our team to generate heightmaps of levels in editor. My current setup involves switching back to the default renderer and writing out the cameras render texture in OnPostRender(). This functionality doesn't exist in the LWRP, but I'd really like to come up with a way to do it that doesn't involve switching back and forth between render pipelines. I almost found a clever workaround thanks to this post https://answers.unity.com/questions/1545858/onpostrender-is-not-called.html, but this renders out an image of the inspector window for some reason. If I use camera.pixelWidth instead of screen.width when creating the render it still doesn't work.

Any help would be appreciated!

I found a workaround that is satisfactory for my needs. When I run the commands to render a heightmap I first save a reference to the render pipeline asset then remove it to set the rendering back to default. Once the rendering is done it gets set back to the rendering pipeline asset. It's smooth enough and automated so it doesn't really cause a headache.