1 / 25

The Object Model to Construct the Mixed “Open Inventor” / ROOT 3D scenes

The Object Model to Construct the Mixed “Open Inventor” / ROOT 3D scenes. by Valeri Fine, Jerome Lauret STAR Brookhaven National Laboratory. Introduction. The talk presents the ongoing effort to create the powerful 3D visualization tool for STAR collaboration.

orpah
Download Presentation

The Object Model to Construct the Mixed “Open Inventor” / ROOT 3D scenes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Object Model to Construct the Mixed “Open Inventor” / ROOT 3D scenes by Valeri Fine, Jerome Lauret STAR Brookhaven National Laboratory

  2. Introduction The talk presents the ongoing effort to create the powerful 3D visualization tool for STAR collaboration. The man-power constrains have lead us to an introduction of the OO model and its implementation, allowing for the creation of OO definitions of complex 3D scenes based on Open Inventor and ROOT 3D object models simultaneously. Such approach allows us to create the unified visualization layer to fulfill the different, sometimes contradicting, requirements for Detector Simulation, Event Reconstruction and Online Monitoring that could not be otherwise satisfied with existing packages. Acat 2007 Workshop, NIKNEF

  3. Visualization tasks: Even so the various visualization tasks in HENP look very similar, from the implementation stand point one still should distinguish: • Online monitoring – Real time • Detector simulation– Full-fledged geometry ( hierarchy ) navigation, Selection. Comparison of the different versions. • Event reconstruction– Event representation. Event (flat or simple hierarchy) Navigation and Selection on the top of the simplified detector geometry.. Why? Acat 2007 Workshop, NIKNEF

  4. 3D “visual” attributes: one size fits all? Transparency: One and the same object (detector component) can be seen as • transparent for the simulation, • solid for the reconstruction and • invisible for the online monitoring. Does “invisible” == “100 % transparent”? Shape: Calorimeter tower shape: • Simulation – hardwired with the detector (GEANT) description • Online line monitoring – the size and color are required to reflect the energy deposit. The questions are experiment specific. Neither ROOT nor OpenGL nor any other “generic” software tool can address it alone. Acat 2007 Workshop, NIKNEF

  5. Abstraction layers To satisfy the different requirements mentioned above several abstraction layers are needed to be designed and implemented • Do not reinvent the wheel – use the proven ROOT design (re-use our Qt-layer approach ;-) . • Re-use STAR framework components • Made it useful for ROOT community also ROOT plug-in does allow allow to do this. Acat 2007 Workshop, NIKNEF

  6. ROOT + Qt + Coin3D • The Coin3D-based (Coin3D is an “Open Source” implementation of the “Open Inventor” API) plug-in of the ROOT TVirtualViewer3d interface opened the possibility for STAR to use the existent OpenGL hardware within the STAR ROOT-based frameworks. • It provided us the capabilities briefly mentioned on a few slides below those makes us free to think about our own applications rather about the technical details of the 3D object rendering. Acat 2007 Workshop, NIKNEF

  7. Coin3D implementation of ROOT 3D viewer interface controller view model TVirtualViewer3D (ROOT > 4.01) QWidget TObject ROOT plug-in ROOT plug-in TQtRootViewer3D TPad GL list TQtGLViewer TQtCoinWidget Coin Node SoQtFullViewer TQtCoinViewer signals: void ObjectSelected(TObject *, const QPoint&); void HandleSelected(ULong_t, const QPoint&); void ImageSaved(QString &fileName, . . . ); SoNode Acat 2007 Workshop, NIKNEF

  8. Coin3D implementation.Input /Output 3D geometry formats Input 3D geometry formats: • Zebra - *.fz • ROOT Macro - *.C • ROOT file - *.root • "Open Inventor" - *.iv, • VRML - *.wrl, The output formats: • All common pixmap formats - *.gif,png,jpg,tiff … • Postscript and Encapsulated PostScript – *.ps, eps • VRML - *.wrl, • "iv" - "Open Inventor2" - *.iv • mpeg (movie) to create the primitive movie - *.mpeg Acat 2007 Workshop, NIKNEF

  9. Coin3D implementation.API 1. ROOT API. The browser uses the standard ROOT plug-in mechanism. This means to use it from within ROOT env to render the ROOT 3D class objects no special API is required. The TObject::Draw method will be served with the proper plug-in selected via ROOT resource file. 2. Open Inventor API: To control things programmatically and to render the non-ROOT class objects one can use “Open Inventor” API See: " http://doc.coin3d.org/Coin/classes.html for details The ROOT and non-ROOT objects (including Coin3D animated objects) can be mixed within one 3D scene. 3. Qt API. Thanks QtRoot and SoQt Coin3D-based widget classes do provide the Qt signal / slot API. This allows using it to create the custom Qt-based GUI, for example for the "Control Room" and to create the animated interactive computer models of the STAR detector useful for students, teaching and public presentations. The widget emits the Qt signal as soon as the user "picks" some object. The signal provides a C++ pointer to the original ROOT object. Acat 2007 Workshop, NIKNEF

  10. Coin3D implementation.The Default Selection Slot • To select object one hasto • Turn the Coin viewer “selection” tool on • Use the left mouse button to point the image on the 3D view • The browser should: • Highlight the selected shape • Popup the label with the text provided by the selected object TObject::Info method • Find the object in the left tree pane of the Geometry Browser and select the found object there • The object selected in the “tree” list should be painted in the right upper TCanvas widget 1 2 5 4 3 Acat 2007 Workshop, NIKNEF

  11. Coin3D implementationThe “Menu” Selection Slot The Browser provides another “selection” slot. The SLOT is activated via the drop-down “Options” menu. To select the object user should follow the previous slide. The only difference, instead of the label the browser will pop the ROOT “Context menu” Acat 2007 Workshop, NIKNEF

  12. Coin3D implementation.The Custom Selection The STAR Geometry Browser provides the custom selection slot in addition to the two built-in slots described above The SLOT is activated via the icon. To select the object user should follow the previous slides. The only difference, in addition to the built-in action, the application is to popup the text edit window with the source code of the selected volume highlighted. Acat 2007 Workshop, NIKNEF

  13. Coin3D implementationMultiply 3D widgets / attributes The Qt-based ROOT 3D plug-ins do allow creating as many OpenGL widgets as your local video hardware can sustain and set the video attributes for each widget separately as the short animation on the right demonstrates: Acat 2007 Workshop, NIKNEF

  14. Approaches: • Change neither ROOT 3D object model no 3D virtual viewer model, change the “attributes visual implementation” • Do not change ROOT object model, mix the ROOT and Coin object at the rendering time • Enhance the ROOT object model to provide the new attributes to be treated by the dedicated viewer (but preserve the backward / forward compatibility) Acat 2007 Workshop, NIKNEF

  15. ROOT transparency attribute implementation. Does “invisible” == “100 % transparent”? There are several ways to see the transparency attributes for ROOT object. • Full 100 % transparent object – wired and “unpickable” image • 99% transparent object – wired and “pickable” image • > 99% - translucent solid image. • Invisible – “invisible” means no image at all. Acat 2007 Workshop, NIKNEF

  16. ROOT shapes.C example: trap->SetLineColor(4); trap->SetFillStyle(4001); tube->SetLineColor(6); tube->SetFillStyle(4000); Acat 2007 Workshop, NIKNEF

  17. STAR “Online Monitor” example: ROOT I/O - ok trap->SetLineColor(4); trap->SetFillStyle(4001); tpc->SetLineColor(kRed); tpc->SetFillStyle(4000); Acat 2007 Workshop, NIKNEF

  18. “Rendering”-time mixture Mix the ROOT and Coin3D objects at the rendering time within Coin3d viewer “the decoration” is kept apart of the detector geometry with “iv” format Useful to decorate the original ROOT object with the scene-wide effects Acat 2007 Workshop, NIKNEF

  19. Mixed OIV / ROOT model: replica1.iv: #Inventor V2.1 ascii Rotor { rotation 0 1 0 0.1 speed 0.1 on TRUE } rootgeom.c: TGeoTranslation *replica1 =new TGeoTranslation(-150, -150, 0); TGeoTranslationC *replica1 =new TGeoTranslationC(-150, -150, 0); replica1->SetFileName("replica1.iv"); Acat 2007 Workshop, NIKNEF

  20. Mixed ROOT / Coin3D 3D scene It is simple to create the ROOT objects with the mixing ROOT 3D and Coin3D objects. For example the ROOT objects define the geometry (shapes, color and positions) and Coin3D define the animations, lighting, clipping, 3D labels etc. The mixed objects can be saved/ restored using the regular either ROOT (root file) or Coin3D (see slide 4) I/O The rootgeom_coin.C ROOT macro creates such object and renders it with non-Coin3D TCanvas and Coin3D ROOT plug-in. Both the “decoration” as well as ROOT 3d object attributes are kept within ROOT objects and ROOT I/O can be applied Acat 2007 Workshop, NIKNEF

  21. Detector simulationCompare two versions of the STAR detector Acat 2007 Workshop, NIKNEF

  22. Online monitoring During this Run we use the 3-d generation of the Monitor Acat 2007 Workshop, NIKNEF

  23. Event reconstruction(cont) Acat 2007 Workshop, NIKNEF

  24. Conclusions: • The object built upon this model can be saved and retrieved using either ROOT (ROOT macro, ROOT files) or Open Inventor (“iv” or wrl” format files) I/O. The can be rendered with the built-in ROOT TVirtualViewer3D plug-in and with the Open Inventor-based implementation also. To reveal the “Open Inventor” components, a dedicated plug-in was developed. • The model and its implimentation do allow STAR effectively combing the ROOT OO detector description and Coin3D sophisticated 3D scene visualization features. • The plug-in is a part of the QtRoot project and it is available to download from QtRoot project Web sizte and CVS repository (see: http://root.bnl.gov ) (Windows binary do include Coin3D plug-in) Acat 2007 Workshop, NIKNEF

  25. References • R.Brun et all. "ROOT OO model to render multi-level 3-D geometric objects via an OpenGL"Proceedings of the VII International Workshop on Advanced Computing and Analysis Techniques in Physics Research, Chicago, October 16-20, 2000 • V.Fine "STAR Framework and Visualization"ROOT 2000 International Workshop, CERN, Geneva, February, 2000 • P.Nevski. "STAR Simulation".ROOT 2000 International Workshop, CERN, Geneva, February, 2000 • V.Fine. "Visualization of the ROOT 3D class objects with Open Inventor-like viewers"IX International Workshop on Advanced Computing and Analysis Techniques in Physics Research December 1-5, 2003 Acat 2007 Workshop, NIKNEF

More Related