This isn’t a Rhino question, but I am trying to create a little shell extension to generate a thumbnail and visualize all the STL’s I’ve created in Rhino. 500k is my average triangle count, so it needs to be light and fast. Before I build this thing, I just want to know if it’s a good idea or a stupid idea.
I plan to do a sudo ray trace of the STL with the mesh rotated -30deg on the x and 30deg on the z to provide a good view.
As I read the STL, for each triangle I check the dot product of the facet normal and my orthogonal view normal and if it’s >=0, I know it’s forward facing and to keep it. I save the dot product (4 bytes - later used for shading) and vertex1 (3 x 4bytes = 12bytes). I figure that since I’m translating 500k triangles into 200 pixels, 1 vertex is as good as 3. That drops the number of subsequent operations and the 500k mesh’s memory footprint from 24MB down to 4MB ((4 + 12) x 250k vs 12 x 4byte points x 500k).
Next I’ll do a matrix transformation on all the vertex points to convert them to my desired orthogonal view. Then search to find the XY bounding box and divide that up based on my resolution into pixel boundaries. For each pixel boundary, I grab the dot product of the normals for the point that is nearest to the camera and use that to assign each pixel’s color.
Thoughts?