POV-Ray : Newsgroups : povray.advanced-users : How to filter the points that cannot be seen from the result image? Server Time
31 Oct 2024 20:11:42 EDT (-0400)
  How to filter the points that cannot be seen from the result image? (Message 1 to 4 of 4)  
From: 355890577
Subject: How to filter the points that cannot be seen from the result image?
Date: 19 Jun 2013 05:00:01
Message: <web.51c1720ca04efd23e6ccd8f40@news.povray.org>
Here is the pov code which is pretty simle:

global_settings { assumed_gamma 2.2 }

camera {
 location  <0,0,10>
 direction <0.0,  0.0,  1.5>
 up        <0.0,  1.0,  0>
 right     <-1,  0.0,  0>
 look_at   <0,    0,   0>
}


object {
 light_source {
  <0,0,10>
  color red 1 green 1 blue 1
 }
 rotate -40*x
}

object{
 union{
  #include "toutatis.inc"

 }
 rotate <-90,0,0>
 texture {
  pigment {color rgb <1,0.9,0.8>}
  finish {specular 0.2 roughness 0.4 ambient 0.0}
  normal{wrinkles 0.2 scale 0.1 }
 }

        rotate< 0, 30 ,0  >

}


And the code in "toutatis.inc" consists thousands of smooth triangles like this:

........
smooth_triangle {
 <-0.335299,0.862002,-0.125620>, <-0.044123,0.968563,0.244823>,
 <-0.367860,0.871280,-0.165495>, <-0.114765,0.953897,0.277325>,
 <-0.353680,0.852539,-0.087856>, <-0.054713,0.972332,0.227105> }
smooth_triangle {
 <-1.088397,0.161391,-0.503175>, <-0.981229,-0.054861,-0.184877>,
 <-1.066395,0.159457,-0.600327>, <-0.968122,-0.088312,-0.234393>,
 <-1.069069,0.079726,-0.559682>, <-0.982928,-0.037642,-0.180097> }
smooth_triangle {
 <-0.733415,-0.649272,-0.710871>, <-0.754510,-0.650190,0.089262>,
 <-0.696555,-0.687316,-0.702565>, <-0.634403,-0.764153,0.116632>,
 <-0.731962,-0.635080,-0.638776>, <-0.722088,-0.672899,0.160609> }
........

I want to filter the triangle or the points that cannot be seen from the result
image, to get a set of point that is needed for the later job.

one possible way that i can imagine is that
do the mathmatics, draw lines from the lightsource to the edge of the object and
compute the points that are under the light,
but it is too complex for me

is there any other possible ways for this question?
thank you !


Post a reply to this message

From: Alain
Subject: Re: How to filter the points that cannot be seen from the result image?
Date: 19 Jun 2013 15:57:37
Message: <51c20d31@news.povray.org>

> Here is the pov code which is pretty simle:
>
> global_settings { assumed_gamma 2.2 }
>
> camera {
>   location  <0,0,10>
>   direction <0.0,  0.0,  1.5>
>   up        <0.0,  1.0,  0>
>   right     <-1,  0.0,  0>
>   look_at   <0,    0,   0>
> }
>
>
> object {
>   light_source {
>    <0,0,10>
>    color red 1 green 1 blue 1
>   }
>   rotate -40*x
> }
>
> object{
>   union{
>    #include "toutatis.inc"
>
>   }
>   rotate <-90,0,0>
>   texture {
>    pigment {color rgb <1,0.9,0.8>}
>    finish {specular 0.2 roughness 0.4 ambient 0.0}
>    normal{wrinkles 0.2 scale 0.1 }
>   }
>
>          rotate< 0, 30 ,0  >
>
> }
>
>
> And the code in "toutatis.inc" consists thousands of smooth triangles like this:
>
> ........
> smooth_triangle {
>   <-0.335299,0.862002,-0.125620>, <-0.044123,0.968563,0.244823>,
>   <-0.367860,0.871280,-0.165495>, <-0.114765,0.953897,0.277325>,
>   <-0.353680,0.852539,-0.087856>, <-0.054713,0.972332,0.227105> }
> smooth_triangle {
>   <-1.088397,0.161391,-0.503175>, <-0.981229,-0.054861,-0.184877>,
>   <-1.066395,0.159457,-0.600327>, <-0.968122,-0.088312,-0.234393>,
>   <-1.069069,0.079726,-0.559682>, <-0.982928,-0.037642,-0.180097> }
> smooth_triangle {
>   <-0.733415,-0.649272,-0.710871>, <-0.754510,-0.650190,0.089262>,
>   <-0.696555,-0.687316,-0.702565>, <-0.634403,-0.764153,0.116632>,
>   <-0.731962,-0.635080,-0.638776>, <-0.722088,-0.672899,0.160609> }
> ........
>
> I want to filter the triangle or the points that cannot be seen from the result
> image, to get a set of point that is needed for the later job.
>
> one possible way that i can imagine is that
> do the mathmatics, draw lines from the lightsource to the edge of the object and
> compute the points that are under the light,
> but it is too complex for me
>
> is there any other possible ways for this question?
> thank you !
>
>
>

The origin of your test should be the camera, not the light source. In 
this case, they are the same, but it's not always the case.

Next, what points do you realy want to remove?
Those that are outside the feild of view, or those that are masked from 
view by intervening surfaces?

For the first case, make a pyramid with it's summit at the camera's 
location with a base having the same proportions as the field of view 
and sized to match the actual field of view and large enough to contain 
the object. Next, perform insideness tests on your points. Any point 
outside that pyramid are out of view.

