









 
 




 
 


I would like extract the coordinates (X, Y, Z) of all the intersection points in
the image. It seems the megapov function PP_Init_IPoint_Outputs can do this job.
However I tried the following code. I can not get the results expected. I can
only get the rendered image but not the coordinate information. How could I set
the filename and folder to export the results? Thanks for your help.
Shouyang
#version unofficial MegaPov 1.1;
#include "pprocess.inc"
PP_Init_IPoint_Outputs()
#declare Camera_Location = <4,7,4>;
#declare Camera_Lookat = <10,10,10>;
light_source {< 0, 0, 100> color rgb<1,1,1>}
camera { perspective
location Camera_Location
look_at Camera_Lookat
direction z
angle 20
}
// 
union {
sphere {0,1}
sphere {<2,0,2>,1}
sphere {< 5,0, 5>,1}
sphere {<10,0,10>,1}
box {10,10}}
Post a reply to this message


 
 




 
 


"muyu" <lsy### [at] gmailcom> wrote:
> I would like extract the coordinates (X, Y, Z) of all the intersection points in
> the image. It seems the megapov function PP_Init_IPoint_Outputs can do this job.
> However I tried the following code. I can not get the results expected. I can
> only get the rendered image but not the coordinate information. How could I set
> the filename and folder to export the results? Thanks for your help.
>
> Shouyang
>
> #version unofficial MegaPov 1.1;
>
> #include "pprocess.inc"
> PP_Init_IPoint_Outputs()
>
> #declare Camera_Location = <4,7,4>;
> #declare Camera_Lookat = <10,10,10>;
>
> light_source {< 0, 0, 100> color rgb<1,1,1>}
>
>
> camera { perspective
> location Camera_Location
> look_at Camera_Lookat
> direction z
> angle 20
> }
>
> // 
> union {
> sphere {0,1}
> sphere {<2,0,2>,1}
> sphere {< 5,0, 5>,1}
> sphere {<10,0,10>,1}
> box {10,10}}
Does anyone has idea of this？ Or is it possible to extract these
information using Povray directly rather than Megapov? Thanks again.
SY
Post a reply to this message


 
 




 
 


Le 10/02/2019 Ã 14:47, muyu a Ã©critÂ :
> "muyu" <lsy### [at] gmailcom> wrote:
>> I would like extract the coordinates (X, Y, Z) of all the intersection points in
>> the image. It seems the megapov function PP_Init_IPoint_Outputs can do this job.
>> However I tried the following code. I can not get the results expected. I can
>> only get the rendered image but not the coordinate information. How could I set
>> the filename and folder to export the results? Thanks for your help.
>>
>> Shouyang
>>
>> #version unofficial MegaPov 1.1;
>>
>> #include "pprocess.inc"
>> PP_Init_IPoint_Outputs()
>>
>> #declare Camera_Location = <4,7,4>;
>> #declare Camera_Lookat = <10,10,10>;
>>
>> light_source {< 0, 0, 100> color rgb<1,1,1>}
>>
>>
>> camera { perspective
>> location Camera_Location
>> look_at Camera_Lookat
>> direction z
>> angle 20
>> }
>>
>> // 
>> union {
>> sphere {0,1}
>> sphere {<2,0,2>,1}
>> sphere {< 5,0, 5>,1}
>> sphere {<10,0,10>,1}
>> box {10,10}}
>
I do not see the "post_process { PP_Depth(Field_Start,Field_Depth) }"
directive.
(from the documentation of megapov 1.2, part 3.5.1.4)
Starting the storage of depth is one thing, having a use for them is
another.
> Does anyone has idea of this？ Or is it possible to extract these
> information using Povray directly rather than Megapov? Thanks again.
> SY
>
>
Post a reply to this message


 
 




 
 


"muyu" <lsy### [at] gmailcom> wrote:
> I would like extract the coordinates (X, Y, Z) of all the intersection points in
> the image.
First of all, I probably asked a very similar question years ago  and
essentially POVRay is a raytracer  a piece of software to create pictures.
It's not a mathematical analysis program, though since the images are
{primarily} created via code, you can perform whatever math is necessary to do
what you need.
Second, since 3 of the spheres are completely contained in the box, and one is
halfway in, you have an infinite number of intersection points between the
spheres and the box.
"ALL of the points!"
Third, since you're only using simple primitives, you can use algebra to
calculate the set of points satisfying the equations of a sphere and the region
enclosed by the box.
Fourth, if you want a list of points for a general case, you're probably going
to have to define how fine a granulation you want, and then probably use trace()
to scan the region across the seam and interpolate where it switches from one
object to the other.
Perhaps you can post an image in the binary section showing what you want and
explaining a bit more clearly and in greater detail.
Then we might be able to suggest a viable solution.
> // 
> union {
> sphere {0,1}
> sphere {<2,0,2>,1}
> sphere {< 5,0, 5>,1}
> sphere {<10,0,10>,1}
> box {10,10}}
I used this to see what the arrangement of objects was:
#version 3.8
#include "colors.inc"
#declare Camera_Location = <10, 0,50>;
#declare Camera_Lookat = <10, 0, 0>;
light_source {< 0, 0, 100> color rgb<1,1,1>}
camera { perspective
location Camera_Location
look_at Camera_Lookat
direction z
}
// 
union {
sphere {0,1 pigment {Red}}
sphere {<2,0,2>,1 pigment {Yellow}}
sphere {< 5,0, 5>,1 pigment {Green}}
sphere {<10,0,10>,1 pigment {Blue}}
box {10,10 pigment {rgbt <1, 1, 1, 0.9>}}
}
Post a reply to this message


 
 




 
 


"Bald Eagle" <cre### [at] netscapenet> wrote:
> "muyu" <lsy### [at] gmailcom> wrote:
> > I would like extract the coordinates (X, Y, Z) of all the intersection points in
> > the image.
>
> First of all, I probably asked a very similar question years ago  and
> essentially POVRay is a raytracer  a piece of software to create pictures.
> It's not a mathematical analysis program, though since the images are
> {primarily} created via code, you can perform whatever math is necessary to do
> what you need.
>
> Second, since 3 of the spheres are completely contained in the box, and one is
> halfway in, you have an infinite number of intersection points between the
> spheres and the box.
>
> "ALL of the points!"
>
> Third, since you're only using simple primitives, you can use algebra to
> calculate the set of points satisfying the equations of a sphere and the region
> enclosed by the box.
>
> Fourth, if you want a list of points for a general case, you're probably going
> to have to define how fine a granulation you want, and then probably use trace()
> to scan the region across the seam and interpolate where it switches from one
> object to the other.
>
>
> Perhaps you can post an image in the binary section showing what you want and
> explaining a bit more clearly and in greater detail.
> Then we might be able to suggest a viable solution.
>
> > // 
> > union {
> > sphere {0,1}
> > sphere {<2,0,2>,1}
> > sphere {< 5,0, 5>,1}
> > sphere {<10,0,10>,1}
> > box {10,10}}
>
>
> I used this to see what the arrangement of objects was:
>
> #version 3.8
>
> #include "colors.inc"
> #declare Camera_Location = <10, 0,50>;
> #declare Camera_Lookat = <10, 0, 0>;
>
> light_source {< 0, 0, 100> color rgb<1,1,1>}
>
>
> camera { perspective
> location Camera_Location
> look_at Camera_Lookat
> direction z
> }
>
> // 
> union {
> sphere {0,1 pigment {Red}}
> sphere {<2,0,2>,1 pigment {Yellow}}
> sphere {< 5,0, 5>,1 pigment {Green}}
> sphere {<10,0,10>,1 pigment {Blue}}
> box {10,10 pigment {rgbt <1, 1, 1, 0.9>}}
> }
Thanks. Probably I didn't explain myself clearly enough. I would like to get the
coordinates of the each pixel in the rendered image, corresponding to the
shortest interaction point (the average over certain resolution). The code I put
is just a rush example. Sorry for the confusing.
Sure the coordinate information is calculated in the tracing process. I found
the function in Megapov to export this information (as far as I understood).
However, I did not manage to use it sucessfully. Could you pleae show me how to
use it or else the macro trace() in Povray can do similar job? It would be great
if you can provide a demo code. Thanks again.
PS: I cannot always login this website successfully (from France). Probably the
manager could help to check that. Merci.
Best
Shouyang
Post a reply to this message


 
 




 
 


"muyu" <lsy### [at] gmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > "muyu" <lsy### [at] gmailcom> wrote:
> > > I would like extract the coordinates (X, Y, Z) of all the intersection points in
> > > the image.
[Here's my newbie woeful misunderstanding thread:
http://news.povray.org/povray.general/thread/%3C520fb859%241%40news.povray.org%3E/
]
I would like to get the
coordinates of the each pixel in the rendered image, corresponding to the
shortest interaction point
"Shortest interaction point" ...
Like, the point on the surface of the sphere that is closest to one of the
planes of the box...?
I tend to use code from Graphics Gems for that sort of thing,
http://www.realtimerendering.com/resources/GraphicsGems/category.html
I used some of that here:
http://news.povray.org/povray.binaries.images/thread/%3Cweb.587ce3fc782d1af2c437ac910%40news.povray.org%3E/?mtop=415328
Here's a thing on trace() that I did around 5 years ago:
http://news.povray.org/povray.binaries.tutorials/thread/%3Cweb.51f61e827603294573fc9ebb0%40news.povray.org%3E/
plus there is some explanation in the documentation and the wiki
http://wiki.povray.org/content/Documentation:Tutorial_Section_3.9#Calculating_the_closest_intersection
Here's the entry from the "[F1] Help"
trace(OBJECT_IDENTIFIER, A, B, [VECTOR_IDENTIFIER]). trace helps you finding the
exact location of a ray intersecting with an object's surface. It traces a ray
beginning at the point A in the direction specified by the vector B. If the ray
hits the specified object, this function returns the coordinate where the ray
intersected the object. If not, it returns <0,0,0>. If a fourth parameter in the
form of a vector identifier is provided, the normal of the object at the
intersection point (not including any normal perturbations due to textures) is
stored into that vector. If no intersection was found, the normal vector is
reset to <0,0,0>.
Note: Checking the normal vector for <0,0,0> is the only reliable way to
determine whether an intersection has actually occurred, intersections can and
do occur anywhere, including at <0,0,0>.
Example:
#declare MySphere = sphere { <0, 0, 0>, 1 }
#declare Norm = <0, 0, 0>;
#declare Start = <1, 1, 1>;
#declare Inter=
trace ( MySphere, Start, <0, 0, 0>Start, Norm );
object {
MySphere
texture {
pigment { rgb 1}
}
}
#if (vlength(Norm)!=0)
cylinder {
Inter, Inter+Norm, .1
texture {
pigment {color red 1}
}
}
#end
Post a reply to this message


 
 




 
 


in news:web.5c6080c4912c710e873735650@news.povray.org muyu wrote:
> Sure the coordinate information is calculated in the tracing process.
Shouyang,
The data on a lot of things that POVRay does are (sadly) not available in
any form.
But, just thinking loud, you know the camera position, you know, or can
deduce, the camera's horizontal and vertical view angle. This gives you
the direction of the ray that is shot from camera to the scene.
Plus you can give your whole scene a gradient in the depth direction
(depth map). From these data a mathematical mind (pas mois) could deduce
the information you're looking for,
A+,
ingo
Post a reply to this message


 
 




 

