for a creative coding project, I have to create 3d objects that can be rendered with the game engine Stride as traditional meshes. Is there anything like this javascript function: rview/SceneUtilities.js at main · mcneel/rview · GitHub but for C#?
Basically, create vertex (and index) buffer for any geometry in a 3dm file that also rasters all curves and so on… I’ve searched a bit on GitHub but couldn’t find a viewer example as there is for javascript.
The goal is to make a 3dm read/write library for vvvv gamma.
Yes, have something working along those lines at the moment. Good point with Normals.ComputeNormals() and the IsValid checks. I’ll post a link to the GitHub repo as soon as I’ve pushed something.
as you can see, they all sit in the center… I guess there are some instance transformations. but how do I know whether the original mesh is visible or whether only the transformed instances of it should be visible?
At the moment your best way is to use the center of the bounding box for your geometry. Rhino geometry is always in world space. Rhino geometry at this time has no concept of object frame/origin.
Ok next up Is there any way to optimize meshes or reduce polygons? Or re-mesh? At the moment some circular and round forms have extreme vertex counts that aren’t suitable for real-time rendering.
I found MeshingParameters but didn’t find a method to use it with or a way to re-process the existing meshes. Is this even possible?
Not during saving. When you export a polysurface to a mesh format, you will get a dialog to adjust the polygon count as part of the saving procedure. That is not the case when you export a mesh.
Rhino has native QuadrangulateMesh, QuadRemesh, and ReduceMesh commands. Grasshopper also has additional native remeshing components and there are several plug-ins to edit meshes.
-wim
Ok, but then I am a bit confused or I wasn’t able to phrase my question correctly. What exactly controls the mesh resolution that is produced when calling brepFace.GetMesh() in the Rhino3dm library?
I don’t do any coding but I can take a guess - someone will correct me when necessary.
To display a brep in a Rhino viewport, a display mesh is created and attached to the brep. There are controls in Rhino to make that mesh less or more detailed. This mesh is saved in the 3dm file and can be extracted without running Rhino. If display meshes are cleared in the Rhino file (with the ClearAllMeshes command or if all modeling has been done in wireframe mode), you won’t be able to extract a mesh from a brep in a 3dm file.
-wim
@tebjan
Just curious if you’ve had any success or updates regarding pushing 3dm Objs to VVVV and back. I am also curious how you set up your patch and corresponding Nugets.
Yes, it works pretty well, with some limitations. You cannot generate triangle mesh data with openNURBS, the display meshes have to be generated in Rhino. But you can procedurally generate rhino 3dm files.
@tebjan
Incredible! Excited to see development expanding VVVV with Rhino. I’ve been curious about VVVV being a platform to synthesize projects like Rhino.Inside. I feel it allows cross pollination of API’s elegantly. I hope to see more development in the future!