POV-Ray : Newsgroups : povray.general : Q: reflected vector : Re: Q: reflected vector Server Time
12 Aug 2024 21:19:53 EDT (-0400)
  Re: Q: reflected vector  
From: Ronald L  Parker
Date: 1 Jan 1999 13:08:47
Message: <36920d89.71268632@news.povray.org>
On Thu, 31 Dec 1998 23:07:01 +0200, Margus Ramst <mar### [at] peakeduee>
wrote:

>Hi all, I'm once again having math trouble :(
>A macro I'm writing needs to calculate reflected vectors (it simulates
>reflected caustics in Superpatch, I'll probably post it soon...)
>However, the function I use to calculate the reflected vectors has 2
>shortcomings:

Why not determine the component of the ray that does not lie along the

normal vector, negate it, and add it back to the componenent that does
lie along the normal?  something like this (untested) code:

// This assumes that R is relative to the intersection point and
// points AWAY from the intersection point.  This is probably not
// the way you have it set up if you're using the SuperPatch.

// R = ray
// N = normal

#macro mirror( R, N )
  #local nN = vnormalize( N );
  #local par = vdot( R, nN );
  #local perp = R-par*nN;
  par*nN-perp
#end

Something else to chew on: I've added XenoArch's projected_through
patch to the next version of the superpatch, and that will allow easy
simulation of reflective caustics from planar surfaces, for the price
of an extra light source per reflected light source per reflective
surface.


Post a reply to this message

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