[Radiance-general] rtrace
Georg Mischler
[email protected]
Wed, 10 Oct 2001 22:47:53 -0400 (EDT)
Ron O. Dror wrote:
> I would like to recover the surface normals of the surfaces visible in
> every pixel of a Radiance scene. In other words, I want to trace the
> initial ray cast for each pixel, and find the surface normal of the first
> surface that ray hits. I figured out that I could do this using rtrace
> -on, if I feed rtrace the rays corresponding to each pixel in my
> image. Is there an easy way to compute all of these rays automatically
> using an existing Radiance program, or will I need to write a special .cal
> file for rcalc? I have the feeling that some Radiance gurus could
> accomplish this task in one or two lines.
>
> Thanks in advance for any advice,
>
> Ron
Hi Ron,
I don't think there's a genuinely simple way to do what you want.
You have already figured out the "rtrace -on" part, which looks
like a good second step. But the first step would indeed be to
feed all those rays to rtrace, and I don't see an automatic way
to get that information from any Radiance program.
On the other hand, it's not very hard to construct that set
of vectors with a little program of your own for a standard
perspective. Two or three dozen lines of code will do the trick.
You don't even need to understand the actual view transformation.
Just walk through a regular grid on your image plane, subtract
the view point from each of those grid points, and write the
result into a file. There's no need to normalize the vectors to
unit lenght.
I'm not sure if this could be done with cnt/rcalc, and frieds,
as I have rarely used them myself. I suspect that a more complete
programming language (eg. Python) will be more effective to work with.
Have fun!
-schorsch
--
Georg Mischler -- simulations developer -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/