-
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
gInteractiveOptix sample render problems with Optix 6.5 #89
Comments
Thanks for pointing this out and looking into this! Yeah, I also noticed some problems with the volume bounding boxes with transformation in the OptiX samples (maybe introduced around the time of the voxelsize = 1 change)? I'll hopefully be looking into this around the same time as looking at porting some of the OptiX samples to OptiX 7, as that should be a good time to go through the raytracing code and formalize what coordinate system each of the parameters use. |
No problem! I've started to go through it more and should have some time to devote to it over the next week or two. Once I see what's up, I'll reply with what I've found and any fix(es). If it's OK, I'll keep this issue open to track updates even though it's a duplicate of the other issue. |
No worries! I'll wait to close the other issue as well until this one's fixed. |
Hi Neil, I have been following all the great stuff happening with GVDB. I'm fairly certain the bounding box issues are related to the deprecation of voxel size. The functions getWorldMin/getWorldMax which are used to setup the optix bounding box do not yet make use of the new rendering transform as digbeta mentions. I'd like to recommend that when you port from OptiX 6.0/6.5 over to Optix 7.0 that you create a new sample rather than replace the existing sample. OptiX 7.0 is very different from 6.0/6.5 and there are many users still working with the earlier optix pipeline who would benefit from the latest GVDB changes. If there were an gInteractiveOptix7, that sample could sit next to the pre-6.5 optix samples. Regards, |
I have been messing with this a little..
Notice the front_hit_point/back_hit_point must take the 'hit' and transform by the SCN_XFORM. |
Thanks, Rama. I made the changes to vol_intersect, but it still isn't looking correct for me yet. I turned on the bounding box debugging code in vol_deep, testing the output with and without the front/back hit points transformed like in vol_intersect, and neither is giving correct results: I wasn't 100%, but I changed vol_intersect to use orig instead of ray.origin when calculating t:
Here's what I have now in vol_deep for the debugging:
Here's the output when the transform is disabled: Also, I didn't make the SCN_PSTEP transform change you mentioned - isn't pstep just a scalar value? Thanks! |
@digbeta I was working with surface renders. For deep volume renders, the hit.x and hit.y represent t-values for the near and far side of the volume along the ray. Thus my code above is only for vol_intersect, not for vol_deep.
Also, the draw_topology may be throwing you off as that function also needs to change to correctly make use of the SetTransform. In other words, the blue and green boxes showing the gvdb topology are probably wrong too.
and the func drawBox3DXform is:
Finally, this last is a note to both yourself and @neilbickford-nv (all the above was too really : ) I would branch and push but I don't have a lot of time presently to test and post updates. |
Thanks very much, Rama. I definitely appreciate the help. GVDB is a great project and I'm eager to get more familiar with it so I can help contribute more here... I just largely deleted my prior comment here as I think I was wrong about the scaling. I'll post back here after I do some more testing... |
OK, I updated the optix sample, replacing the smoke with a cube to make things simpler. I also turned off topology boxes for level 0. It looks like something is still going on with the scale. With scale = 1, all is good with translation, etc. When changing scale to .5 (pre-translation is 0, rotation is 0), you can see some of the effects below. Here, things look ok and the box is sitting within the n=1 boundary box: Now, I translate the volume up the y-axis and I can see the GVDB transform moves more quickly than the optix-rendered volume, and after rebuilding the optix graph, you can see the volume is getting cut off, right at the boundary for the level 1 bounding box: I'm still looking over everything, but wanted to share in case you recognized the issue more quickly. Thanks in advance! |
@digbeta |
No problem, thanks for your help. Yes, I changed draw_topology to this:
Here's what I have for SetSteps (scale set to .25, default scale in the sample): Here's what you get using the sample with only the changes above and the changes to vol_intersect you noted earlier. It's actually not even in the bounding boxes here and is rendering behind the angel: I've been staring at this a while and it's possible I have mixed something up. :-/ |
There is something weird going on.. I'm not sure what it is at this point.. |
Strange indeed! I powered off for the night, but yes, I’m getting similar
results for surface and deep renders. When scale is 1, everything is
good. Otherwise, not so much.
The volumes themselves appear to render correctly, making me think the
intersectors are OK, but the presence of the box makes it look like it’s
something with the raycast bounding box test.
I’m not totally confident that I’m working on a consistent set of changes,
however. I was testing/changing things today and need to diff my changes
to make sure I haven’t introduced a bug on my end.
I’ll check my changes tomorrow to make sure I’m not sending you down a
rabbit hole. Thanks again for the help, Rama.
…On Thu, Jun 11, 2020 at 11:05 PM Rama Karl Hoetzlein < ***@***.***> wrote:
There is something weird going on.. I'm not sure what it is at this point..
I notice in the last example you did a deep volume render of a cube, and
here is a surface render of the explosion example. Do you get the same
result with a deep render (volumetric) of the explosion?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#89 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AECSDEOCAYAAGDKSXFO6WYTRWGLPFANCNFSM4NWKBHVA>
.
|
Hi, @ramakarl - I went through to confirm my changes so I could show you what exactly I've changed from the main branch. The main_interactive_optix.cpp file has the changes we discussed above (topology update, setting step to step/mScale, changing to trilinear for debugging):
Also optix_scene.cpp is unchanged. Below are the changes to optix_vol_intersect.cu. Note that the deep function is not correct and doesn't have the scale change you provided, I am just looking at the surface intersector right now.
|
This should be fixed now by the latest SetTransform post. Would you agree? |
OK, so I think I found another related issue here. It looks like in the Optix sample program that OptixScene::AddVolume takes a volmin and volmax
...which are stored in a brick buffer and represent the bounding box values for the Optix bounding box program:
However, the values used for the bounding box are retrieved from getWorldMin() and getWorldMax(), which transform the vertices using our transformation matrix:
However, from the Optix 6.5 docs:
Along with some of the transform work, I think this is possibly a partial cause of the issues in Optix... |
OK, I think I have this resolved. It required 3 changes: 1 - Changing the Optix bounding box to remove the transform from the volmin/volmax variables in the AABB bounding box program; Comments are welcomed. I do have it working correctly with Optix and GVDB renders. |
…artially fixes `gPointCloud`. API breaking changes: `getWorldMin()` and `getWorldMax()` no longer multiply their coordinates by `mXform` (as the result is no longer necessarily an axis-aligned bounding box of the volume). Instead, the user should pass both the AABB and the transformation matrix into functions that use these functions and operate in application-space, instead of index space. Other changes: - Adds `drawBox3DXform` to `nvGui`, based in part on Rama's comments in #89. - Uses colors from GVDB instead of redefining them in `draw_topology` - `gPointCloud` now passes the bounding box of its points to OptiX by calling `render_update` before `RebuildOptixGraph`. - Re-enables `gPointCloud`'s UI and allows the user to draw points using OpenGL by maintaining a CPU copy of the points. - Removes `WIN_IO` and `m_io_method` from `gPointCloud` - Adds documentation for `getWorldMin` and `getWorldMax`, as well as note about the types of values these functions return.
…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
Hi all, I've just pushed a series of commits that should hopefully integrate the changes discussed in this thread and issues #48, #93, #94, and #95 - I'll try to talk about the changes in this thread to avoid duplication of topics. These commits include a lot of changes, so as always, please let me know if I broke anything in the process! In particular, the On the plus side, these commits fix a lot of issues, and greatly reduce the number of compiler warnings printed. Here are the highlights from an API standpoint - for more information and the full changes, please see the commit descriptions:
As always, please let me know if this fixes the issue or if there are things that it breaks! |
Hi, Neil, I'm getting a few compile errors that I am still digging into, but wanted to share in case you saw a quick fix or recognized the issue:
Any ideas? |
Ah, that would probably be because I switched the order of the arguments in |
Thanks; I think it was already set that way... but I changed something and got it to compile. :-/ |
Wow, @neilbickford-nv ! That's a clean compile - very well done! However, I still see artifacts on the Optix example, but not in my code where I instituted the corrections I outlined in #89 (comment) I think the issue right now is your bounding box program vol_bounds does not transform coordinates, which is correct, but your intersection programs do. In my code, I just handed Optix the transform, letting Optix handle the transformations, instead of doing it myself in the intersection programs:
Other than that, my application appears to work fine with your changes, so nice work to you and @ramakarl for working out these fixes! |
Thanks! I bet I can fix that (that was one of the things I was worried about) - could you let me know where the line of code posted above should go? Thanks again! |
Sure thing, I'd put it right after the Identity() call below: gvdb-voxels/source/gInteractiveOptix/main_interactive_optix.cpp Lines 112 to 114 in 9ffc6b7
|
…ansforms to OptixScene objects; hopefully fixes the issue in #89.
Got it! I've just pushed a commit (439179d) that should fix this in |
It's fixed! Nicely done. Thanks again to you and @ramakarl for your work on this and the other changes. |
This looks to have been flagged a few times last year, but I wanted to raise this again to see if we could work together to troubleshoot the problem. I've see this issue for a while now, as others have reported: #56 (comment)
The below images are generated via Optix 6.5 and a fresh clone of the GVDB repository. I also have similar issues getting polygons and volumes rendering in my own code, although in mine I have even less success as I don't even get a volume rendered at all, just polys. TLDR; this appears to be a bug related to transformation matrices. Here's the clipped image seen when running the sample using the SetTransform() function:
Here's the same with the SetTransform() call commented out. I have not noted any clipping or artifacts with the transform disabled:
Looking into this further, it looks like there's an issue related to calculating the position of the grid and brick(s). Here's what the grid looks like when calling draw_topology() with the bounding box for nodes using the transformation matrix:
Note this bounding box isn't correct, as it doesn't take into account the transform set earlier:
gvdb-voxels/source/gInteractiveOptix/main_interactive_optix.cpp
Line 183 in 40dd71e
This also is consistent with the note here on the use of the bounding box functions:
gvdb-voxels/source/gvdb_library/src/gvdb_volume_gvdb.cpp
Lines 5780 to 5782 in 40dd71e
So after correcting the bounding box by multiplying the bounding box by the transform, it looks like the rendered position doesn't appear to be in the right place. In fact, the clipping appears exactly beyond the back faces of the bounding box for the node/brick:
The text was updated successfully, but these errors were encountered: