List Info

Thread: Texture Mapping




Texture Mapping
country flaguser name
Japan
2008-05-26 06:47:49
Hello ROOTers,

I would like to show a sphere of which surface is a texture
mapping of  
an all-sky image of cosmic gamma rays. Is there any ROOT
function to  
create such sphere using OpenGL? If not, which ROOT classes
are good  
starting point?

I know that OpenGL itself has functions to handle texture
mapping but  
I am not an expert of OpenGL. So I am wondering if I can
easily access  
OpenGL's texture mapping via ROOT system.

Regards,

OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
Department of Physics, The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
TEL/FAX +81 3-5841-4173/4059
Skype : okumura.akira


Re: Texture Mapping
country flaguser name
Japan
2008-05-26 11:39:58
Hello Matevz,

> 1. What is your image format and size?

In most of my cases, image format will be FITS HEALPix.
http://healpix.jpl.nasa.
gov/
But I am not planning to map FITS images on spheres
directly. At first  
I will read a FITS image using CFITSIO,
http://heasarc.nasa.gov/docs/software/fitsio/fitsio.html

and convert it to a usual 2D image array (r, g, b, alpha) on
memory.  
And then I will map the array on a sphere.

> 2. Is it a single texture in Mercator projection or you
have several  
> images that need to be applied (usually 6, one for each
side of an  
> encompassing cube)?

2D array will be Mercator projection.

My application has very strong connection to FITS format.
Thus even if  
you would implement new official ROOT classes for textured
sphere, I  
have to implement classes by myself. So at first I will try
to start  
implementing something like TTexturedSphere/GL as you
suggested.

SkyViewer
http://lambda.gsfc.nasa.gov/toolbox/tb_skyviewer_ov.cfm
is the basic idea of my application. Its main feature is to
plot FITS  
HEALPix image using OpenGL texture mapping. But it has no
function to  
analyze cosmic gamma ray images. That's why I am interested
in  
implementing more powerful viewer.

Of course, if ROOT supports my requirement officially in a
month as  
you wrote, I will move to official classes.

Thank you so much.

Regards,

OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
Department of Physics, The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
TEL/FAX +81 3-5841-4173/4059
Skype : okumura.akira

On 2008/05/26, at 7:50, Matevz Tadel wrote:

> Hi Akira,
>
> OKUMURA, Akira wrote:
>> Hello ROOTers,
>> I would like to show a sphere of which surface is a
texture mapping  
>> of an all-sky image of cosmic gamma rays. Is there
any ROOT  
>> function to create such sphere using OpenGL? If
not, which ROOT  
>> classes are good starting point?
>
> Support for textures in OpenGL is in our development
plan but hasn't  
> very high priority at the moment. If you express keen
interest for  
> it we could start working on that in about 3 weeks and
have  
> something in about a month.
>
> After that implementing a textured-sphere will be
breeze.
>
> If you know ROOT OpenGL well, something could be done
even without  
> central support for textures by implementing a pair of
classes, e.g.:
> TTexturedSphere   - holding the image data and sphere
parameters;
> TTexturedSphereGL - doing actual rendering.
>
> This paper/talk should give you the general idea:
> http://indico.cern.ch
/contributionDisplay.py?contribId=445&sessionId=28&c
onfId=3580
>
> I can help you prepare the skeleton classes and basic
functionality  
> in about a week's time. Let me know what's your
time-scale and  
> desired involvement for the task.
>
> I also have two questions 
>
> 1. What is your image format and size?
>
> 2. Is it a single texture in Mercator projection or you
have several  
> images that need to be applied (usually 6, one for each
side of an  
> encompassing cube)?
>
> Best regards,
> Matevz
>
>> I know that OpenGL itself has functions to handle
texture mapping  
>> but I am not an expert of OpenGL. So I am wondering
if I can easily  
>> access OpenGL's texture mapping via ROOT system.
>> Regards,
>> OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
>> Department of Physics, The University of Tokyo
>> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
>> TEL/FAX +81 3-5841-4173/4059
>> Skype : okumura.akira
>> </div>


RE: Texture Mapping
country flaguser name
United States
2008-05-26 12:15:10
Hello Akira, 
 
Do you need something like
http://doc.coin3d.org/Coin/classSoTextureCoordinat
eSphere.html
 
backed with
 

http://doc.coin3d.org/Coin/classSoGeoCoordinate.html 
 
