Jump to content
Macha

Gradient Field -> Isosurface ?

Recommended Posts

Macha    100

I made vector field that works and looks very similarly to the image below.

It is sops generated and consists of a lattice of points with normals attached to it.

Now, with a volume from attribute sop I can turn this essentially into a gradient volume field.

Now the question is this. Since we can calculate a gradient field from an sdf, can we do this in reverse too? I have the gradient field. I want the sdf that generates this field.

charges.gif

Share this post


Link to post
Share on other sites
Macha    100

Hm, interesting. I didn't expect this to work. Surely that's just sampling one volume primitive, not 3, as in the case of a vector field? Or an average of the 3? It's kind of hard to test the correctness of this result. I suspect it isn't.

?

Edited by Macha

Share this post


Link to post
Share on other sites
3dbeing    11

yeah I read the docs, it's adding them up, not even an average...

I guess the quesion on a gradient-> SDF, what is the 'surface'?

if you choose the surface to be the center of the +/- then you could sample nearest and distance from that, as sdf has no notion of direction.

Edited by 3dbeing

Share this post


Link to post
Share on other sites
Macha    100

Imagine we had vectors perpendicular to the (gradient) field in the image above. Wouldn't they point along the directions in which there was no change of density? Then, we would have an isosurface along those directions, right? Uhmm.... uhm...

Share this post


Link to post
Share on other sites
eetu    496

Doing the reverse is the equivalent of integration; you end up with a free variable, the integration constant.

In the above case, the solution is a general sphere, the free variable is an analog of the size of the sphere.

All origin-centered spheres (their SDFs) result in the same gradient field.

If you integrate a gradient field you will get a density field, the absolute magnitude of which is a free variable.

By adding/subtracting a constant from the field, you get all the SDFs that would yield the original gradient field.

  • Like 1

Share this post


Link to post
Share on other sites
Macha    100

Hey Petz, that's almost identical to the setup I have so far but the question I am trying to answer is whether we can find a scalar valued volume whose gradient would generated a given vector field (your VECTORFIELD node)

So:

-we have vector field. (Your VECTORFIELD node)

-we make a vector volume out of it (your VOLUME node)

-we want a scalar volume, the gradient volume of which would be equivalent to the original vector field (your VOLUME node)

The whole point of this would be to get isosurfaces surrounding the charges if all we have is the points-and-normals vector field to start with.

I think eetu is correct in what he says about it. We have an infinity of solutions with a free variable. But in a sense that's ok because we can just invent it and the solutions are constrained enough to be meaningful and not random nonsense.

Now tell us how to do this eetu! :D

i don´t know if this is what you are looking for but attached is an example that might help.

hth.

petz

Edited by Macha

Share this post


Link to post
Share on other sites
3dbeing    11

Now tell us how to do this eetu! :D

I've been looking up a few things, thanks to eetu's clue, but everything I find about surface integrals is based on knowing a function.

You can get the area under the curve (integral) in chops. But i don't quite understand how to derive the sphere from that. I have read that r=sqrt(x^2+y^2+z^2), but I'm still lost. I forsee a long(or short) weekend filled with redbull and MIT, UNSW classes, what else are weekends for? <_<

Macha, this flux sounds very much like what you are describing, so certainly you are on the right track...

I ended my calc in calc II, that's when i decided to go into Art.. How did i find myself back here 20years later...

Morpheus-> It is your destiny Neo... :ph34r:

Share this post


Link to post
Share on other sites
Macha    100

I think eetu's sphere is just an example. The charges in the picture above and in Petz's file don't create spherically looking fields. Because of the (square) distance falloff and opposing directions we get nice curved field lines.

If the gradient of a field is the direction of the maximum change in density then what you do is calculating a derivative. The opposite of that would be taking an integral. The thing that confuses me a bit is that one is a scalar and the other a vector, so something a bit more complicated is going on there. Maybe we have more than one free variable?

In any case, intuitively his description must be right. There is more than one volume that would create such a gradient field but they are all similar in a sense (spheres of different sizes, but still spheres, not cubes or sponge shapes or teapots). I'm afraid but my knowledge of these things crumbles at that point and I don't know if what I want to do is possible or not.

I think integrals on a surface that is not a cleancut function is in many ways easier. You just sum up and divide things and that's that. Computers are good at summing up things.

Edited by Macha

Share this post


Link to post
Share on other sites
3dbeing    11

The sphere is just a jumping off point. Somthing simple to get the ball rolling. I think the point is to derive a curve based on the field flow (Flux?), the free variable would then be the distance from that curve (SDF/IsoOffset?). In the case of a sphere the curve is actually a point...

edit:

So if we had a vector field where every vector was <1,0,0>

then we would get a curve whose function is f(x) = 1

the domain would be the bounding box

and a free variable of 1 would yeild a cylinder in the (?) direction whose radius = 1

if we had a free variable = z we would get a cone pointing in the -z direction -< uhhmmmm :blink:

But I am just going off what little i've been able to garner, I could be way off base here...

Edited by 3dbeing

Share this post


Link to post
Share on other sites
eetu    496

The sphere is just a jumping off point. Somthing simple to get the ball rolling. I think the point is to derive a curve based on the field flow (Flux?), the free variable would then be the distance from that curve (SDF/IsoOffset?). In the case of a sphere the curve is actually a point...

I don't think it's that simple, not all vector fields can be thought of as distance from a point/curve.

Also, not all arbitrary vector fields can be gradients of a density field, I guess it needs to be "divergence-free".

(Somewhat like you can have 'illegal' SDFs)

edit: ok, divergence-free is not right restriction. more like "if you go from A to B by any route, the sub of gradients needs to be the same" or something like that :)

So if we had a vector field where every vector was <1,0,0>

then we would get a curve whose function is f(x) = 1

the domain would be the bounding box

and a free variable of 1 would yeild a cylinder in the (?) direction whose radius = 1

if we had a free variable = z we would get a cone pointing in the -z direction -< uhhmmmm :blink:

If the gradient field is all <1,0,0>, that would equate to a density field that falls off in the negative x direction, and the isosurfaces would be y-z planes.

And now for some quality time with Houdini..

Edited by eetu

Share this post


Link to post
Share on other sites
petz    306

So:

-we have vector field. (Your VECTORFIELD node)

-we make a vector volume out of it (your VOLUME node)

-we want a scalar volume, the gradient volume of which would be equivalent to the original vector field (your VOLUME node)

sorry, i have to read more carefully before i respond then.

anyway, this is not a simple task, because not every vectorfield is a gradient-field. theoratically you could build a linear system like the one in the picture

what you´ll get is a over-determined system, because you have more equations than unknowns. the next step would be solving the matrix which contains a lot of zeros with something like lu-decomposition or conjugate-gradients if you are in hurry. if the vectorfield is a gradient-field everything is ok, and if not then the values should be ignored (more or less).

that´s the theory as far as i remember but all in all its just a guess.

i´ll see if i could put together a file next week if i have time to refresh my memorys (hopefully enough time).

v = vector

u = scalar

h = dist to next point

petz

post-2942-132646243289_thumb.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×