POV-Ray : Newsgroups : povray.tools.general : Returning camera position. Server Time: 16 Dec 2018 22:38:01 GMT
  Returning camera position. (Message 1 to 8 of 8)  
From: Stephen
Subject: Returning camera position.
Date: 25 Nov 2012 16:35:53
Message: <50b248e9$1@news.povray.org>
Is there a way that I can get the current camera location passed to a 
variable?
The limitations of Bishop3D animation system makes it hard to use Rune’s 
Grasstex.inc in animations.
Bishop3D outputs a Pov file for every frame after doing its own 
calculations for location and look_at and I need to pass the camera 
location to Grasstex.inc for each frame.


-- 
Regards
     Stephen


Post a reply to this message

From: StephenS
Subject: Re: Returning camera position.
Date: 25 Nov 2012 19:10:01
Message: <web.50b26c00e3ed572d17cf88690@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> Is there a way that I can get the current camera location passed to a
> variable?
> The limitations of Bishop3D animation system makes it hard to use Rune’s
> Grasstex.inc in animations.
> Bishop3D outputs a Pov file for every frame after doing its own
> calculations for location and look_at and I need to pass the camera
> location to Grasstex.inc for each frame.
>
>
> --
> Regards
>      Stephen
With focal_blur no; without, maybe.
declare the camera output in a text string.

#declare A="
....
";
// keep under 256 characters?

parse out the elements, with text string comparison
rebuild the same camera statement

I did something similar, for doing isosurfaces based on the movement of the box
object.

A sample file would be needed before going into more detail ;-)

Stephen S


Post a reply to this message

From: Stephen
Subject: Re: Returning camera position.
Date: 25 Nov 2012 20:57:43
Message: <50b28647$1@news.povray.org>
On 25/11/2012 7:05 PM, StephenS wrote:

> With focal_blur no; without, maybe.
> declare the camera output in a text string.
>
> #declare A="
> .....
> ";
> // keep under 256 characters?
>

That is the problem. I wanted to use B3D's animation system. So the 
camera location changes in a non linear way as does the "look At" and 
FOV. To make matters worse, the initial target is is one out of more 
than 20,000 created using trace and I can't see it in the view ports. 
Since B3D will not allow a FOV less than 1.0 I had to move the camera 
closer for the initial shot then dolly out while zooming out.
I did manage to extract the camera information by exporting only the 
camera and analysing the files in Excel but when I started to render the 
animation the camera shake was horrendous. So unless someone can answer 
the question when I post it in the right forum. I think that I will go 
back to my pre-B3D days and write the animation code in a static scene.

>
> A sample file would be needed before going into more detail ;-)
>

Not a problem. Well once I clean up the code as I have been 
experimenting with Trace and #write a lot and it is very messy. I hope 
to post an animation along with an entry to TC-RTC next weekend. So 
after that, if you are still interested I will tidy it up. I would like 
someone to look at the BSP file as I am sure that I have made some bad 
mistakes. - Multiple copies of a mesh, one to trace against and one to 
render. That is not right.

BTW, I recently found a way to get a reference to a light source in a 
light group. B3D will not do it but if you force the deceleration of the 
light as well as making it visible in render. you can then declare it in 
a Raw Script within a light group.


-- 
Regards
     Stephen


Post a reply to this message

From: StephenS
Subject: Re: Returning camera position.
Date: 25 Nov 2012 21:35:00
Message: <web.50b28e99e3ed572d17cf88690@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 25/11/2012 7:05 PM, StephenS wrote:
>
> > With focal_blur no; without, maybe.
> > declare the camera output in a text string.
> >
> > #declare A="
> > .....
> > ";
> > // keep under 256 characters?
> >
>
> That is the problem. I wanted to use B3D's animation system. So the
> camera location changes in a non linear way as does the "look At" and
> FOV.
....
Camera
Box
force declare, force export; with raw script
inspect generated script


//------- C Raw Script Begin -------
#declare AA="
//------- C Raw Script End ---------

#declare C =
camera {
 perspective
 location <-4.000,6.000,-12.000>
 up y
 right 1.333*x
 angle 33.000
 sky <0.136,0.904,0.407>
 look_at < 0.000, -0.000, 0.000 >
}


//------- B Raw Script Begin -------
";
//------- B Raw Script End ---------

#declare B =
box {
 < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 0.5000000, 0.5000000 >
}

Bishop3d will update the camera statement for each file in the animation.

#local Mycount = 0;
//Find the first use of 'scale'
#while (strcmp(substr(Mystring,Mycount,5) , "scale")!=0 & Mycount !=
strlen(Mystring)-5)
  #local Mycount = Mycount+1;
#end

** example of parseing, this is for scale**

Recreate the camera statement

#declare C = camera{
perspective
location Mystring
....
}
// C is the name of the camera in
// this example that Bishop3d exports at the end of the scene file

