How can you force HDRP to initialize a preview scene?

Hello, I have some code for generating custom previews in the editor using a PreviewScene.
My only issue is that I have to call camera.Render() at least once before actually starting to render the previews, in order to force HDRP to initialize the scene. And I have to wait until the next frame before actually rendering. Otherwise the lighting would be inconsistent between previews.

Is there a nicer to initialize scene with HDRP? I’m not afraid of a bit of reflection if that is what it takes.

Thanks!

1 Like

Hey MechaWolf99!

I’m not sure this is exactly what you are looking for, but just wanted to mention that we recently added a new API RenderPipeline.SubmitRenderRequest() usable with both URP and HDRP for 2023.1+ that you could use instead of Camera.Render(). It is safer that Camera.Render() and more powerful as you can use it with an active camera. There is still some cleaning to do on the documentation side, things are still a work in progress on that front, but you can find some explanations here and an example there. Right now, HDRP support is relatively basic and you might want to call it once or twice to stabilize temporal effects (exposure and else…) as we use a separate camera history from the render loop to protect it, but we plan to extend it. Hope this helps a bit.