Jump to content
Doum

volume gradient shop

Recommended Posts

hello,

 

I'm sure it have been talk several time, but I'm not able to find the thread where it is mention. I'm trying to displace volume at rendertime using a volume gradient already created in sop. I've create the setup in a volume Vop and it works, but I have some problem to get my volume gradient in shop.

 

the SOP setup work like this, I add to P my gradient using a volume sample vector from file and plug this result in a volume sample to displace my density.

post-9130-0-71127100-1441224658_thumb.pn

 

Now in Shop, I get P with a global variable - transform P from camera to world and use the volumesample vector from file ( like in SOP), my volume is cached on disk, I add it to P not transform. And output this new P.

 

It displace my volume, but not in the right direction

post-9130-0-46166100-1441224650_thumb.jp

 

Here is the vop net I'm trying to recreate in Shop.

post-9130-0-72773500-1441224754_thumb.pn

 

Someone can give me some hint how to get my gradient to work properly in Shop?

 

Thanks

Share this post


Link to post
Share on other sites

Thanks fathom, I read your reply in this post. I tried it and it didn't works, probably my fault.

to create my gradient in sop the volume needs to be an sdf and the density field is a fog volume, that why I though it wasn't working in shop...

Share this post


Link to post
Share on other sites

yep I will try, but my scn file is at work, i

I will try to post it tomorrow, I hope it is possible to send file from our network :)

 

Thanks guys!

Share this post


Link to post
Share on other sites

Hi Doum!

 

If you are doing stuff in sop you might consider computing your gradient field at sop level, so it can be passed to shop later. I had the same offset you're having trying to use the displace node, don't really know where that offset come from. It doesn't seems to be spaces related. With volume I tend to use the pyroDisplace node that works fairly well for this kind of task. You can wire in your gradient field and something to drive the amount of displacement and your're good to go. Here's a working file so it's a little clearer.

 

Alex

volumeDisplaceAlongGradient_v001.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

Hey alex,

 

Thanks for sharing :), I also tried the pyro displace, here my scn file with the pyro displace and the volume vop displace using a gradient create with an SDF. Alex make me realize that maybe the problem come from the fill interior check box when I create the SDF

 

volume_displace_SOP_vs_SHOP.hipnc.tar.gz

Share this post


Link to post
Share on other sites

Thanks fathom, I read your reply in this post. I tried it and it didn't works, probably my fault.

to create my gradient in sop the volume needs to be an sdf and the density field is a fog volume, that why I though it wasn't working in shop...

 

density should be fine.  this is not the same as a sop gradient calculation.  try that simple shader in the gradient docs.

Share this post


Link to post
Share on other sites

thanks John,

 

Problem solved :). I tried something similar, but I was still using it inside the displace shop node. resampling the density in a new position work as it work in SOP, logic. 

 

By the way, using this method will not divide the volume and add more detail at render time?

 

Thanks again

Share this post


Link to post
Share on other sites

So, I realized the solution I posted before wasn't really working. There was indeed a space issue... as usual. So I added a transform to get from world to camera, since I am using a sop vector field (world space) that needs to be used in shop (camera space). Now it works, without deformation weirdness using the pyro displace node. With this setup you don't need to write anything to disk, it might be useful in some situation.

 

 

volumeDisplaceAlongGradient_v002.hipnc

Share this post


Link to post
Share on other sites

thanks John,

 

Problem solved :). I tried something similar, but I was still using it inside the displace shop node. resampling the density in a new position work as it work in SOP, logic. 

 

By the way, using this method will not divide the volume and add more detail at render time?

 

Thanks again

 

The detail added at rendertime is independent of the SOP volume resolution.  It is determined by the volume quality parameter on the mantra node.

Share this post


Link to post
Share on other sites

i can't upload from work, but i can explain how to take jkunz's file and use a computed gradient.

 

in the shader, add a parm called "density".  this plugs into the volumemodel node, replacing the filevolume sample.

add an inline vop.  add a single output called "g" as a vector.  set the code to be "$g = gradient($density);" and plug the density parm into it.

 

take the output and plug it into a normalize.  plug that normalize into the "nN" of a displace along normal.

take the "fit1" output and plug that into the "amount" on your displace vop.

turn on "object space" on your displace along normal.

 

add an output variables node and select "displacement".  plug your output of your displacement node into the output vop.  plug your output vop into the collect.

 

now render the torus at the vdbfrompolygons1 node.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×