#if (Mycount != strlen(Mystring)-5) // if scale is found in the string, then
scale the function
  #local Scale_x = val (substr(Mystring,Mycount+11,Mycomma-Mycount+11));

You now also have a variable to give to other macros.

This is not working code, and is taken from different scene files. It is only to
show, that if you can wrap the exported camera statement in quotation marks, you
can re-parse the code back into Bishop3d.

A better example can be made with time ;-)

Stephen S


Post a reply to this message

From: Stephen
Subject: Re: Returning camera position.
Date: 25 Nov 2012 22:10:06
Message: <50b2973e$1@news.povray.org>
On 25/11/2012 9:33 PM, StephenS wrote:

That is clever, it is past my bedtime as I have to get up at 5:30. So I 
will study it later.
Thanks.

Stephen

> .....
> Camera
> Box
> force declare, force export; with raw script
> inspect generated script
>
>
> //------- C Raw Script Begin -------
> #declare AA="
> //------- C Raw Script End ---------
>
> #declare C =
> camera {
>   perspective
>   location <-4.000,6.000,-12.000>
>   up y
>   right 1.333*x
>   angle 33.000
>   sky <0.136,0.904,0.407>
>   look_at < 0.000, -0.000, 0.000 >
> }
>
>
> //------- B Raw Script Begin -------
> ";
> //------- B Raw Script End ---------
>
> #declare B =
> box {
>   < -0.5000000, -0.5000000, -0.5000000 >, < 0.5000000, 0.5000000, 0.5000000 >
> }
>
> Bishop3d will update the camera statement for each file in the animation.
>
> #local Mycount = 0;
> //Find the first use of 'scale'
> #while (strcmp(substr(Mystring,Mycount,5) , "scale")!=0 & Mycount !=
> strlen(Mystring)-5)
>    #local Mycount = Mycount+1;
> #end
>
> ** example of parseing, this is for scale**
>
> Recreate the camera statement
>
> #declare C = camera{
> perspective
> location Mystring
> .....
> }
> // C is the name of the camera in
> // this example that Bishop3d exports at the end of the scene file
>
> #if (Mycount != strlen(Mystring)-5) // if scale is found in the string, then
> scale the function
>    #local Scale_x = val (substr(Mystring,Mycount+11,Mycomma-Mycount+11));
>
> You now also have a variable to give to other macros.
>
> This is not working code, and is taken from different scene files. It is only to
> show, that if you can wrap the exported camera statement in quotation marks, you
> can re-parse the code back into Bishop3d.
>
> A better example can be made with time ;-)
>
> Stephen S
>
>


-- 
Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: Returning camera position.
Date: 15 Dec 2012 16:06:09
Message: <50cc9ff1$1@news.povray.org>
On 25/11/2012 9:33 PM, StephenS wrote:

[snip]
> You now also have a variable to give to other macros.
>
> This is not working code, and is taken from different scene files. It is only to
> show, that if you can wrap the exported camera statement in quotation marks, you
> can re-parse the code back into Bishop3d.


Thanks again.
I got it working this time. IIRC you posted this or something like it on 
the B3D forums. I never got past the first error which was that the 
string size was too long. This time I reduced the indentation to zero 
and removed the comments at the braces.

I managed to parse the string and pass the value to Rune’s GrassTex macro.

I just need to clean it up.


-- 
Regards
     Stephen


Post a reply to this message

From: StephenS
Subject: Re: Returning camera position.
Date: 15 Dec 2012 22:55:01
Message: <web.50ccfeede3ed572dd85c9da80@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
....
> Thanks again.
> I got it working this time. IIRC you posted this or something like it on
> the B3D forums. I never got past the first error which was that the
> string size was too long. This time I reduced the indentation to zero
> and removed the comments at the braces.
>
> I managed to parse the string and pass the value to Rune’s GrassTex macro.
>
> I just need to clean it up.
>
>
> --
> Regards
>      Stephen

It's possible the Camera block is of fixed output length. All you would need to
do is count the steps too the part you want.

Stephen S


Post a reply to this message

From: Stephen
Subject: Re: Returning camera position.
Date: 16 Dec 2012 14:59:29
Message: <50cde1d1$1@news.povray.org>
On 15/12/2012 10:51 PM, StephenS wrote:
> It's possible the Camera block is of fixed output length. All you would need to
> do is count the steps too the part you want.

The format is always the same but if the location varies by significant 
figures then you might get a missmatch. So I found Location then the 
first instance of "<" from that position then ">" from "location". I did 
not see your use of "val" and I had to concatenate some declares then 
use Parse_String(String) to pass the values back into PovRay. A bit 
"around the houses", as is we say over here. But it works and I can find 
the value of "look_at" as well. So I don't need to use a fixed camera 
when using "screen.inc", now. :-D

-- 
Regards
     Stephen


Post a reply to this message

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