Posts: 10
Threads: 2
Joined: Jun 2013
09-19-2020, 01:03 PM
(This post was last modified: 09-19-2020, 04:01 PM by Krypton.)
Dear Curvy support,
Using curvy in a production visualization project that requires rendering meshes as lines. Is there a way to get a struct of horizontal and vertical lines that make up the generated mesh?
Cheers
Posts: 2,118
Threads: 93
Joined: Jun 2017
Hi,
When generating meshes, Curvy Splines produces instances of
Mesh. Using Unity's API, you can get the list of vertices and triangles of that mesh. From that, you can produce the list of lines making your mesh. Via dot product (or other means), you can deduce what lines are horizontal or vertical.
I hope this helped. If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 10
Threads: 2
Joined: Jun 2013
(09-19-2020, 04:59 PM)_Aka_ Wrote: Hi,
When generating meshes, Curvy Splines produces instances of Mesh. Using Unity's API, you can get the list of vertices and triangles of that mesh. From that, you can produce the list of lines making your mesh. Via dot product (or other means), you can deduce what lines are horizontal or vertical.
I hope this helped. If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Are you creating the mesh with your own code or with unity?
Posts: 2,118
Threads: 93
Joined: Jun 2017
Curvy Splines uses Unity's API to create meshes. That way the produced meshes are compatible with all existing code and tools made for Unity's meshes.
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 2,118
Threads: 93
Joined: Jun 2017
(09-19-2020, 05:03 PM)Krypton Wrote: Are you creating the mesh with your own code or with unity?
So in other words: with both my code and Unity
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 10
Threads: 2
Joined: Jun 2013
Great, can you show where I can extract this information directly from your code because we don't want generate the entire mesh with UV and triangles. Just the edges.
Posts: 2,118
Threads: 93
Joined: Jun 2017
When generating a mesh through shape extrusion in the Curvy Generator, and if you don't want to work with the Unity mesh the Create Mesh module creates, you can get the relevant data from the Volume Mesh module. It has an output called V Mesh, an instance of the CGVMesh class. In it you can find the list of vertices and triangles.
The relevant work happens in BuildVolumeMesh.Refresh().
Each CG module has a On Before Refresh and an On Refresh events.
You can create your own custom CG module if needed: https://curvyeditor.com/documentation/extend/start#extending_curvy_generator
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 10
Threads: 2
Joined: Jun 2013
Can you suggest how to get the Horizontal and Vertical data from the Volume Mesh module.
I needed to integrate another asset called Procedural primitive with Linefy and he helped with getting the structs for Horizontal and Vertical edges.
Would you be able to give pointers of how this can be done also with Curvy's mesh generation code.
Thanks in advance.
Will also leave an awesome review for your help.
Posts: 2,118
Threads: 93
Joined: Jun 2017
Same as here:
(09-19-2020, 04:59 PM)_Aka_ Wrote: Using Unity's API, you can get the list of vertices and triangles of that mesh. From that, you can produce the list of lines making your mesh. Via dot product (or other means), you can deduce what lines are horizontal or vertical.
To get vertices : CGVMesh.Vertex.To get triangles CGVMesh.SubMeshes.Triangles
Examples of "other means": check the value of Vector3.Angle(Vector3.up, yourVector)
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 10
Threads: 2
Joined: Jun 2013
"Extending the Curvy Generator is the most sophisticated way to extend Curvy, but the most fun part, too! Though not rocket science, you'll need a good understanding of the Generator internals to successfully write quality modules."
Do you have more detailed documentation of how the Generators internals work?