generative modeling for Rhino
How do I use Preview or Material to show a mesh with flat shading? I saw one other question, but the answer wasn't helpful, or I couldn't figure it out.
Is it just a slow day on the forum or is this not possible?
I don't think that's possible.
I just figured it out. I Decomposed the mesh, then created a new mesh using the vertices and faces, but graphed the faces input. It displays as a flat shaded object in Rhino.
Oh dear, that means you get an individual mesh for every face in the original mesh. Unwelding would be a better approach, though there is no unweld function available in the Rhino4 SDK.
Well, fortunately this is for a very course mesh.. a heavily faceted surface that I wanted to be able to visualize as faceted without having to bake each time.
You can try using the following code to sort of "unweld" a mesh. Just paste the code inside a vb.net component and connect the mesh to the x input.
Dim m As New mesh
Dim c As Integer = 0
For i As Integer = 0 To x.faces.count - 1
Dim pts(2) As point3f
Dim ptd As New point3f
x.Faces.GetFaceVertices(i, pts(0), pts(1), pts(2), ptd)
If x.Faces(i).IsTriangle Then
m.Faces.AddFace(c, c + 1, c + 2)
c += 3
m.Faces.AddFace(c, c + 1, c + 2, c + 3)
c += 4
a = m
That works well, thanks for the code.