For the second case, you may use the trace function starting from the 
camera location toward the object.
You'll need to use some trigonometry to compute the trace direction. If 
the trace return the coordinates of the tested point, the point is 
visible. If the returned coordinates are different, it mean that it 
encountered some other surface before reatching the tested point.

If you use an orthographic camera, you always use the same trace 
direction and change the trace origin X and Y location to match the X 
and Y coordinates ot the tested points.



Alain


Post a reply to this message

From: 355890577
Subject: Re: How to filter the points that cannot be seen from the result image?
Date: 19 Jun 2013 23:00:01
Message: <web.51c26f2a5b9883b947f8c4c20@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> > Here is the pov code which is pretty simle:
> >
> > global_settings { assumed_gamma 2.2 }
> >
> > camera {
> >   location  <0,0,10>
> >   direction <0.0,  0.0,  1.5>
> >   up        <0.0,  1.0,  0>
> >   right     <-1,  0.0,  0>
> >   look_at   <0,    0,   0>
> > }
> >
> >
> > object {
> >   light_source {
> >    <0,0,10>
> >    color red 1 green 1 blue 1
> >   }
> >   rotate -40*x
> > }
> >
> > object{
> >   union{
> >    #include "toutatis.inc"
> >
> >   }
> >   rotate <-90,0,0>
> >   texture {
> >    pigment {color rgb <1,0.9,0.8>}
> >    finish {specular 0.2 roughness 0.4 ambient 0.0}
> >    normal{wrinkles 0.2 scale 0.1 }
> >   }
> >
> >          rotate< 0, 30 ,0  >
> >
> > }
> >
> >
> > And the code in "toutatis.inc" consists thousands of smooth triangles like this:
> >
> > ........
> > smooth_triangle {
> >   <-0.335299,0.862002,-0.125620>, <-0.044123,0.968563,0.244823>,
> >   <-0.367860,0.871280,-0.165495>, <-0.114765,0.953897,0.277325>,
> >   <-0.353680,0.852539,-0.087856>, <-0.054713,0.972332,0.227105> }
> > smooth_triangle {
> >   <-1.088397,0.161391,-0.503175>, <-0.981229,-0.054861,-0.184877>,
> >   <-1.066395,0.159457,-0.600327>, <-0.968122,-0.088312,-0.234393>,
> >   <-1.069069,0.079726,-0.559682>, <-0.982928,-0.037642,-0.180097> }
> > smooth_triangle {
> >   <-0.733415,-0.649272,-0.710871>, <-0.754510,-0.650190,0.089262>,
> >   <-0.696555,-0.687316,-0.702565>, <-0.634403,-0.764153,0.116632>,
> >   <-0.731962,-0.635080,-0.638776>, <-0.722088,-0.672899,0.160609> }
> > ........
> >
> > I want to filter the triangle or the points that cannot be seen from the result
> > image, to get a set of point that is needed for the later job.
> >
> > one possible way that i can imagine is that
> > do the mathmatics, draw lines from the lightsource to the edge of the object and
> > compute the points that are under the light,
> > but it is too complex for me
> >
> > is there any other possible ways for this question?
> > thank you !
> >
> >
> >
>
> The origin of your test should be the camera, not the light source. In
> this case, they are the same, but it's not always the case.
>
> Next, what points do you realy want to remove?
> Those that are outside the feild of view, or those that are masked from
> view by intervening surfaces?
>
> For the first case, make a pyramid with it's summit at the camera's
> location with a base having the same proportions as the field of view
> and sized to match the actual field of view and large enough to contain
> the object. Next, perform insideness tests on your points. Any point
> outside that pyramid are out of view.
>
> For the second case, you may use the trace function starting from the
> camera location toward the object.
> You'll need to use some trigonometry to compute the trace direction. If
> the trace return the coordinates of the tested point, the point is
> visible. If the returned coordinates are different, it mean that it
> encountered some other surface before reatching the tested point.
>
> If you use an orthographic camera, you always use the same trace
> direction and change the trace origin X and Y location to match the X
> and Y coordinates ot the tested points.
>
>
>
> Alain

Thanks a lot Alain. Sorry for my ChEnglish, hard to read.
I think what I mean is to remove the points those that are masked from
view by intervening surfaces.

Actually, the purpose for the need is to obtain an index file, which achieve a
mapping between the 2D coordinate of the result image and the 3D coordinate.
The points that cannot be seen from the image is given up, only the visible
points are in the index file.
I am wondering how to get this file, I think there's a moment before get the
result image when I can get the map, and to get the index file, but how to do
this?

So sorry for my poor know-how, and thanks again!

Simon


Post a reply to this message

From: clipka
Subject: Re: How to filter the points that cannot be seen from the result image?
Date: 15 Jul 2013 19:49:55
Message: <51e48aa3@news.povray.org>
Am 20.06.2013 04:55, schrieb 355890577:

> Actually, the purpose for the need is to obtain an index file, which achieve a
> mapping between the 2D coordinate of the result image and the 3D coordinate.
> The points that cannot be seen from the image is given up, only the visible
> points are in the index file.
> I am wondering how to get this file, I think there's a moment before get the
> result image when I can get the map, and to get the index file, but how to do
> this?

Maybe you could get something going with a mesh camera and a single 
light source placed at the camera location. Can't help you with the 
details though, as I've never toyed around with mesh cameras myself.


Post a reply to this message

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