Dot product of vector VDB and viewing angle

   3881   10   1
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
So I am working on a project were I need to make a VDB volume more transparent were it's gradient field is aligned with the camera's viewing angle. I figured it would be easy enough to take the normalized gradient of the volume, take the camera normal, and then run a dot product of them in a volume vop, however my result looks really blocky and doesn't seem to work at all. Can anyone share ideas of how to do this?
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
So after playing around with it some more I found that it had to do with the size of the gradient vectors being too small and for some reason using lower resolution volumes provided larger gradient vector results that I was then able to get a better result with. Not sure why this method doesn't work very well with higher resolution volumes. Any ideas?
User Avatar
Member
9538 posts
Joined: July 2007
Online
make sure you normalize both vectors before doing dot product of them
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Yes, I made sure to do that. I think it had to do with the gradient vectors being so small that the computer just treated them as having 0 magnitude maybe?
User Avatar
Member
9538 posts
Joined: July 2007
Online
as well depends on your volume, as the gradient may be 0 for some voxels if all surrounding voxels have the same value as current one, which is less likely for SDF, but fog volumes from geometry can have that problem as usually inside of the object is 1 so you will get gradient only on borders
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Good point. Any tips on how to make a fog volume into a nice even gradient?
User Avatar
Member
76 posts
Joined: Sept. 2011
Online
90ender
Good point. Any tips on how to make a fog volume into a nice even gradient?

An alternative to downsampling the volume is blurring it.

So you could blur it before calculating the gradient, then use the gradient with the original fog volume.
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
So that has actually been something I have been wondering about. It seems to me that if you have a high resolution fog volume that is value 1 all the way across, you would have to smooth it pretty drastically in order for the blur to have any effect on the inner most voxels. Is this right?
User Avatar
Member
76 posts
Joined: Sept. 2011
Online
90ender
So that has actually been something I have been wondering about. It seems to me that if you have a high resolution fog volume that is value 1 all the way across, you would have to smooth it pretty drastically in order for the blur to have any effect on the inner most voxels. Is this right?

I'm not sure how to fix the interior, but blurring it can give more reasonable vectors for the border depending on your volume.
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Cool. Thanks.
User Avatar
Member
9538 posts
Joined: July 2007
Online
you can as well try converting your volume to SDF and get gradient of that, if you use surface VDBs then make sure you fill the interior
but if you are using polymesh as a source to begin with, just convert that to SDF directly
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links