Fit behaviour in volume wrangle not as expected

   2344   7   0
User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
Before I submit a bug I was hoping someone might look at this file first; Maybe I am misunderstanding something.

I have an sdf volume with sign inverted.

In a volume wrangle I have a fit applied to @surface.

If I use the primintrinsic “volumeminvalue” as the omin value and nmin value set to zero,

it doesn't seem to clamp before putting in the new nmin/nmax range; It seems to behave like an efit.

To get “around” this I just set the omin value to 0 manually.

But I am curious as to why it is working as it is - The points scatter ‘outside’ the geometry using volumeminvalue;

Which is about -21.6, and the volumemax is about 0.91

Shouldn't all the values from 0 to -21.6 clamp to 0?

When I use the fit function with geometry, I do get the bahviour I expect, but not with this sdf volume.

Attachments:
Fit clmaping with sdf volumes.hiplc (7.8 MB)

User Avatar
Member
8619 posts
Joined: July 2007
Offline
looks correct to me
since scatter uses the volume value as density, it scatters only in positive regions proportionally to the value

- by fitting 0-max, to 0-1 you literally just clamp the negatives so it'll give you similar results to not clamping at all, just with potentially different density depending on scatter mode

- but by fitting min-max to 0-1 you are moving the 0 boundary all the way to furthest point (in your inverted SDF) so literally making every value in the volume between 0 and 1 therefore all positive, therefore scatter will potentially scatter within the whole bounding box just with varying density, which is what seems to be happening
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
Thanks Tomas.

Yeah, I did a poor job in explaining and agree with what you are saying.

But to me there is still a discrepency, and in my attempt to explain what it is I am seeing am going to be a bit verbose and say things I am certain yourself and others already know (maybe it will illistrate my misconception). So to begin again:

The iso-offset node is set to invert - So that voxels that lie within the geometry have values that are postive; those external to the geometry surface are negative.

If the volume has a range of values( in the case of this hip ) from -21.633 to 0.91 and I use those values for omin and omax as in the following:

@surface = fit(@surface, -21.633, 0.91, 0, 1);

Then yes as what I think your trying to tell me is that I will get points scattered throughout the entire bounding box of the volume that includes areas within the geometry and outside the geometry.

…because all voxels now have 0(at surface) or a postive value (the nmin, nmax being 0 and 1 respectively and the scatter node sees it as such.

If however, I set the omin value differently as in the following:

@surface = fit(@surface, 0, 0.91, 0, 1);

Then points only get scattered within the interior of the geometry - not outside like before ( with omin set to - 21.633 ).

With the exception of how this compares to fit with geometry points, I would say okay -

Fine, because I've set my omin to 0, the fit node must be ignoring all values ( a type of clamping ) that are less than 0.

And, because of that, all voxels external to the geometry remain negative and the scatter node sees that and does not scatter in that region.

BUT…this is different that what would happen with geometry points - purely in terms of point values.

If I have a point with it's x value set to -21.633 and do like with the volume with:

@P.x = fit(@P.x, -21.633, 0.91, 0, 1);

Then as with the volume, it too gets put into the new range and the point gets set to 0. ( as expected ).

Also, if I change it too:

@P.x = fit(@P.x, 0, 0.91, 0, 1);

Again the @P.x gets shifted to the new range, in this case, put at zero.

If the fit in this last case behaved like the volumes conterpart that also has omin set to 0 then the @P.x would not have gotten set the the new range and put at 0 - it would have retained it's negative value, just like what the volume seems to be doing.
Edited by BabaJ - June 27, 2018 16:35:36

Attachments:
Fit clamping with sdf volumes.hiplc (7.9 MB)

User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
Ok, got word back from support.

It is because of my lack of understanding of what a scatter node uses to addpoints that created the apparent discrepency.

I was assuming points would be created with 0 values and greater, but they don't - only values that are greater than 0.

Lots of you guys probably already knew that, and I think support was going gentle on me with their response

Side Effects Support Ticket: #63092

Hi BabaJ,

From our devs:

“In such a case, only the areas within the geometry area get scattered points. What this says is that the scatter node is still seeing the negative values that lie external to the geometry;

That or the fit node is ignoring the negative values and does not do a fit to the new range - contrary to what documentation says of guaranteeing all values being clamped so that they end up in the new range. ”

There is a third possibility. The scatter node is seeing zero values. The scatter node doesn't scatter on zero values, so no points are created there.

You can see the actual volume values by using a Volume Slice afterwards. This shows density properly zero outside the curve as fit implies.

Cheers,
Edited by BabaJ - June 27, 2018 18:22:05
User Avatar
Member
8619 posts
Joined: July 2007
Offline
you have to keep in mind that what you are shifting in volumes are density values, so you can't expect them to just shift the points or especially if you are forcing the point count in which case scatter only cares about the density ratios

and yes, since scatter ignores negative densities, then fitting minimum from 0 to 0 literally just clamps the negatives which were ignored anyway so they were effectively 0 already
(if it rests your mind I can assure you that all negative values in Vol_B_Fit_0 are indeed being “shifted” to 0 the same way as in Geo_B_Fit_0, it just doesn't matter to scatter as range -n to 0 was already 0 to 0 anyway so no change on that end)
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
You just posted this as I was posting my last response.

So Scatter doesn't ‘scatter’ with 0 values; just values greater than 0?
User Avatar
Member
8619 posts
Joined: July 2007
Offline
BabaJ
So Scatter doesn't ‘scatter’ with 0 values; just values greater than 0?

as mentioned before:
tamte
…since scatter uses the volume value as density, it scatters only in positive regions proportionally to the value…

so no, if “density” is 0 then no points are supposed to be there
scatter doesn't treat SDF as surface, just as “density” values
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2044 posts
Joined: Sept. 2015
Offline
And this is why I misunderstood it from the beginning.

Thinking the scatter node will behave the same in two different contexts.

If one uses a scatter node after a polysphere, it will scatter on the surface; which is essentially 0 spatially;

So I wrongly assumed that the voxels created in the volume that ‘correspond’ to the source geometry boundary would also be given the equivalent 0 density value and treated the same as such.
  • Quick Links