POV-Ray : Newsgroups : povray.programming : Randomly deviated vector : Re: Randomly deviated vector Server Time
18 May 2024 01:23:42 EDT (-0400)
  Re: Randomly deviated vector  
From: Paris
Date: 26 Oct 2006 20:25:00
Message: <web.454151a3154caab55dbe37df0@news.povray.org>
Le Forgeron <jgr### [at] freefr> wrote:
> Paris scripsit::
> > [1] First produce a random unit vector that deviates randomly from the
> > positive y axis <0,1,0>  by some given steradians, r.  This part is easy
> > and I have already solved it.
> >
>
> May I ask how is your distribution on the projection disc ? (at
> least, at the specification level ?)
> Is it uniform in density (deviation to <0,0.5> has same probability
> than deviation to <0,1>, in cartesian coordinate) ?
> Or is uniform in direction distribution with uniform deviation on
> the radius (using polar coordinate, independantly) ?
> Note that both appraoches are not identical in result.
>
> Or yet another method ?

I am not using a disc actually.  That actually does not matter at this time,
because I am getting banding artifacts on surfaces that bounce a reflected
vector in a totally random direction independent of the angle of incidence.
 So for now, just consider that I am using a unit hemisphere.  I have used
several methods, including ones I cooked up on my own, as well as those
mentioned here:
http://mathworld.wolfram.com/SpherePointPicking.html   The banding artifacts
remain the same regardless of which hemisphere method I use.   I have
already concluded that random-distribution is NOT THE PROBLEM.  The problem
arrises when I project the randomly-deviated vector around <0,1,0>  into the
surface normal , N on the surface of the object.  N can be ANY VECTOR
including <0,1,0> but also including <0,-1,0> as well as any other vector
in space.  My "random cone" function produces a uniformly distributed set
of points that are, at maximum, S steradians deviated from Y+ (ie <0,1,0>).
  The bundle of such random unit vectors are in a "solid cone angle" that is
centered about Y+ and S steradians wide.   I then project this random vector
into an "axis system" that is built up around N.  (U, V, W orthogonal basis
vectors).  The final result is N, deviated randomly, but at most maximally
deviated by S steradians.  Repeated over and over, this gives rise to a
bundle of random vectors who are all contained in a "cone" that has N as
its principle axis.


> > [2] Next I produce unit orthogonal basis vectors around a given surface
> > normal N, such that the "up" vector is equal to N, and the other two are
> > both orthogonal to N.
> >
>
> There come your problem!
> You have a freedom which must be removed by your code... hence your
> banding!
> Remember that a sphere cannot have combed hairs!
> Your method will always have at least one singularity.

That's nice. But I was requesting that someone please help me find the
algorithm out there that does this.  My method works on paper, but not in
the real world application.  I mean, it "works" but it produces banding
artifacts.  I know nearly every commercial rendering package can produce
"fuzzy reflections" so this algorithm must be widely-known.  I had googled
for hours before giving up in exasperation and coming here as a last
resort.


> > [3] I then project the random vector from [1] into the "axis system" in [2].
>
> I would have rotated [y] to match [N] but that the same thing.

That requires something like 6 trigonometric function calls.  It is
ridiculously slow.  First you have to take 2 arc-sines in order to obtain
phi and theta. Then you have to perform 2 more trig functions each for each
rotation.  That is just not feasible, don't you agree?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.