Automaticly adjusting the camera
Hi,
I have a 3D data set and I'd like to cut a slice to quickly inspect the solution profile. It's clearly a 2D view and I wonder is there a way to automatically setup the camera so I can get the 2D slice centered and properly bounded. I guess the only degree of freedom is the orientation of the image.
If possible, it will be convenient to automatically setup the aspect ratio of the images as well.
Besides, I found the "automatic camera" that determine the camera angle based on some VQ. https://ascent.readthedocs.io/en/stable/Actions/Scenes.html?highlight=camera#automatic-camera This sounds very convenient and I wonder if you can put some examples into the documentation. (The test for this is removed.)
Thanks!
Have you applied the slice filter yet? Rendering the output should produce a 2D image that is correct. Here is an example of that: https://ascent.readthedocs.io/en/latest/Actions/Examples.html#an-example-of-the-slice-filter-with-a-single-plane
(Apologies if you've been searching for anything, the search capability on readthedocs is malfunctioning.)
Thanks for pointing out the broken link. It was rehomed to here: https://github.com/Alpine-DAV/ascent/blob/develop/src/tests/ascent/t_ascent_render_auto_camera.cpp
The caveat is that the camera is applied to the initial input data presented to Ascent and not the data being rendered, which may have been transformed via a filter. It's a bug I'm working on.
So, if I simply cut a slice to get the yz-plane and don't set anything about the camera, it will give me
-
action: "add_pipelines"
pipelines:
pl1:
f1:
type: "slice"
params:
point:
x: 0.0
y: 0.0
z: 0.0
normal:
x: 1.0
y: 0.0
z: 0.0
-
action: "add_scenes"
scenes:
s1:
plots:
p1:
type: "pseudocolor"
field: "vel_z"
pipeline: "pl1"
renders:
r1:
image_prefix: "img/pb_%04d"
Of course, I can adjust the camera because I know what I'm slicing. But, the trouble continues. I will get large margin space. And, I will need to adjust the aspect ratio of images, zoom-in scale, etc. Let alone that the data might not be centered at origin. Lots of things that can be wrong.
camera:
azimuth: 90
My argument is, give a 2D slice, we should be able to use the min/max of the domain and normal direction to automatically setup the camera including position, centering the image, scale, and setting up the aspect ratio of the image.
On the top of that, user should be easily control the outcome by setting margin, rotation, resolution. As an user, I don't mind to have complicated setup, but I'd like to reduce the iterations of re-run and inspecting the images.
Thanks!
Mm interesting! Now I see what you mean. I agree, this should be done automatically, and this is certainly a bug! Thanks for bringing this to our attention!