|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi, all
I am trying to write the reflected ray to a file. Firstly, I thought
that I could get the reflected ray from the reflect() function in
lighting.cpp file, so I wrote some code in the function to realize it, but
it did not work. I found that this function was not called when I pushed the
"RUN" button. I do not know the reason. Where can I find the reflected ray?
Thanks
Wu Yang
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3da6f69b$1@news.povray.org>,
"Wu Yang" <wya### [at] cswrightedu> wrote:
> I am trying to write the reflected ray to a file. Firstly, I thought
> that I could get the reflected ray from the reflect() function in
> lighting.cpp file, so I wrote some code in the function to realize it, but
> it did not work. I found that this function was not called when I pushed the
> "RUN" button. I do not know the reason. Where can I find the reflected ray?
Silly question, but did you actually render a scene using reflection?
Just running the program won't call the Reflect() function, but it
sounds like that is what you are doing.
Are you sure the program is being compiled, and you aren't running an
unmodified version? What code are you using to write it to a file?
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you for your reply. Yes, I think that the reflect() will be called
when I run the program. Why this is not right? I do modify what should be
changed and build the project without error. I define an "ofstream" object
"output" by
ofstream output("C:\\out.dat"); and run the program, but no out.dat formed.
Thank you for your assistant.
Best Regard
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> In article <3da6f69b$1@news.povray.org>,
> "Wu Yang" <wya### [at] cswrightedu> wrote:
>
> > I am trying to write the reflected ray to a file. Firstly, I thought
> > that I could get the reflected ray from the reflect() function in
> > lighting.cpp file, so I wrote some code in the function to realize it,
but
> > it did not work. I found that this function was not called when I pushed
the
> > "RUN" button. I do not know the reason. Where can I find the reflected
ray?
>
> Silly question, but did you actually render a scene using reflection?
> Just running the program won't call the Reflect() function, but it
> sounds like that is what you are doing.
> Are you sure the program is being compiled, and you aren't running an
> unmodified version? What code are you using to write it to a file?
>
> --
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3da9eae1@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu>
wrote:
> Thank you for your reply. Yes, I think that the reflect() will be called
> when I run the program. Why this is not right?
The Reflect() function will only be called when POV is computing
reflection. Just running the program won't do that, you need to render a
scene with reflection. This is so obvious I can't believe you would be
doing otherwise, but you haven't given any indication of what exactly
you are doing other than "running the program", which isn't enough.
> I do modify what should be changed and build the project without
> error. I define an "ofstream" object "output" by ofstream
> output("C:\\out.dat"); and run the program, but no out.dat formed.
*Where* do you create the file? What is the *exact* code you are using
to create it and write the data? What is the scene file you are testing
it with?
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Is "box.pov" a scene with reflection. 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?
Thanks a lot.
Best Regard
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> In article <3da9eae1@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu>
> wrote:
>
> > Thank you for your reply. Yes, I think that the reflect() will be called
> > when I run the program. Why this is not right?
>
> The Reflect() function will only be called when POV is computing
> reflection. Just running the program won't do that, you need to render a
> scene with reflection. This is so obvious I can't believe you would be
> doing otherwise, but you haven't given any indication of what exactly
> you are doing other than "running the program", which isn't enough.
>
>
> > I do modify what should be changed and build the project without
> > error. I define an "ofstream" object "output" by ofstream
> > output("C:\\out.dat"); and run the program, but no out.dat formed.
>
> *Where* do you create the file? What is the *exact* code you are using
> to create it and write the data? What is the scene file you are testing
> it with?
>
> --
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The exact code I write in reflect() function:
/***************************************************************************
*
* lighting.cpp
*
......
#include <algorithm>
#include <fstream>
using namespace std;
......
static void Reflect(......)
{
ofstream output("D:\\out.dat");
......
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> In article <3da9eae1@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu>
> wrote:
>
> > Thank you for your reply. Yes, I think that the reflect() will be called
> > when I run the program. Why this is not right?
>
> The Reflect() function will only be called when POV is computing
> reflection. Just running the program won't do that, you need to render a
> scene with reflection. This is so obvious I can't believe you would be
> doing otherwise, but you haven't given any indication of what exactly
> you are doing other than "running the program", which isn't enough.
>
>
> > I do modify what should be changed and build the project without
> > error. I define an "ofstream" object "output" by ofstream
> > output("C:\\out.dat"); and run the program, but no out.dat formed.
>
> *Where* do you create the file? What is the *exact* code you are using
> to create it and write the data? What is the scene file you are testing
> it with?
>
> --
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wu Yang <wya### [at] cswrightedu> wrote:
> static void Reflect(......)
> {
> ofstream output("D:\\out.dat");
> ......
This is not an answer to your question per se, but do you think that's
the best way to go?
If you open the file for writing each time Reflect() is called, this
is not only inefficient (a system call for opening a file for writing can
be quite slow if done lots and lots of times) but you will also be destroying
any previous data which existed in the file (by default ofstream opens
the file for writing, not for appending, ie. if the file existed already,
it's clamped to 0 size).
You should only open the file once in some initialization routine, not
every time Reflect() is called.
And by the way, it's a good idea to check if opening the file succeeded.
Don't take the success for granted.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Yes, I got it. Thank you very much. But I do not know why "box.pov" is
not a scene with reflection. I do see it. Why can I see it? The data for
displaying is what I want to get. Is it called light internsity?
Actually, the code I post is the only code I wrote till now. I only want
to test if the reflect() function is called when I rend some pov file. Thank
you for your advice.
Best Regard
Wu Yang
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Yes, you are right.
Thanks a lot
Best Regard
Wu Yang
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3daa5e12@news.povray.org...
> Wu Yang <wya### [at] cswrightedu> wrote:
> > static void Reflect(......)
> > {
> > ofstream output("D:\\out.dat");
> > ......
>
> This is not an answer to your question per se, but do you think that's
> the best way to go?
> If you open the file for writing each time Reflect() is called, this
> is not only inefficient (a system call for opening a file for writing can
> be quite slow if done lots and lots of times) but you will also be
destroying
> any previous data which existed in the file (by default ofstream opens
> the file for writing, not for appending, ie. if the file existed already,
> it's clamped to 0 size).
> You should only open the file once in some initialization routine, not
> every time Reflect() is called.
>
> And by the way, it's a good idea to check if opening the file succeeded.
> Don't take the success for granted.
>
> --
> #macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb
x]
> [1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
> -1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// -
Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|