Cuckon Posted March 7, 2013 Share Posted March 7, 2013 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: 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.. Quote Link to comment Share on other sites More sharing options...
sam.h Posted March 7, 2013 Share Posted March 7, 2013 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. Quote Link to comment Share on other sites More sharing options...
Cuckon Posted March 8, 2013 Author Share Posted March 8, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.