Capture viewport as image in cache

To capture Raytraced viewport you have to give the amount of passes you want.

You have to set up a https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Display_ViewCapture.htm , set its https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_Display_ViewCapture_RealtimeRenderPasses.htm and pass the view you want to capture to https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Display_ViewCapture_CaptureToBitmap.htm on the ViewCapture instance.

A more elaborate example in using the ViewCapture class:

Fun fact: very, very long ago I had a Cycles component for the GH canvas (no longer available)