SOLVED LineObject custom segment colors

Hi guys,
Using C++, R23. I've got an ObjectData plugin that represents a volume in the viewport.
One of the representations is a velocity field, which is just a bunch of lines with colors.
I'm inserting a LineObject in GetVirtualObjects() to do the job, and it is being generated and working as expected, but I'm not sure how to pass my custom colors.
Is there something like the VertexColorTag for a PolygonObject or an alternative routine?

Regards,
Georgi.

Hey @PluginStudent, yeah that's an alternative but I want to avoid overriding Draw() unless there's no other way.

Hi @mastergog,

thank you for reaching out to us. Generally speaking there is no vertex-color-like feature for LineObject or SplineObject. It depends a bit on what you are trying to do (regarding scale of drawing operations) what could be considered to be the "best" solution for your problem.

  1. As proposed by @PluginStudent you can use BaseDraw::DrawLine(). This however can become quite slow when done on a larger scale. What constitutes as large does of course depend on the used hardware, but DrawLine() does not scale very well in general.
  2. Provide a proxy geometry like you do and let Cinema handle that internally.

For option No. 2 you have a few sub-options:

  1. Generate a LineObject for each vector indicator in your field and set the ID_BASEOBJECT_COLOR property of each LineObject. This will perform even worse when done at a large scale than the DrawLine() solution.
  2. Do the same but quanize the colors and group the objects by color. So if you for example want a total of 128 shades, you would generate n <= 128 LineObject each grouping all occurances of a shade. This is probably the most performant solution.
  3. You could also use a Mograph cloner and its coloring feature, cloning and orienting a single LineObject to represent your field.
  4. You could also use a Field and a Field Force to display a vector field, since the latter has that functionality already built in.
    Annotation 2021-02-10 114935.png

As I said in the beginning, there are no direct solutions for your problem (to my knowledge), but hopefully these options can give you an idea on how to proceed.

Cheers,
Ferdinand

@ferdinand thank you for the suggestions, totally forgot to write back.

Grouping the LineObject objects by a few shades worked out pretty well.

Regards,
Georgi.

@ferdinand

Hey I recently noticed that when I get over 2 million points and 1 million segments the viewport freezes. The UI is still responsive so I can reduce the lines in my object and it starts drawing in the viewport again.

So I'm wondering if this is expected for this amount of points and segments? I haven't found anything that is obviously wrong in my implementation yet.

Regards,
Georgi.

Hi @mastergog,

thank you for reaching out to us. I can reproduce your problem and this would have not been something which we would have expected. If you go significantly over one million segments (1.1 million still works for me for example) no matter if in one node or scattered over multiple nodes, the viewport will freeze.

It is a bit hard to assess for us at the moment if this a bug or just a limitation of our viewport API. We will investigate the problem and I will report back here if there are going to be any short or mid-term fixes for that (or not if this is a limitation). For now there is unfortunately nothing you can do, since spreading out the segments over multiple nodes won't help you.

Sorry for the inconvenience and cheers,
Ferdinand