We get it. We use ad blockers too. But GameDev.net displays them so we can continue to be a great platform for you.
Please whitelist GameDev.net and our advertisers.
Also consider a GDNet+ Pro subscription to remove all ads from GameDev.net.
Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 09 February 2012 - 04:30 PM
Posted 09 February 2012 - 06:13 PM
Posted 09 February 2012 - 06:59 PM
Posted 09 February 2012 - 10:17 PM
Posted 10 February 2012 - 10:37 AM
Posted 10 February 2012 - 04:26 PM
Posted 10 February 2012 - 08:36 PM
However if you use it to calculate the distance to a surface from an arbitrary point, it will fail in many cases -- basically any time the point is inside any of the volumes.
I don't really understand what you meant by "(You would not have this luxury if your surfaces were the zero-level sets of some other functions besides distance fields.)"
Posted 11 February 2012 - 08:37 AM
Posted 11 February 2012 - 10:40 PM
I do understand about signed distance, however that shouldn't make a difference though, should it? i.e marching along the gradient should always bring me to the surface (the point where the distance function is 0) regardless of whether I'm "pulled" down or "pushed" up by positive/negative distance.
What I meant was that the union/subtraction/intersection functions listed on that page don't seem to actually be correct as distance functions. Take for example the union operator: min(d1,d2)
Posted 12 February 2012 - 09:19 AM
First: Why do you need the closest point? You should be able to test for collisions without knowing it (you just need to be able to evaluate the distance function at the center of the sphere). Is it because you want to evaluate the gradient there? Have you tried just using the gradient at the sphere's center?
Second: When you're inside, if you have a signed distance function and you want to find the closest point on the surface, you need to go uphill, but when you're outside you need to go downhill. Consider the one-dimensional "d(x)=abs(x)-1" example.
For points outside union(S1,S2), it's correct. The definition of the distance from the point to a set, is that it's the minimum over all the distances to all the points in that set.
But for points inside union(S1, S2), it is only an upper bound on the signed distance (lower bound on the distance to complement). It does always have the correct sign and the correct zero-level set.
1d example:
In 1d, all signed distance functions take the form
d(x) = abs(x-a)+b
for some constants a and b.
Now say your sets are the intervals,
S1 = [-5, 1]
S2 = [-1, 5] .
Then you have the signed distance functions
d1(x) = abs(x+2)-3
d2(x) = abs(x-2)-3 .
Now define the function
f(x) = min(d1(x), d2(x)).
Question: Is f(x) a distance function? If you plot it, you'll see that the answer is "no." It doesn't have the shape of a shifted/translated absolute value function.
Posted 12 February 2012 - 03:20 PM
First: Why do you need the closest point? You should be able to test for collisions without knowing it (you just need to be able to evaluate the distance function at the center of the sphere). Is it because you want to evaluate the gradient there? Have you tried just using the gradient at the sphere's center?
Posted 12 February 2012 - 03:29 PM
I guess there's just no way to do what I want? (e.g compose simple primitive distance functions -- sphere, box, etc. -- into compound functions which represent CSG operations on sets of primitives)
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.