Signed Distance Field for shading purpose ... how ?
12248 19 2-
- vbk!!!
- 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
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
-
- tjeeds
- 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.
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
Fx Animator
WDAS
-
- vbk!!!
- Member
- 383 posts
- Joined:
- Offline
-
- zdimaria
- Member
- 390 posts
- Joined: Jan. 2012
- Offline
for transferring from sops to shops i believe you can use op
absolute/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?)
absolute/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?)
.
-
- zdimaria
- 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]
and a really good book is
http://www.amazon.com/RenderMan-Shading-Language-Guide/dp/1598632868 [amazon.com]
.
-
- vbk!!!
- 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 …
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 …
-
- tjeeds
- 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.
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
Fx Animator
WDAS
-
- zdimaria
- Member
- 390 posts
- Joined: Jan. 2012
- Offline
-
- vbk!!!
- 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 !
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 !
-
- vbk!!!
- 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.
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.
-
- tjeeds
- 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
Fx Animator
WDAS
-
- tjeeds
- Member
- 339 posts
- Joined: Aug. 2007
- Offline
-
- vbk!!!
- Member
- 383 posts
- Joined:
- Offline
-
- vbk!!!
- Member
- 383 posts
- Joined:
- Offline
-
- tjeeds
- Member
- 339 posts
- Joined: Aug. 2007
- Offline
-
- vbk!!!
- Member
- 383 posts
- Joined:
- Offline
-
- tjeeds
- Member
- 339 posts
- Joined: Aug. 2007
- Offline
-
- vbk!!!
- Member
- 383 posts
- Joined:
- Offline
-
- vbk!!!
- Member
- 383 posts
- Joined:
- Offline
-
- tjeeds
- 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
Fx Animator
WDAS
-
- Quick Links

