yt-project / yt_idv

Interactive volume rendering for yt
Other
8 stars 6 forks source link

Spherical volume rendering #64

Open chrishavlin opened 1 year ago

chrishavlin commented 1 year ago

This is a follow up based on https://github.com/yt-project/yt_idv/pull/42 from @sochowski

Fairly confident the geometry shaders and texture sampling are working as they should at this point, next step is to add some intersection checks in the fragment shader and then sample along the ray within each fragment.

Image from the current version of examples/amr_spherical_volume_rendering.py showing the radial component of a spherical dataset in the range of 0.5 to 1 in r, 0 to pi/4 in phi, pi/4 to pi/2 in theta. Screenshot from 2022-12-02 10-47-39

chrishavlin commented 1 year ago

Looks like the commit history was preserved, so I won't worry about figuring out how the previous PR got closed...

chrishavlin commented 1 year ago

note to self: moving the spherical uniforms down to the BlockRendering._set_uniforms will probably fix the failing test.

chrishavlin commented 1 year ago

more things to do:

chrishavlin commented 1 year ago

latest push is a proof of concept for calculating the intersection points of a spherical block with a ray. All intersections with the 6 basic geometries defining the faces of a spherical subvolume are calculated: inner and outer spheres at fixed r, inner and outer cones at fixed theta, the two planes at fixed phi. The definition of the fixed-phi planes are calculated globally in the initial python loop over the blocks and passed down as vertex attributes which are passed along without modification to the fragment shader where all of the intersection points are calculated.

To do:

chrishavlin commented 1 year ago

so after merging with main, the scaling is off. I suspect I'm now scaling the coordinates twice somewhere...

chrishavlin commented 1 year ago

also, can now make use of the preprocessor directives from #70 to better separate the spherical-only parts of the shaders.

matthewturk commented 1 year ago

Check into the YTPositionTrait settings, which now convert to unitary instead of leaving in code units.

On Tue, Jun 6, 2023 at 3:20 PM Chris Havlin @.***> wrote:

so after merging with main, there scaling is off. I suspect I'm now scaling the coordinates twice somewhere...

— Reply to this email directly, view it on GitHub https://github.com/yt-project/yt_idv/pull/64#issuecomment-1579390898, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVXO4ZIEOETMK4MTETAG3XJ6GJLANCNFSM6AAAAAASSFCE6A . You are receiving this because you commented.Message ID: @.***>

chrishavlin commented 1 year ago

note to self: since the current shader iteration is returning single values for blocks and not actually doing any ray traversal, images will be progressively chunkier to nonsensical when using load_uniform_grid with decreasing nprocs. I think this should be fixed by actually evaluating along rays... but wanted to make a note here so I remember to double check. Following images generated with https://gist.github.com/chrishavlin/e5a4ee4c9032cf143cad01c24ffdf1af with decreasing nprocs

nprocs 2048

snap_2048

nprocs 1024

snap_1024

nprocs 256

snap_256

matthewturk commented 1 year ago

@chrishavlin Can you resolve the conflicts?