Jump to content

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

Link to comment
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...

Link to comment
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
Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...