Sampling Distorted Spheres back
Board:
Home
Board index
Raytracing
General Development
(L) [2014/06/25] [tby Geometrian] [Sampling Distorted Spheres] Wayback!I can generate a ray on the surface of a hemisphere pointing toward a random location on a distant sphere fairly simply: you sample over a circle on the surface of the hemisphere corresponding to the projected sphere. The sampling itself can be achieved by e.g. [LINK http://math.stackexchange.com/questions/56784/generate-a-random-direction-within-a-cone this].
However, if the sphere is transformed by a linear transform (e.g. a nonuniform scaling and a rotation), then the method doesn't work. Is there a nice way to handle that?
(L) [2014/06/26] [tby cessen] [Sampling Distorted Spheres] Wayback!I don't know if this is the correct way to do it, but what I've been doing in Psychopath is sampling in the local space of the sphere, and then transforming the resulting vector into world space after the fact.
I can imagine this may be incorrect, though, since for non-uniform scaling, shearing, etc. the surface area is distorted non-uniformally (I think?).
I'll be curious if someone smarter knows how to handle this.  It would be great if there were a general way to handle this (e.g. given a sampling strategy for shape X, how to conduct that strategy when the shape is distorted by matrix M).
(L) [2014/06/26] [tby Geometrian] [Sampling Distorted Spheres] Wayback!>> cessen wrote:I don't know if this is the correct way to do it, but what I've been doing in Psychopath is sampling in the local space of the sphere, and then transforming the resulting vector into world space after the fact.
I can imagine this may be incorrect, though, since for non-uniform scaling, shearing, etc. the surface area is distorted non-uniformally (I think?).Not sure exactly what you mean for your sampling strategy, but surface area certainly will be distorted nonuniformly. One way to see this is to think about each different normal as being a different point on the sphere. Scale the sphere by <0.001,1.0,1.0>, and you'll see that suddenly there are a lot more normals pointing left/right than otherwise.
My plan is to sample a bounding sphere around the transformed sphere. Some of the samples will be wasted in general, but it should work.
(L) [2014/06/27] [tby tarlack] [Sampling Distorted Spheres] Wayback!I do not have a closed-form answer (which most likely exists, certainly involving determinants of jacobian matrices), just an intuitive idea: Consider the definition of the area measure on the surface at point p dA(p) = magnitude(dx(p) ^dy(p)), where dx and dy are tangent vectors obtained as the derivative of p with respect to a system of coordinates (surface -> 2 coordinates -> 2 vectors), the area measure on the distorted shape obtained from the original one via a distortion function D can be obtained by computing the differential vectors in the distorted shape for the distorted point D(p).
(L) [2014/06/27] [tby graphicsMan] [Sampling Distorted Spheres] Wayback!See if this paper will help you:
[LINK http://www.cs.utah.edu/~shirley/papers/tog94.pdf]
back