C# Grasshopper: How to Get a Pixel of a Rhino Viewport without using RhinoView.CapturetoBitmap

I am using a GH script to create a custom raycast tool that will allow me to dynamically control the vector direction of each pixel in projected into the scene. I am using Rhino and GH to set a camera at each point in my array, facing the direction I specify. I am then populating the output pixel array with the color values from the centric ray of each camera. This allows me to piggy back on Rhino’s view display algorithms, rather than create a custom raycast tool in another platform.

As a concept, this method is working. My problem is that in order to extract color information from each RhinoView I instantiate (ie. a 200x100 array will instantiate 20,000 views), I have to make a Bitmap. This slows the process down exponentially (perhaps 2 orders of magnitude). This is the only way I can think to extract some color information from the RhinoView or the RhinoViewport, even if I am only interested in 1-10 pixels from each view.

3

Can anyone think of a different way to extract color information from a RhinoView or RhinoVIewport that does not require the cumbersome process of creating a Bitmap capture?

CustomLens_McNeelForum.gh (25.5 KB)

Thanks!

Alexander