I am trying to find out if there is a way to calculate the percentage of the surface area of an object composed of multiple elements (some internal and some external) that is hit by light in a spherical environment. Imagine a sphere representing the sky, with my object positioned at the center of this sphere. The spherical environment implies that light comes from all directions
As a practical example, I have a model where the total surface area of the object’s faces is about 96.9 m², and the area exposed to light is about 61.6 m². I would like to calculate the percentage of the surface that is illuminated relative to the object’s total surface area.
Is there a method or a command in Rhino (or a plug-in) that allows for this type of calculation? Additionally, it would be helpful to know if there’s a way to visualize or analyze this information directly within the software.
don’t know how much this is reliable, it’s just a conceptual dirty sketch, and it’s the first and only thing that came to my mind
it -might- work (if it works at all?) just in the particular cases where all the edges are straightlines, all the faces are planar… and stuff like that
[it also requires Anemone for looping the cutting that shatters the main Brep faces into tiny bits]
Thanks @inno This is something that I like, especially the color feedback, but in a spherical environment the top and the bottom part of the brep should be illuminated.
Also the illuminated area is very close to the real result. probably adding the 4 purple area highlighted in the screen below you will reach the right result. I think you have to dig a little bit more on the spherical light.
For a given object … if is Brep then a “segmentation” is required (meaning : divide - in U/V - the BrepFaces). If is Mesh then either use it (like in the example shown) or subdivide it. Or convert the Brep into a Mesh (appears “smart” and fast, but … there’s hidden challenges around: for instance imagine a Box united with a Sphere where for the planar BrepFaces the convertion yields many planar pieces where - MAYBE - you don’t need’m).
For the “environment” … if is a portion of a sphere then (see below) a pre-check is required (see 4). Obviously you can use a Blob (or more) as well instead of the Sphere.
A Class where suitable Properties related with the final goal is required. Properties should been used for tracking the “parent” of any piece as well.
For each “piece” (MeshFace or BrepFace as in 1) get the Normal, define a Ray3d and then check if there’s ccx Events against the rest of “pieces” (or the donor object as a whole) while a pre check is maybe (see 2) required related with the portion of the spherical environment. So the questions are: does some piece obscure some other? If not does the Ray hit the desired portion of the sphere? Store results in a List (see 3).
Given the results mastermind some representation policy (say as the one exposed above - using Mesh Vertices “gradient” Colors).
PS: Don’t try all these without code (mid to advanced Level) for a vast variety of reasons. In any case see SDK for the Ray3d VS Breps/Meshes Ccx Events (maybe a by-pass using LineCurves is required depending on the Topology of the donor object - notably if the BrepFaces have Inner Loops).
Update: did some tests: since speed is the paramount factor … Reset > do Plan B:
Convert Brep to Mesh (there’s options in the SDK Method exposed).
Spread “evenly” points on your environment object (i.e. the sphere or a portion [as Brep]). Done properly that’s fast: say for 10K points you’ll need a few milliseconds (The classic GH Method is not recommended for this).
Create a score array (of Mesh.Vertices.Count size) of type double.
From each point shoot (“inwards”) a Ray3d. Then use the
Intersection.MeshRay (Mesh, Ray3d) Method. This is the fastest way to cut the musterd (remember: there’s lots of points around - even 20-50K).
Get the first hit point (if exists) and then get the prox Mesh Vertex.
Compute the angle (Vertex Normal, -Ray).
Update the array (see 3) using some appropriate logic (for instance if angle == 0 then ilum is max … etc etc). Use, say, a classic Gauss/Falloff for computing max to min medium values. You can invite the distance to the party as well.
With the score array on hand, use some approach like the one shown in the mp4 above for coloring the Mesh Vertices.