Apparently your C# writes an image to the desktop? So the path must be changed.
I can’t speak to why MeshRay fails to intersect at times and don’t have Pufferfish (but I innovated around that). I converted the mesh to a brep (took 1.3 minutes!) and tried to use IsoVist Ray instead of MeshRay but it is painfully slow. I’ll let you know if it ever finishes.
I believe the problem lies in a limitation of the MeshRayIntersection method called by the component, as it is prone to fail in some situations (i.e. ray hitting an edge). The picture shows the mesh edges and the failed ray intersections (failed in gray, yellow are successful):
One workaround would be to scale the Mesh just enough to avoid hitting edges but still have a reliable enough mapping (“reliable enough”- and if the workaround is viable at all to start with - depends on your desired accuracy of course).
I took the liberty to replace the Pufferfish component with a chain that extracts the same data (I do not have the plugin installed). Basically you can tweak the scale factor close enough to 1 until the sum of missed hits is zero (I set it to 1.001 to have 0 missed hits). generateimage_from_height_AE.gh (1.1 MB)
Took 1.7 hours for IsoVist Ray to complete Unfortunately, I connected it to your downstream components before flattening its output so must start again. Will report again in two hours.
Well, I must say this was a lot of trouble for a very disappointing result. 250 X 250 pixels, 62,500 points that took 1.7 hours to process (twice!). For this:
The second time, I forgot to set the file path for my machine but managed to internalize the points. This R8 file has my work-arounds (disabled) and the points from IsoVist Ray:
A Top view render for a heightmap is actually a good idea! Even better if you turn on ShowZBuffer. Make a new floating viewport in Top projection and with the same proportions as the mesh (1:1 in this case), turn ShowZBuffer on, Zoom to fit and ViewCaptureToFile with the scale you want (see attached picture)