POV-Ray : Newsgroups : povray.programming : Where can I find the reflected ray? : Re: Where can I find the reflected ray? Server Time
28 Jul 2024 06:17:31 EDT (-0400)
  Re: Where can I find the reflected ray?  
From: Christopher James Huff
Date: 14 Oct 2002 12:35:29
Message: <chrishuff-213708.12303114102002@netplex.aussie.org>
In article <3daa404f@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu> 
wrote:

>    Is "box.pov" a scene with reflection.

No. It doesn't use reflection anywhere, which would be one reason no 
files are written. Actually looking at the scene might have helped... ;-)
I'd suggest you use one of the demo scenes in scenes/textures/finishes/, 
all of which do use reflection. And watch out, it could produce a huge 
amount of data. I don't know what you want it for, it might be best to 
make a very simple scene with one reflective shape to minimize the 
amount of reflection data.


> I do render it, but the reflect()
> function is not called because I define an "ofstream" object "output" in
> reflect() function. The exact code is "ofstream output("C:\\out.dat");".And
> then render "box.pov",however, no "out.dat" formed. What's wrong?

> static void Reflect(......)
> {
>   ofstream output("D:\\out.dat");

First, you are opening the file for every reflected ray. This will be 
very slow, it would be better to open it once, for a temporary hack like 
this it would be easiest to just use a global variable. Also, you are 
opening it in write mode, it will overwrite the previously written data 
every time, so you will never get a file with more than one entry. You 
need to either open it once or open it in append mode. Opening the file 
once in write mode and using a global variable for it would be the best 
way: it will be much faster, and if you use append mode you will have to 
remember to delete the data file before each render or it will just 
append to what it wrote in previous renders.

And finally, you didn't give all the code. This is just the code for 
opening a file, you didn't say how you are writing the data.

-- 
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.