thank you.
      Valeri
 

________________________________

From: owner-roottalkroot.cern.ch on behalf of OKUMURA, Akira
Sent: Mon 5/26/2008 7:47 AM
To: ROOT Talk
Subject: [ROOT] Texture Mapping



Hello ROOTers,

I would like to show a sphere of which surface is a texture
mapping of 
an all-sky image of cosmic gamma rays. Is there any ROOT
function to 
create such sphere using OpenGL? If not, which ROOT classes
are good 
starting point?

I know that OpenGL itself has functions to handle texture
mapping but 
I am not an expert of OpenGL. So I am wondering if I can
easily access 
OpenGL's texture mapping via ROOT system.

Regards,

OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
Department of Physics, The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
TEL/FAX +81 3-5841-4173/4059
Skype : okumura.akira




RE: Texture Mapping
country flaguser name
United States
2008-05-26 16:42:23
Dear Akira, 
 
I am sorry, I forgot to provide the link to the ROOT macro.
Here you are the  screen snapshot
ht
tp://root.bnl.gov/QtRoot/pictures/HelloEarth.gif
 
produced by the 20 lines long ROOT macro (it uses the
standard ROOT plug-in and its Coin implementation) 
http://root.bnl.gov/QtRoot/root/qtExamples/HelloEar
th/earth.C
ROOT macro 
 
void earth()
{
  // Draw the globe using "worldmap.bmp" texture
file 
  if ( gSystem->AccessPathName("earth.iv") ) {
    // Create the Inventor file if needed
    ofstream out("earth.iv");
    out << "#Inventor V2.1 ascii" <<
endl;
    out << " Texture2 { filename
"worldmap.bmp" " << endl;
    out <<"  model REPLACE } "<<
endl;
    out << "Sphere {   radius 10 }" <<
endl;
  }
  TCanvas *c = new TCanvas;
  c->SetFillColor(kBlack);
  TVirtualViewer3D *viewer =0;
  if  (viewer =
TVirtualViewer3D::Viewer3D(c,"oiv")) {
        
gEnv->SetValue("Gui.InventorBackgroundShape",&q
uot;earth.iv");
        
gEnv->SetValue("Gui.SnapShotFileCounter","
100");
        // Start ROOT 3D viewer
         viewer->BeginScene();    
viewer->EndScene();
  }
}
 
It generates the picture from the texture file:
 
http://root.bnl.gov/QtRoot/root/qtExamples/Hel
loEarth/worldmap.bmp
 
You can replace on line
 
    out << " Texture2 { filename
"worldmap.bmp" " << endl;

in the macro above to use your own texture file as well.
I think you can use this technique right now (it is very
simple and requires no OpenGL / Open Inventor /  C++
knowledge)  and switch to the "official ROOT class
later on.
 
As my Acat 2007 Workshop talk mentioned, the technique above
can be used to attach any Coin3D node to any ROOT 3D class
object to get the  mixed ROOT/Coin 3D scene as well.
(see http://agenda
.nikhef.nl/contributionDisplay.py?contribId=105&amp;sess
ionId=15&amp;confId=55 )
 
 Hope this helps, Valeri

________________________________

From: owner-roottalkroot.cern.ch on behalf of Fine, Valeri
Sent: Mon 5/26/2008 1:15 PM
To: OKUMURA, Akira; ROOT Talk
Subject: RE: [ROOT] Texture Mapping



Hello Akira,

Do you need something like
http://doc.coin3d.org/Coin/classSoTextureCoordinat
eSphere.html

backed with


http://doc.coin3d.org/Coin/classSoGeoCoordinate.html

thank you.
      Valeri


________________________________

From: owner-roottalkroot.cern.ch on behalf of OKUMURA, Akira
Sent: Mon 5/26/2008 7:47 AM
To: ROOT Talk
Subject: [ROOT] Texture Mapping



Hello ROOTers,

I would like to show a sphere of which surface is a texture
mapping of
an all-sky image of cosmic gamma rays. Is there any ROOT
function to
create such sphere using OpenGL? If not, which ROOT classes
are good
starting point?

I know that OpenGL itself has functions to handle texture
mapping but
I am not an expert of OpenGL. So I am wondering if I can
easily access
OpenGL's texture mapping via ROOT system.

Regards,

OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
Department of Physics, The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
TEL/FAX +81 3-5841-4173/4059
Skype : okumura.akira






Re: Texture Mapping
country flaguser name
Japan
2008-05-27 08:56:24
Hello Valeri,

The example you gave me seems what I want. I will start from
your  
macro and suggestions Matevz told me.

Thank you.

Regards,

OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
Department of Physics, The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
TEL/FAX +81 3-5841-4173/4059
Skype : okumura.akira

On 2008/05/26, at 14:42, Fine, Valeri wrote:

> Dear Akira,
>
> I am sorry, I forgot to provide the link to the ROOT
macro.
> Here you are the  screen snapshot
> ht
tp://root.bnl.gov/QtRoot/pictures/HelloEarth.gif
>
> produced by the 20 lines long ROOT macro (it uses the
standard ROOT  
> plug-in and its Coin implementation)
> http://root.bnl.gov/QtRoot/root/qtExamples/HelloEar
th/earth.C
> ROOT macro
>
> void earth()
> {
>  // Draw the globe using "worldmap.bmp"
texture file
>  if ( gSystem->AccessPathName("earth.iv")
) {
>    // Create the Inventor file if needed
>    ofstream out("earth.iv");
>    out << "#Inventor V2.1 ascii"
<< endl;
>    out << " Texture2 { filename
"worldmap.bmp" " << endl;
>    out <<"  model REPLACE } "<<
endl;
>    out << "Sphere {   radius 10 }"
<< endl;
>  }
>  TCanvas *c = new TCanvas;
>  c->SetFillColor(kBlack);
>  TVirtualViewer3D *viewer =0;
>  if  (viewer =
TVirtualViewer3D::Viewer3D(c,"oiv")) {
>        
gEnv->SetValue("Gui.InventorBackgroundShape",&q
uot;earth.iv");
>        
gEnv->SetValue("Gui.SnapShotFileCounter","
100");
>        // Start ROOT 3D viewer
>         viewer->BeginScene();    
viewer->EndScene();
>  }
> }
>
> It generates the picture from the texture file:
>
> http://root.bnl.gov/QtRoot/root/qtExamples/Hel
loEarth/worldmap.bmp
>
> You can replace on line
>
>    out << " Texture2 { filename
"worldmap.bmp" " << endl;
>
> in the macro above to use your own texture file as
well.
> I think you can use this technique right now (it is
very simple and  
> requires no OpenGL / Open Inventor /  C++ knowledge) 
and switch to  
> the "official ROOT class later on.
>
> As my Acat 2007 Workshop talk mentioned, the technique
above can be  
> used to attach any Coin3D node to any ROOT 3D class
object to get  
> the  mixed ROOT/Coin 3D scene as well.
> (see http://agenda
.nikhef.nl/contributionDisplay.py?contribId=105&amp;sess
ionId=15&amp;confId=55 
>  )
>
> Hope this helps, Valeri
>
> ________________________________
>
> From: owner-roottalkroot.cern.ch on behalf of
Fine, Valeri
> Sent: Mon 5/26/2008 1:15 PM
> To: OKUMURA, Akira; ROOT Talk
> Subject: RE: [ROOT] Texture Mapping
>
>
>
> Hello Akira,
>
> Do you need something like
> http://doc.coin3d.org/Coin/classSoTextureCoordinat
eSphere.html
>
> backed with
>
> 
http://doc.coin3d.org/Coin/classSoGeoCoordinate.html
>
> thank you.
>      Valeri
>
>
> ________________________________
>
> From: owner-roottalkroot.cern.ch on behalf of
OKUMURA, Akira
> Sent: Mon 5/26/2008 7:47 AM
> To: ROOT Talk
> Subject: [ROOT] Texture Mapping
>
>
>
> Hello ROOTers,
>
> I would like to show a sphere of which surface is a
texture mapping of
> an all-sky image of cosmic gamma rays. Is there any
ROOT function to
> create such sphere using OpenGL? If not, which ROOT
classes are good
> starting point?
>
> I know that OpenGL itself has functions to handle
texture mapping but
> I am not an expert of OpenGL. So I am wondering if I
can easily access
> OpenGL's texture mapping via ROOT system.
>
> Regards,
>
> OKUMURA, Akira oxonceres.phys.s.u-tokyo.ac.jp
> Department of Physics, The University of Tokyo
> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
> TEL/FAX +81 3-5841-4173/4059
> Skype : okumura.akira
>
>
>
>
>


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )