Alpine-DAV / ascent

A flyweight in situ visualization and analysis runtime for multi-physics HPC simulations
https://alpine-dav.github.io/ascent/
Other
196 stars 66 forks source link

write a util that helps convert camera in visit's cli to ascent camera #1265

Open cyrush opened 7 months ago

cyrush commented 7 months ago

like the session converter, but will be simpler way to wield:

VisIt's View will give you data like:

 >>> GetView3D()
viewNormal = (-0.292424, 0.335495, 0.895506)
focus = (0.5, 0.5, 0.5)
viewUp = (-0.0693529, 0.926533, -0.369766)
viewAngle = 30
parallelScale = 0.866025
nearPlane = -1.73205
farPlane = 1.73205
imagePan = (0, 0)
imageZoom = 1
perspective = 1
eyeAngle = 2
centerOfRotationSet = 0
centerOfRotation = (0.5, 0.5, 0.5)
axis3DScaleFlag = 0
axis3DScales = (1, 1, 1)
shear = (0, 0, 1)
mlohry commented 6 months ago

This would be really helpful if you could take a look at this camera positioning again. I can't seem to get usable camera angles a priori. The session_to_camera.py appears to be bugged,

if type(view) is not type(int):
  print("View3DAttributes not found")
  exit(1)

unless i comment this out, it always prints view3dattributes not found. Not sure but there might have been a python3 update to xml that makes these types incorrect.

cyrush commented 6 months ago

@mlohry I took a pass at updating these helper scripts last week as part of 0.9.3 release. Can you try the newer ones out? I also added unit tests to test the scripts so they stay healthy.

mlohry commented 6 months ago

@cyrush thanks the newer script runs and gives the same output as the one where i commented out that bit, (first is your current version, second the one i commented out):

~/dev/post$ python3 ./session_to_camera.py ./visit0000.session
camera:
  position: [-5824.482238175276, 15761.619561663527, 154272.4413542438]
  look_at: [0.0, 13789.9999859342, 0.0]
  up: [0.109261256519474, 0.993976053716683, -0.00857802200949746]
  zoom: [60.4302909863691]
  fov: 30.0
~/dev/post$ python3 ~/dev/ascent/scripts/build_ascent/ascent/src/utilities/visit_session_converters/session_to_camera.py ./visit0000.session
camera:
  fov: 30.0
  look_at: [0.0, 13789.9999859342, 0.0]
  position: [-5824.482238175276, 15761.619561663527, 154272.4413542438]
  up: [0.109261256519474, 0.993976053716683, -0.00857802200949746]
  zoom: [60.4302909863691]

but this doesn't give me anything close to what i see in visit (it's actually completely black). I can try and work out a reproducer.

is there a reference somewhere that explains the geometry of these camera specs?

cyrush commented 6 months ago

Sorry it's not working as you expect.

The best place to look is the "3D Camera Mode" section in the VTK-m Docs:

https://gitlab.kitware.com/vtk/vtk-m-user-guide/-/wikis/home