-
Notifications
You must be signed in to change notification settings - Fork 145
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
Corrections for Depth merge with OpenGL #95
Comments
For clarification here is a summary: raySurfaceTrilinear for isosurfaces: rayDeep for varying density clouds: |
…rint! Previously, ray directions were normalized, and then multiplied by the application-to-voxel matrix. This meant that SetSteps specified how far the ray should march at each step in the application's coordinate space, instead of in terms of voxels! As a result, `SetSteps` now specifies how far the ray should march at each step in terms of voxels. This commit updates all of the samples to fix this (which fixes an artifact visible on g3DPrint when using a high voxel resolution plus the surface visualization mode would result in undersampling), which improves rendering performance. Also: - Fixes ray-depth buffer intersection (#48, #95) without adding a new variable to the GVDB scene or info struct, by adding a new function, `getRayDepthBufferMax`. - Hopefully correct ray transformation in volume shaders (#89). - Fixes a bug where RotateTZYXS was multiplying on the left instead of on the right by the scaling matrix. - Renames `SCN_PSTEP`, `SCN_SSTEP`, and `SCN_FSTEP` to use more descriptive names. - Adds an `m_draw_topology` flag to `gInteractiveOptix` to choose whether to draw topology at compile-time - Adjusted volume translation in `gInteractiveOptix` and extinction to account for scale change - Includes minor formatting changes
Quick note - I think this might not have been fixed in the latest series of commits (contrary to the above references, whoops), since only |
OpenGL render does not correctly handle the Depth merging when the depth buffer is enabled. This is because the raySurfaceTrilinear never had the depth code inserted, and it must handle it differently.
I haven't had any time to work on a branch (because my local code differs too much now in other ways), so I am just posting the fixes here.
Here they are:
Here is the updated rayCast function:
At the top of cuda_gvdb_scene.cuh:
constant float NOHIT = 1.0e10f;
constant float OBJHIT = 2.0e10f;
In the above code I've added a "OBJHIT" semantic which is part of the Vec3 hit return value, in addition to the existing NOHIT.
The reason the depth merge failed was that NOHIT implies hitting the background (should shade with 1.0 alpha), whereas OBJHIT implies hitting an opengl surface (newly added).
Note the line ~615 in cuda_gvdb_raycast.cuh, which says:
if (hit.z != NOHIT) return;
Used by both surface & deep pathways, this is the key as it means that rays should terminate if they hit an actual volume surface (x,y,z), or if the opengl object is hit (hit.z=OBJHIT), but rays will not terminate so long as the (hit.z==NOHIT) meaning that a deep volume render is in progress, or a surface trilinear has not yet hit a surface.
The above code should fix the OpenGL depth merge case for surfaceTrilinear rendering.
The text was updated successfully, but these errors were encountered: