Make a geometry transparent

I’d like to make transparent geometries as the following example is showing
tutorials/eve/alice_vsd.C where track is seen even inside the defined geometries.
I prepare my simple geometry and try to make them transparent.

//--- Definition of a simple geometry
new TGeoManager("myGeo", "my geometry");

// --- main a few box geometries
TGeoManager::Import("mydet.gdml");
//gGeoManager->DefaultColors();
gGeoManager->GetVolume(“my_box1”)->SetLineColor(kRed-9);
gGeoManager->GetVolume("my_box2”)->SetLineColor(kRed-9);
gGeoManager->GetVolume("my_box3”)->SetLineColor(kBlue-9);
gGeoManager->GetVolume("my_box4”)->SetLineColor(kBlue-9);

// --- TEveManager viewer
TEveManager::Create();
TGeoNode* node = gGeoManager->GetTopNode();
TEveGeoTopNode* en = new TEveGeoTopNode(gGeoManager, node);
//en->GetNode()->GetVolume()->SetVisibility(kFALSE);
gEve->AddGlobalElement(en);

 TEveStraightLineSet* line_passing_geos = new TEveStraightLineSet(“myline);
 line_passing_geos->AddMarker(x,y,z);
 // save several points here, which pass the geometries above, 
 // and I added it to manager …
gEve->AddElement(line_passing_geos);

gEve->Redraw3D(kTRUE);

But, this doesn’t make the geometries transparent. How can i modify my code?
Best regards,

@couet or @bellenot should be able to provide some hints.

Cheers,
J.

Maybe @matevz knows better, but maybe something like this:

en->GetNode()->GetVolume()->SetTransparency(255);

See TGeoVolume::SetTransparency()

Thank you for the comment, but it doesn’t work…

So let’s see what @matevz think about it

I just put the current picture as an example.

Anyway, even if making the geometry transparent is difficult with the current code, it’s ok. I just want to confirm if it is possible

No, you need to set transparency on each volume, as you do with color.

I was usually quite happy with what TGeoManager::DefaultColors() does, it makes volumes transparent based on their densiity:

Cheers,
Matevz

Thanks for your nice comment!
I can do it, it works with below line
gGeoManager->GetVolume(“something of my volume”)->SetTransparency(89);

in fact, 99 provides close to fully transparent.
I tried to set it to 0~1 or large number 255, but it is not correct. The value should be 1~99 ?

Yes, right, it’s 1 - 99, 0 is opaque and 100 is fully transparent. It’s stored as char or unsigned char.

\m