Hi there !
Does anyone know if there is any way to implement “SelVisible” in grasshopper with Python?
I want to filter the geometries by the visibility (obscured by other geometries or not in a viewport).
I found the RhinoCommon API “Rhino.Display.RhinoVieport.IsVisible(point3d)”.
But it is not a function I want. It works only to detect whether a point is in a view frustum…
I want to distinguish or detect whether an object is hidden(obscred) by other objects in a specific viewport or in an active viewport.
this is literally the slowest and most wrong way to do it (and it’s for R8, but I believe you can just swap a couple of View/Camera related components to make it work on R7)
retrieve camera of a given viewport (in this case Perspective), on the Target plane (which btw is NOT the very same size of the viewport but a bit smaller, so the sampling area is also smaller) build a grid of points, and use those points to create Vectors from Camera in such a way to cast isovist samples on whatever is on the screen and retrieve the index of the geometries that were hit
Inno ! Thank you so much for your reply.
It is a very interesting approach ! It’s not wrong at all, actually I did a similar approach but yours is a more clever one. one thing to be concerned about is that your approach to use “Isovist” limits to filter points.
On the other hand “SelVisible” in Rhino seems faster…and it also filters points.
Anyway, until I find a better way I will refer to your scripts.
Thank you !
Actually In my script I already use “Rhino.Geometry.Ray3d” and “Rhino.Geometry.Intersect.Intersection.Rayshoot” to detect Shadow. Question is I want to make a hatch into shadow so that I need to detect which surface is visible from the Sun.
That is why I am looking for the “SelVisible” similar script.
It’s because my architecture model has thousands of geometries. so I need that kind of script which works fast like a selvisble command…