Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "The Object Model to Construct the Mixed “Open Inventor” / ROOT 3D scenes by Valeri Fine, Jerome Lauret STAR Brookhaven National Laboratory."— 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 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF2 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.

3 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF3 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 timeOnline monitoring Detector simulation – Full-fledged geometry ( hierarchy ) navigation, Selection. Comparison of the different versions.Detector simulation Event reconstruction – Event representation. Event (flat or simple hierarchy) Navigation and Selection on the top of the simplified detector geometry..Event reconstruction Why?

4 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF4 3D “visual” attributes: one size fits all? Transparency: One and the same object (detector component) can be seen as simulationtransparent for the simulation, reconstructionsolid for the reconstruction and online monitoringinvisible 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.

5 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF5 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.

6 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF6 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.

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

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

9 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF9 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 detailshttp://doc.coin3d.org/Coin/classes.html 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.

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

11 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF11 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” Coin3D implementation The “Menu” Selection Slot

12 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF12 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. Coin3D implementation. The Custom Selection

13 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF13 Coin3D implementation Multiply 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:short animation

14 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF14 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)

15 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF15 ROOT transparency attribute implementation. Does “invisible” == “100 % transparent”? There are several ways to see the transparency attributes for ROOT object. 1.Full 100 % transparent object – wired and “unpickable” image 2.99% transparent object – wired and “pickable” image 3.> 99% - translucent solid image. 4.Invisible – “invisible” means no image at all.

16 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF16 ROOT shapes.C example: trap->SetLineColor(4); trap->SetFillStyle(4001); tube->SetLineColor(6); tube->SetFillStyle(4000);

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

18 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF18 “Rendering”-time mixture Coin3D- based viewer ROOT 3D objects Coin3d SoNode’s Mix the ROOT and Coin3D objects at the rendering time within Coin3d viewer Useful to decorate the original ROOT object with the scene-wide effects “the decoration” is kept apart of the detector geometry with “iv” format

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

20 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF20 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

21 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF21 Detector simulation Detector simulation Compare two versions of the STAR detector

22 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF22 Online monitoring During this Run we use the 3-d generation of the Monitor

23 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF23 Event reconstruction Event reconstruction (cont)

24 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF24 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 )http://root.bnl.gov (Windows binary do include Coin3D plug-in)

25 4/24/2007 fine@bnl.gov Acat 2007 Workshop, NIKNEF25 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, 2000R.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, 2000V.Fine "STAR Framework and Visualization" ROOT 2000 International Workshop, CERN, Geneva, February, 2000 P.Nevski. "STAR Simulation". ROOT 2000 International Workshop, CERN, Geneva, February, 2000P.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, 2003V.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


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

Similar presentations


Ads by Google