Jump to content

Control the bound of volume shader ?


Cuckon

Recommended Posts

Hi all, I need to add some noise to a SDF in rendertime, however I encounter a problem a little like "Displacement bound", the shader does not evaluated at the voxel of value<=0.

Here's my test, I generate a SDF from a sphere, and fill the output Of & Af using constant 1.0, here's what I get:

post-8006-0-27819400-1362652650_thumb.jp

as I described, the shader just doesn't work outside the value it consider as not reasonable. So is there something I missed to disable the bound optimize?

I know this problem may be silly or has been discussed before but I googled it and found no clue. Help..

Link to comment
Share on other sites

Mantra optimises the render by not evaluating the shader where the density is 0, so you need a small value in your volume in SOPs if you want to add density in the shader.

So if you want to generate the density in the shader, just make the volume a constant 1 and then override it in the shader. You can then add a second volume primitive in SOPs for the SDF, give it a name and then you can import it in the shader with a Parameter node.

If you want to disable the optimisation, there is a "Volume Zero Threshold" rendering property that you can add to your object. I have never used it before .... not sure if it is possible to put negative values in there.

Link to comment
Share on other sites

So if you want to generate the density in the shader, just make the volume a constant 1 and then override it in the shader. You can then add a second volume primitive in SOPs for the SDF, give it a name and then you can import it in the shader with a Parameter node.

Thanks Sam, that works for me! As you said I create a dummy density field with a init value 1.0 and merge it with my SDF, then read the SDF value in shader, it gives me a correct result!

BTW setting the Volume Zero Threshold to negtive is an outstanding idear but unfortunately it doesn't works.

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...