Signed Distance Field for shading purpose ... how ?

   12248   19   2
User Avatar
Member
383 posts
Joined:
Offline
Hello,

I would like to use SDF for volume shading and I have 2 questions.

For the moment, I have to write on the disk a bgeo containing my SDF and call it in the shader with a GradientFromFile Vop.
Is there a way to transfert directly SDF from the SOP context to the SHOP context ?

Is it possible to transfert VDB SDF or only classical Volume SDF ?

Thanks for your help

Vincent
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
There's a vex function that you can use to get the gradient directly.
http://www.sidefx.com/docs/houdini12.0/vex/functions/gradient [sidefx.com]

If you need to sample a position other than the currently shaded point you pretty much have to write it out though.
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
383 posts
Joined:
Offline
ok ok

I was hoping for a vop solution instead. I am not skilled enough to “code” a shader …
Maybe it's time to start but I can't see a lot of tutorial about shader coding around there. Only Vop based shader dev

anyway, thanks for your info Jesse.
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
for transferring from sops to shops i believe you can use opabsolute/path/to/sop in place of a file name.

not sure about vdb

i believe the vex function gradient is identical to the gradient from volume vop

as far as writing shaders in vex by hand, a good place to start would be tutorials on rsl. rsl is extremely similar to vex (although i think this is less true when working with pbr?)
.
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
also a good resouce when first starting out with rsl if you choose to go that route is http://www.fundza.com/ [fundza.com]

and a really good book is

http://www.amazon.com/RenderMan-Shading-Language-Guide/dp/1598632868 [amazon.com]
.
User Avatar
Member
383 posts
Joined:
Offline
thanks for theses links Zachary.

Do you think i can use a inline vop to bring this function inside vopnetwork ?

I says that because I think the gradient Vop works like Point Cloud : since there is no “direct” link Mantra and Houdini. Once the ifd created it's impossbile to the renderer to find any SOP …
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
Zachary: It's not identical, Volume Gradient is reading a file off disk. The key difference with gradient() is that it can be used on a live primtive and even one you have modified with shader noise. So you can an up-to-date gradient after you do operations on the field. You used to have to use du/v/w for this.

Vincent: My suggestion would be to create your own vop type through File>New Operator Type and stick the function in there. If it's a one-time deal you can easily use an Inline Code or Snippet vop if you're on 12.5.
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
thanks jesse, that makes a lot of sense. sorry for my mistake
.
User Avatar
Member
383 posts
Joined:
Offline
I tried to use the gradient function within the inline Vop.
This inline node is put inside the “cloud” material.
The output of the node is plugged to the color output of the shader.
But the result is not what I excepted … there is so much noise …
I tried with density from vdb and from legacy volume but the result is the same.
My goal is to get a “Normal like” data to my volume and use it.
I already tried with volume gradient from file and got interesting result.




but now I would like to get the same without the need to save sdf on disk.

Any help is welcome !

Attachments:
gradienttest.jpg (213.8 KB)

http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
I tried to use the asset made by Peter Claes ( well I am pretty sure it's his ).
I tried to transfert Normal attribute to volume.
But when i treid to color my volume with this attribute, it doesn't react has excepted … The color change with the point of view …
It looks great when I color with “P”.

I attach a example scene for you.

Attachments:
testsdfShading2.hipnc (591.4 KB)

http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
Ohhhhhhh, yeah you're not actually rendering an SDF here, this is just a regular ol' density field. Density values coming straight from an IsoOffset or VDBfromPoly are not going to cut it when it comes to getting a smooth gradient, you need a clear direction of change. Simulated smoke can develop enough variation through diffusion and dissipation to yield a meaningful gradient but density coming straight from a geometry conversion is mostly just 1 or 0 so there's not a clear direction of change.
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
Here's a simple setup for rendering a levelset with gradient colors. The min input on the smooth controls the falloff depth, lower values push the transition deeper into the volume, higher values produce sharper features.

Attachments:
testsdfshading2_105.hipnc (597.5 KB)

Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
383 posts
Joined:
Offline
thanks Jesse,
I just started studying the cloudLight asset and started to get something interesting. I will study your hip too.
Volume shading seems veru tricky to me. Maybe because voxel is primitive attribute and not a “real” primitive …
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
Hey Jesse,
Thanks again for your hip file.

I have another question.
I don't why I can not render colored volume with the setup I am using.

Please check the file attached.

thx

Vincent

Attachments:
testsdfshading3.hipnc (733.2 KB)

http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
That renders black and white for you? Not blue and white?
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
383 posts
Joined:
Offline
exact

with houdini 12.5.377 win7
Edited by - April 23, 2013 18:13:03
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
It's in color when I render it. Sure you're not looking at the alpha channel?
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
383 posts
Joined:
Offline
sure

it works on my laptop
houdini 12.5.375 win7

doesn' work on my desktop
houdini 12.5.377 win7

what version are you using ?
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
Hi again Jesse,

watching your setup a question comes to my mind.
the sdf param is used in the shader as a float.

???

I always though the sdf type is vector.
I you can enlight me about this … I will be happy !

Thanks !

Vincent
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
An SDF contains only a float value, the distance to the nearest point on the surface. Distances are positive on the outside of the object and negative on the inside. The vector you are likely referring to is the gradient, which is the direction of greatest positive change. If you normalize the gradient and multiply it by the negated distance you get the nearest position on the surface.
Jesse Erickson
Fx Animator
WDAS
  • Quick Links