Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spherical volume rendering refactored #159

Open
wants to merge 59 commits into
base: main
Choose a base branch
from

Conversation

chrishavlin
Copy link
Contributor

@chrishavlin chrishavlin commented Dec 3, 2024

So this is a verion of #64 that seems to work pretty well with a few caveats.

This version does 2 things differently:

  1. It calculates the cartesian bounding boxes of every block initially (using code from ENH: cartesian cutting planes through non-cartesian geometries  yt#4847), and passes that info down to the shaders as additional vertex attributes.
  2. And then those cartesian bounding boxes are used in the ray tracing shader for calculating ray intersections. At each sample point along the ray, the spherical coordinates are calculated and used to sample the texture if it falls in the actual spherical element.

The main caveat is that you need a fairly large number of sample points for the ray tracing since intersection with the cartesian bounding box does not guarantee intersection with the enclosed spherical element.

EDIT: cartsian bbox calculation now works with big elements (via a recursive division when its needed). Also, at least one thing that should be fixed before this goes in is that the cartesian bounding box calculation was designed for fairly small spherical elements and breaks down when blocks span whole quadrants of the spherical coordinate system. e.g., the new example script uses load_uniform_grid with nproc=128, if nproc is smaller (less than 8 or so), the blocks get too big and the bounding box calculation breaks down and results start to get wonky (or nonexistant). So, should fix that...

Finally -- I decided to go with a new PR rather than modifying #64 because I'm abandoning the complicated intersection checks with the underlying spherical element bounds. While I think that approach could work (and could be added on here...), I think it's worth getting the simpler version here merged first and wanted to preserve #64 in its current state to make that attempt easier in the future.

sochowski and others added 30 commits December 2, 2021 18:06
@chrishavlin chrishavlin added this to the 0.5.0 milestone Dec 6, 2024
@chrishavlin
Copy link
Contributor Author

merged! can now move all the geometry-specific calculations to pre-processor directives rather than uniforms.

@chrishavlin chrishavlin force-pushed the sph_vol_render_working branch from f6d1b76 to db21fa6 Compare December 9, 2024 21:17
@chrishavlin
Copy link
Contributor Author

pre-processor directives now working

@chrishavlin
Copy link
Contributor Author

chrishavlin commented Dec 10, 2024

still do do:

  • docs docs docs
  • another test or two would be nice -- maybe a series that checks different bounds.
  • an example with a real dataset
  • refactor the new cython a bit

@@ -38,18 +35,6 @@ def osmesa_empty():
rc.osmesa.OSMesaDestroyContext(rc.context)


@pytest.fixture()
def image_store(request, extras, tmpdir):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is now in conftest.py



@pytest.fixture()
def image_store(request, extras, tmpdir):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied from test_yt_idv.py so it can be used in other test files

@chrishavlin
Copy link
Contributor Author

Latest push includes some new logic to limit the options that show up in the GUI so that unsupported shaders and scene components are not shown. I also bumped the maximum sample factor when the data is in spherical coordinates.

@chrishavlin
Copy link
Contributor Author

Working on docs now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants