Visualization of 3D objects

Dear all!

I just started working with 3D objects in ROOT and I could use an advice on how to approach the task at hand. In my ROOT-based GUI app I want to draw model of a 4pi detector made out of irregular pentagonal segments and using color palette display some properties (count rates, total energy deposition etc.). Basically what I need is a custom shaped bins of TH3 which I doubt is possible to achieve. I also checked the possibility of creating a set of 3D objects and display them in a 3D viewer. However, when drawing on pad I was so far unable to set the fill color, it seems that only wireframe option is possible; and while TGLViewer is perfect for the task I am not sure if it is possible to integrated it to TGFrame of my app since it is not based on ROOT GUI.

The only possible solution that I can think of is to use a TH3 histogram and create group of bins that would represent singe segment and fill them together. This is however not an elegant solution and I am hoping you may have some advice on how to proceed.

Thank you for your time!

See ROOT: TGLEmbeddedViewer Class Reference

1 Like

As always, thank you @bellenot :slight_smile:

1 Like

One more thing @bellenot, I would like to see the same color of my model regardless on the camera angle in my openGL viewer. Is there a way to achieve this?


Not sure… Maybe @matevz knows better

What do you mean? You want to get rid of the whitish specular reflection when a surface faces the camera?

Or you can, apparently, also reduce the power of different kinds of lights.

Thanks for the tip @matevz, I already tried switching the specular light off but it didn’t completely different shades of the same color in the model. I would like to display object color regardless of light source position. I want color of an object to represent some physical quantity in the same way as the TH2 does for “col” option, so the shade is important here.
I was hoping it could be solved by either changing reflectiveness of the object itself or by changing the light source to be come “from everywhere”.

Here is the test code I currently have, you can run it by .x vistutest.cxx
visutest.cxx (20.9 KB)

I see … you would have to disable lighting for rendering of that object and there is no per object flag / render pipeline support to do that.

There is however, support for generating custom rendering classes based on TSomeClass → TSomeClassGL paradigm – though this does not quite work for TGeo classes as they are exported via a TBuffer3D object that contains vertices, segments – and there is no additional bits/flags passed along. Sigh.

Now, we could cook up something, preferably through TEve … but I’m rather fully booked for quite some time. Questions:

  1. Do you need this to run for long time and be supported in standard ROOT / to be used by many people?
  2. Will there be other things you will want to add to the scene?
  3. What is the timeline for the project? We are getting close to having web-based EVE (REve) ready for primetime. Would this interest you? You can look at my talk from the ROOT workshop in May.
1 Like

Thank you for your time. To explain, this a new visual module for a spy program I developed. Its purpose is to listen to an online data stream during the experiment, performing minimal analysis and visualizing as much events as it possibly can. There is a server part that does the heavy lifting, and the client to do the visualization. To your questions:

  1. Vanila ROOT only, preferably 6.16 (it is not easy to convince people to upgrade). Used by many people, uf, I hope so! :slight_smile:
  2. Not really, only an arrow marking a beam direction and possibly a visual color palette, but the latter one might be an overkill to do, having to change the numbers and having it in fixed position on the screen seems to much effort for little gain
  3. Well, the experiment starts this Thursday :upside_down_face:. REve surely looks amazing (great job btw!), but for this specific application it is an overkill.

Anyway, thank you so much guys! I will use what I have now albeit is not perfect, it is still pretty cool.

If you don’t mind me asking, what is the performance situation of the web-based visualization? I was considering going with JSROOT with this spy, but as I was playing with it I got discouraged as it was not able to display large matrices (2k x 2k, 4k x 4k) in timely manner. However, I was just playing with it so I might have shot myself in a foot few times, hence the slow performance.

I don’t know … perhaps you were hitting another bottleneck. Unless you are going for a high refresh rate I don’t think web latency is a big problem. Next time ping @linev and he can help you explore where things are slowing down and potentially improve them.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.