LineObject custom segment colors
-
Hi guys,
Using C++, R23. I've got anObjectData
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 aLineObject
inGetVirtualObjects()
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 theVertexColorTag
for aPolygonObject
or an alternative routine?Regards,
Georgi. -
alternative: don't use LineObject. Draw a bunch of colorful lines in Draw()
https://developers.maxon.net/docs/cpp/2023_2/page_manual_draw.html
https://developers.maxon.net/docs/cpp/2023_2/page_manual_basedraw.html -
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
orSplineObject
. 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.- 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, butDrawLine()
does not scale very well in general. - Provide a proxy geometry like you do and let Cinema handle that internally.
For option No. 2 you have a few sub-options:
- Generate a
LineObject
for each vector indicator in your field and set theID_BASEOBJECT_COLOR
property of eachLineObject
. This will perform even worse when done at a large scale than theDrawLine()
solution. - 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. - You could also use a Mograph cloner and its coloring feature, cloning and orienting a single
LineObject
to represent your field. - You could also use a Field and a Field Force to display a vector field, since the latter has that functionality already built in.
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 - As proposed by @PluginStudent you can use
-
@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. -
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