Skip to content

porting forceWireframe and forceSolid#1038

Open
tontyoutoure wants to merge 4 commits into
OpenGATE:masterfrom
tontyoutoure:volume_vis_type
Open

porting forceWireframe and forceSolid#1038
tontyoutoure wants to merge 4 commits into
OpenGATE:masterfrom
tontyoutoure:volume_vis_type

Conversation

@tontyoutoure
Copy link
Copy Markdown
Contributor

Hi, I think these to options for visualizing volume in Gate 9 is quite handy when visualizing complicated structures, and take the liberty of porting them into opengate 10.

@tbaudier
Copy link
Copy Markdown
Contributor

tbaudier commented May 27, 2026

Hello @tontyoutoure

I tried your PR, and I do not succeed to have a good results.
I started with the test misc/test004_simple_visu_qt.py and I added the line: (https://github.com/tontyoutoure/opengate/blob/refs/heads/source_visualization/opengate/tests/src/misc/test004_simple_visu_qt.py#L36)

waterbox.vis_type == "wireframe"

"wireframe" or "solid" I do not see any differences. Is it possible for you to propose a test like test004_simple_visu in which we can see the difference between wireframe and solid please?

@tontyoutoure
Copy link
Copy Markdown
Contributor Author

@tbaudier Hi, if you wrote = instead of == in your test and you just typoed here, I will try it myself couples of hours later.

@tontyoutoure
Copy link
Copy Markdown
Contributor Author

tontyoutoure commented May 27, 2026

This is what I got running the test directly:

Screenshot_20260527-221137.png

this is what I got after adding waterbox.vis_type = "solid" after line 36:

Screenshot_20260527-220717.png

@tbaudier
Copy link
Copy Markdown
Contributor

Sorry, I did a mistake. I have the same results than you for qt. But I do not see any differences with vrml, and you? BTW can you add a test004_simple_visu_solid.py with solid option please?

@tontyoutoure
Copy link
Copy Markdown
Contributor Author

I'm not familiar with the vrml system. I will try looking into it but I can't guarantee the result.

I will add an test for the solid option. On the other hand, maybe call it visu_type can better align with other APIs? E.g. sim.visu_type

@tontyoutoure
Copy link
Copy Markdown
Contributor Author

tontyoutoure commented May 28, 2026

@tbaudier I took a look at the vrml visu test and get the same result with you. I dig into Geant4 vrml visulization code, and found the following code at source/visualization/VRML/src/G4VRML2SceneHandlerFunc.icc:637

if(pVA)
{
  if(pVA->IsForceDrawingStyle() &&
     (pVA->GetForcedDrawingStyle() == G4VisAttributes::wireframe))
  {
    // wireframe style is assigned to this object
    flagWF = true;
  }
  else if(cur_view_param.GetDrawingStyle() == G4ViewParameters::wireframe)
  {
    // current viewing style is  wireframe
    flagWF = true;
  }
}

which means if you set the scene view style to wireframe, VRML visualizer will render all volume as wireframe (which means transparent). After changing view style, changing waterbox's style does gives correct result:

image

vs

image

However I don't find a way of running /vis/viewer/set/style s on Python side. The above image are generated with a hacky way. Maybe you can find a way get it working? I tried

    sim.g4_commands_after_init=["/vis/viewer/set/style s", "/vis/viewer/flush"]

and it did not work.

I renamed the attribute from vis_type to style to align with Geant4 naming norms. A test is also added.

@tbaudier
Copy link
Copy Markdown
Contributor

Thank you for the renaming and the test. I also try on my side for vrml without success. Maybe we can add in the doc that it's only available for Qt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants