Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mesh vertex colors
#1
Hello,

Can you help me how to get started with adding vertex colors to the generated mesh. I'm familiar how Metadata works, so I guess that would be ideal way to control it. I didn't see any topics related to this question. Thanks!
Reply
#2
Hi
This feature is not implemented. If you need to implement it, here is how I see it can be done:
  1. Add a VertexColors to CGVMesh:
    I imagine something like this:         public Color[] VertexColors;
  2. Modify CGVMesh.ToMesh so tha it sets the vertex colors to the mesh
  3. If you combine/merge meshes, you will need to handle VertexColors in the CGVMesh.MergeVMesh(es) methods.
  4. In BuildVolumeMesh.Refresh, implement your logic that will define the colors for each vertice and assign CGVMesh.VertexColors
Did this help?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
You could use metadata to define where each color should be, but for simplicity sake I prefer defining the vertex colors at the level of the BuildVolumeMesh module. In that module (in the Refresh method), you have access to the input Volume (instance of class CGVolume, assigned to the local variable "vol"). Thanks to it you get the relative distance of each vertex. You can use that to define vertex color by distance for example.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#4
Thanks, this was already a lot of help!

I do need the ControlPoint and Metadata level of accuracy for my needs.
I don't want to create a hacky solution, so can you help me out a bit more how to access the interpolated metadata in the BuildVolumeMesh.Refresh method? I wasn't obvious for me.

Thanks again!
Reply
#5
In that case, here are the broad lines of what you need to do:
  1. Create your meta data class. See CurvyMetadataBase and all the classes beneath it. An example of custom meta data is in E01_HeightMetadata.cs
  2. Update the code InputSplinePath or InputSplineShape so that they read the meta data.
  3. Write its content in a field you will create inside CGShape. Notice the chain of inheritence CGShape -> CGPath -> CGVolume
  4. Process that data in BuildShapeExtrusion. This means reading the data from the classes's input InPath/InCross and writing it into its output OutVolume
  5. In BuildVolumeMesh, read the input volume and do most of what I explained in my previous post

I hope this helped
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
After 5 hours and some trial and error I was able to implement it. It would have taken so much longer without your help. Thanks a lot!
Reply
#7
You are welcome. Glad to know that you were able to customize the modules.

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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 5 10 25 minutes ago
Last Post: _Aka_
  Adjust radius of generated mesh via script? Shackman 1 4 03-26-2024, 01:12 PM
Last Post: _Aka_
  Not seeing mesh extended after following YT PaulM 1 3 02-02-2024, 12:01 PM
Last Post: _Aka_
  Trigger Zones along Spline Mesh dlees9191 1 5 01-05-2024, 10:18 AM
Last Post: _Aka_

Forum Jump: