POV-Ray : Newsgroups : povray.newusers : Reflection vector Server Time
30 Jul 2024 10:24:22 EDT (-0400)
  Reflection vector (Message 1 to 2 of 2)  
From: Rafal 'Raf256' Maj
Subject: Reflection vector
Date: 29 Mar 2004 12:56:25
Message: <Xns94BBCAC843AF8raf256com@203.29.75.35>
Ray coming from point A is intersecting with a plane in point P, with 
normal N. How count Q that vector NQ would be direction of light bounced of  
plane?

-- 
http://www.raf256.com/3d/
Rafal Maj 'Raf256', home page - http://www.raf256.com/me/
Computer Graphics


Post a reply to this message

From: Christopher James Huff
Subject: Re: Reflection vector
Date: 29 Mar 2004 13:10:43
Message: <cjameshuff-DACA7D.13110929032004@news.povray.org>
In article <Xns94BBCAC843AF8raf256com@203.29.75.35>,
 "Rafal 'Raf256' Maj" <spa### [at] raf256com> wrote:

> Ray coming from point A is intersecting with a plane in point P, with 
> normal N. How count Q that vector NQ would be direction of light bounced of  
> plane?

It doesn't work that way. If Q is a scalar, N*Q would differ from N only 
in magnitude. If it's a vector, the dot product of N and Q would be a 
scalar, and the cross product would be perpendicular to both of them, 
which would not be the case for a reflected ray.

Here's working code from my own raytracer, which should be pretty clear:

    const Vect3D & dir = isect.ray.direction;
    const Vect3D & norm = isect.normal;

    Vect3D reflDir = dir - (norm*dir.dot(norm)*2);
    reflDir.normalize();

A quick Google for "reflected ray" will turn up more information.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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