RE: RE: [ROOT] THelix in a TNode

From: Faine, Valeri (fine@bnl.gov)
Date: Tue Apr 29 2003 - 16:26:32 MEST


Hello Wolfgang,

> Faine, Valeri <fine@bnl.gov> [26 04 2003] wrote:
> > Have a look at the diagram:
> >
> >
http://root.cern.ch/root/htmldoc/TPolyLineShape.html#TPolyLineShape:desc
> > ription
> >
> > That explains how one can add his / her own 3D class object to the
> > geometry.
> >
> >   Hope this helps, Valeri
> 
> It did, indeed. Thank you. 

  Ok, thank you. I am happy it helps.


> Anyways, the default OpenInventor viewer
> seems to have a few "dark spots", when you happen to look from the
wrong
> point in the wrong direction. 

I think I had fixed this effect for the "plain" OpenGL Viewer in the
version 
of ROOT from http://root.bnl.gov. You can install the ready-to-use
binary of that ROOT for Windows (
http://root.bnl.gov/QtRoot/downloads/ROOT30504.exe   It is one click
operation) to test whether the effect you are speaking about is still
persisting there (with the plain OpenGL Viewer ). If you have an AFS
access you can try the Linux version also.

 What I did 
 I added to TGLKernel::SetRootLight

      GLfloat ambientFactor[4] = {0.2,0.2,0.2,1.0};
      glLightfv(GL_LIGHT0,GL_AMBIENT,ambientFactor);

      GLfloat diffuseFactor[4] = {0.8,0.8,0.8,1.0};
      glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuseFactor);

      GLfloat speculartFactor[4] = {0.3,0.3,0.3,1.0};
      glMaterialfv(GL_FRONT, GL_SPECULAR, speculartFactor);
      glMateriali(GL_FRONT,  GL_SHININESS, 45);

At least it did eliminate the "dark spots". Since the last parameter
defines the material property it should work for Open Inventor viewer 
as well. However I did not check it with "Open Inventor" viewer yet.

There is an implementation of ROOT 3D viewer to interface ROOT and
Coin3D with Qt interface (see: http://www.coin3d.org/ )

The nice feature of that approach it works just for all kind of the
platforms namely Unix and Windows and it is free for Windows (one still
needs to get the proper Qt license though)

Another good candidate for ROOT with Qt-layer is 
http://www-imagis.imag.fr/Membres/Gilles.Debunne/CODE/QGLViewer/ 


At the moment I have not arrived at any final conclusion what would be
better. Coin3D is heavier but it has the well-known "Open Inventor"
interface with X11, Win and Qt low level layers. 
Any opinions, comments, suggestions are encouraged and welcome.
Anyway the interface for Coin3D does exist and can be downloaded from
the BNL repository 
(see: http://root.bnl.gov/QtRoot/QtRoot.html#source )

> I suggest one adds another SoPointLight
> with, say, .5 intensity at 0,0,0. 

That's good. Alas I can not check it immediately. I have no ready-to-use
"Open Inventor" libraries installed on my Windows.
 
> I could supply a patch, but the
> changes are too trivial, and I dunno what is considered good "default
> lighting".  Increasing the headlight intensity, by the way, doesnt
cure
> the problem.  

However the increasing the "specularFactor" should help. (The default
value for this parameter is zero)

> Opposed to what one would think, the headline seems to not
> rotate with the viewer ....  
 
I think the main problem of the current viewer comes from the 3D lines
and points. They are too thin. To make it shine there is a simple fix.
The idea is to tune off any GL lighting to render the thin 3D polylines
and 3D points and keep it on for TShape objects. As result the
brightness of the lines and points (tracks and hits) do not depend of
the external scene light at all. It works faster by the way.

void TGLKernel::PaintGLPoints(Int_t n, Float_t *p, Option_t *)
{
    if (n <= 0 || p == 0) return;
    GLfloat *point = p;
    if (!fRootLight){
       glDisable(GL_LIGHT0);
       glDisable(GL_LIGHTING);
    }
    glBegin(GL_POINTS);
      for (int i=0; i < n; i++, point+=3)   glVertex3fv(point);
    glEnd();
    if (!fRootLight){
       glEnable(GL_LIGHT0);
       glEnable(GL_LIGHTING);
    }
}

At least I did this for STAR "Event Display" and it satisfies our
current needs.

> Just a remark.

  Thank you,
                       Valeri 
> Cheers
> 
> Wolfgang



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET