POV-Ray : Newsgroups : povray.programming : view.cpp StartRender function and camera parameters Server Time
28 Mar 2024 17:48:32 EDT (-0400)
  view.cpp StartRender function and camera parameters (Message 1 to 3 of 3)  
From: handos
Subject: view.cpp StartRender function and camera parameters
Date: 11 Jul 2011 14:25:00
Message: <web.4e1b3f40fb967206d7ae32040@news.povray.org>
Hi everyone,

I wanted to obtain depth-map from POVRay 3.7 and I figured out that I could get
the output from TraceRay function defined in (trace.cpp) and store it in array
and then write it into a file. I was doing it very conveniently after the
renderTask.AppendTask( new TraceTask(..)) function call defined in view.cpp's
StartRender() function. However when the image takes a bit longer time to
render, the function returns from StartRender() while already running the
threads in TraceTask. I tried to go through the code to understand at what point
can I write the depth-map array but I totally got confused with backend frontend
thing. If it's not very difficult to figure out could anyone please tell me
where exactly can I write the depth-array (already stored) into a file at which
point where all threads have finished.

Also, I'd like to write the camera parameters into a file too, once you specify
the parameters into the camera{ } object in povray file, where exactly it
applies all the various transformation defined within the camera{} Object and
latches the final camera_position, camera_up and camera_direction? As an
instructive example

camera{
location <x,y,z>
direction <a,b,c>
up <ux,uy,uz>
matrix <    val00,    val01,  val02,
   val10,   val11,    val12,
   val20,   val21,    val22,
   val30,   val31, val32>
};

After applying the necessary transformation, where exactly does it store the
final direction, up vector and position vector in the code?


Many Thanks,
Ankur.


Post a reply to this message

From: Le Forgeron
Subject: Re: view.cpp StartRender function and camera parameters
Date: 11 Jul 2011 15:09:05
Message: <4e1b4a51$1@news.povray.org>
Le 11/07/2011 20:21, handos nous fit lire :
> Hi everyone,
> 
> I wanted to obtain depth-map from POVRay 3.7 and I figured out that I could get
> the output from TraceRay function defined in (trace.cpp) and store it in array
> and then write it into a file. I was doing it very conveniently after the
> renderTask.AppendTask( new TraceTask(..)) function call defined in view.cpp's
> StartRender() function. However when the image takes a bit longer time to
> render, the function returns from StartRender() while already running the
> threads in TraceTask. I tried to go through the code to understand at what point
> can I write the depth-map array but I totally got confused with backend frontend
> thing. If it's not very difficult to figure out could anyone please tell me
> where exactly can I write the depth-array (already stored) into a file at which
> point where all threads have finished.

Find the moment the metadata are written in the output image.
Who call Image::Write in base/image/image.cpp ?
(hint, it's in ImageProcessing::WriteImage, in frontend/imageprocessing.cpp)

> 
> Also, I'd like to write the camera parameters into a file too, once you specify
> the parameters into the camera{ } object in povray file, where exactly it
> applies all the various transformation defined within the camera{} Object and
> latches the final camera_position, camera_up and camera_direction? As an
> instructive example
> 
> camera{
> location <x,y,z>
> direction <a,b,c>
> up <ux,uy,uz>
> matrix <    val00,    val01,  val02,
>    val10,   val11,    val12,
>    val20,   val21,    val22,
>    val30,   val31, val32>
> };
> 
> After applying the necessary transformation, where exactly does it store the
> final direction, up vector and position vector in the code?

I have that information (used for a camera_... access patch, not in 3.7)
The main trick is that you might have one (usual) camera, or more
cameras (for a special mode of rendering: same scene, many camera)

So, it's either sceneData->parsedCamera or sceneData->cameras[idx]
+ .Location,
+ .Direction,
+ .Right,
+ .Up

I guess you can match the ends.


Post a reply to this message

From: handos
Subject: Re: view.cpp StartRender function and camera parameters
Date: 18 Jul 2011 07:05:01
Message: <web.4e241230ceee750ad7ae32040@news.povray.org>
Thanks Le!

I just posted the message in the other group and your advice was quite helpful
in tracing down the variables I needed to dump camera parameters!

Thanks a lot!
Ankur.

Le_Forgeron <jgr### [at] freefr> wrote:
> Le 11/07/2011 20:21, handos nous fit lire :
> > Hi everyone,
> >
> > I wanted to obtain depth-map from POVRay 3.7 and I figured out that I could get
> > the output from TraceRay function defined in (trace.cpp) and store it in array
> > and then write it into a file. I was doing it very conveniently after the
> > renderTask.AppendTask( new TraceTask(..)) function call defined in view.cpp's
> > StartRender() function. However when the image takes a bit longer time to
> > render, the function returns from StartRender() while already running the
> > threads in TraceTask. I tried to go through the code to understand at what point
> > can I write the depth-map array but I totally got confused with backend frontend
> > thing. If it's not very difficult to figure out could anyone please tell me
> > where exactly can I write the depth-array (already stored) into a file at which
> > point where all threads have finished.
>
> Find the moment the metadata are written in the output image.
> Who call Image::Write in base/image/image.cpp ?
> (hint, it's in ImageProcessing::WriteImage, in frontend/imageprocessing.cpp)
>
> >
> > Also, I'd like to write the camera parameters into a file too, once you specify
> > the parameters into the camera{ } object in povray file, where exactly it
> > applies all the various transformation defined within the camera{} Object and
> > latches the final camera_position, camera_up and camera_direction? As an
> > instructive example
> >
> > camera{
> > location <x,y,z>
> > direction <a,b,c>
> > up <ux,uy,uz>
> > matrix <    val00,    val01,  val02,
> >    val10,   val11,    val12,
> >    val20,   val21,    val22,
> >    val30,   val31, val32>
> > };
> >
> > After applying the necessary transformation, where exactly does it store the
> > final direction, up vector and position vector in the code?
>
> I have that information (used for a camera_... access patch, not in 3.7)
> The main trick is that you might have one (usual) camera, or more
> cameras (for a special mode of rendering: same scene, many camera)
>
> So, it's either sceneData->parsedCamera or sceneData->cameras[idx]
> + .Location,
> + .Direction,
> + .Right,
> + .Up
>
> I guess you can match the ends.


Post a reply to this message

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