POV-Ray : Newsgroups : povray.unofficial.patches : Megapov 1.1 - randomize rad sample directions question Server Time
13 May 2024 20:59:29 EDT (-0400)
  Megapov 1.1 - randomize rad sample directions question (Message 1 to 4 of 4)  
From: George Pantazopoulos
Subject: Megapov 1.1 - randomize rad sample directions question
Date: 5 Jan 2005 23:58:27
Message: <41dcc573$1@news.povray.org>
Hello all,

	I'm a bit confused about the following code snippet, found in 
radiosit.cpp, starting at line 779 in ra_gather():


Begin code paste
--------------------------------------------------------------------

       if ( fabs(LayNormal[Z] - 1.) < .001 )         /* pretty well 
straight Z, folks */
       {
         /* we are within 1/20 degree of pointing in the Z axis. */
         /* use all vectors as is--they're precomputed this way */
         Assign_Vector(direction, random_vec);
       }
       else
       {
#ifdef RAD_SAMPLES_RANDOMIZE_PATCH    /* Christoph Hormann January 2003 */
         direction[X] = n2[X]*(random_vec[X]*RCos + random_vec[Y]*RSin) 
+ n3[X]*(random_vec[Y]*RCos - random_vec[X]*RSin) + 
LayNormal[X]*random_vec[Z];
         direction[Y] = n2[Y]*(random_vec[X]*RCos + random_vec[Y]*RSin) 
+ n3[Y]*(random_vec[Y]*RCos - random_vec[X]*RSin) + 
LayNormal[Y]*random_vec[Z];
         direction[Z] = n2[Z]*(random_vec[X]*RCos + random_vec[Y]*RSin) 
+ n3[Z]*(random_vec[Y]*RCos - random_vec[X]*RSin) + 
LayNormal[Z]*random_vec[Z];
#else
         direction[X] = n2[X]*random_vec[X] + n3[X]*random_vec[Y] + 
LayNormal[X]*random_vec[Z];
         direction[Y] = n2[Y]*random_vec[X] + n3[Y]*random_vec[Y] + 
LayNormal[Y]*random_vec[Z];
         direction[Z] = n2[Z]*random_vec[X] + n3[Z]*random_vec[Y] + 
LayNormal[Z]*random_vec[Z];
#endif
       }
--------------------------------------------------
End code paste


Disregarding the RAD_SAMPLES_RANDOMIZE_PATCH for a moment, I understand 
the following: We are in the function that shoots gather rays for a 
point that needs indirect illumination calculated for it. If the Layer 
normal of the point in question is very close to being parallel with the 
World's Z axis, then the sample direction is used as-is, otherwise it is 
adjusted to compensate for the direction of the normal.

What I see the RAD_SAMPLES_RANDOMIZE_PATCH is doing is that, along with 
adjusting for the Layer normal's Z direction, it gives the sample 
direction a random rotation about the Z axis.

However, I notice that if the Layer normal is parallel to the World's Z 
axis, no random rotation is done. I don't understand why the random 
rotation isn't done in all cases. It seems that if the Layer normal 
happens to be almost parallel to the World Z axis, then no random 
rotation is done at all, despite the user having "randomize on" in their 
global settings.

Thus, it appears that certain areas of a scene that uses "randomize on" 
  may not have their sample directions randomly rotated while others 
areas will, depending on the direction of their surface normal. Is my 
analysis correct?

Thanks,
George


-- 
-------------------------
George Pantazopoulos
http://www.gammaburst.net


Post a reply to this message

From: Christoph Hormann
Subject: Re: Megapov 1.1 - randomize rad sample directions question
Date: 7 Jan 2005 15:35:02
Message: <crmrlc$47k$1@chho.imagico.de>
George Pantazopoulos wrote:
> 
> Thus, it appears that certain areas of a scene that uses "randomize on" 
>  may not have their sample directions randomly rotated while others 
> areas will, depending on the direction of their surface normal. Is my 
> analysis correct?

It is i think.

Actually i am not sure if the speacial case for Normals in z direction 
is really a good idea but since it works there is no need to change it.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 23 Sep. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: George Pantazopoulos
Subject: Re: Megapov 1.1 - randomize rad sample directions question
Date: 7 Jan 2005 16:05:00
Message: <web.41def92e9bb66b907aa29ee90@news.povray.org>
> > Thus, it appears that certain areas of a scene that uses "randomize on"
> >  may not have their sample directions randomly rotated while others
> > areas will, depending on the direction of their surface normal. Is my
> > analysis correct?
>
> It is i think.
>
> Actually i am not sure if the speacial case for Normals in z direction
> is really a good idea but since it works there is no need to change it.
>
> Christoph
>

Hi Christoph,

   Please see the thread started by Jerome Colin entitled "Megapov 1.1
radiosity question" (Link below)

http://news.povray.org/web.41de8e6bb2aee8af5d3520950%40news.povray.org

Thanks,
George


Post a reply to this message

From: George Pantazopoulos
Subject: Re: Megapov 1.1 - randomize rad sample directions question
Date: 7 Jan 2005 16:10:01
Message: <web.41defa989bb66b907aa29ee90@news.povray.org>
>
>    Please see the thread started by Jerome Colin entitled "Megapov 1.1
> radiosity question" (Link below)
>
> http://news.povray.org/web.41de8e6bb2aee8af5d3520950%40news.povray.org

Argh, I posted the wrong link. The above is the messageID, but what I
reallly wanted to post was the link to the whole thread:

http://news.povray.org/povray.unofficial.patches/thread/%3Cweb.41de8e6bb2aee8af5d3520950%40news.povray.org%3E/


Post a reply to this message

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