POV-Ray : Newsgroups : povray.newusers : z-buffer or depth buffer Server Time
29 Jul 2024 04:18:06 EDT (-0400)
  z-buffer or depth buffer (Message 1 to 7 of 7)  
From: liuyang
Subject: z-buffer or depth buffer
Date: 15 Feb 2007 05:15:00
Message: <web.45d432051548a38bac5b49030@news.povray.org>
I need the distance of each pixel to the camera in the rendered scene. Is
there a way to get it in Pov ray? I am doing an experiment to study the
relationship between luminance and distance in natural or simulated world,
so it is really important to know the exact distance and pixel
relationship. Does the z buffer or depth buffer give me this information?


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: z-buffer or depth buffer
Date: 15 Feb 2007 05:32:24
Message: <45d436b8$1@news.povray.org>
liuyang wrote:
> I need the distance of each pixel to the camera in the rendered scene. Is
> there a way to get it in Pov ray? I am doing an experiment to study the
> relationship between luminance and distance in natural or simulated world,
> so it is really important to know the exact distance and pixel
> relationship. Does the z buffer or depth buffer give me this information?

Yes it does give you this information, but POV-Ray does not use either
because it is a ray-tracer. The same information is still computed, of
course, but you would need to modify POV-Ray to extract this information for
each pixel.

	Thorsten


Post a reply to this message

From: liuyang
Subject: Re: z-buffer or depth buffer
Date: 15 Feb 2007 05:55:00
Message: <web.45d43adb87ff3c95ac5b49030@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> liuyang wrote:
> > I need the distance of each pixel to the camera in the rendered scene. Is
> > there a way to get it in Pov ray? I am doing an experiment to study the
> > relationship between luminance and distance in natural or simulated world,
> > so it is really important to know the exact distance and pixel
> > relationship. Does the z buffer or depth buffer give me this information?
>
> Yes it does give you this information, but POV-Ray does not use either
> because it is a ray-tracer. The same information is still computed, of
> course, but you would need to modify POV-Ray to extract this information for
> each pixel.
>
>  Thorsten

Thanks, but how to modify Pov-Ray to get it?

Yang


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: z-buffer or depth buffer
Date: 15 Feb 2007 07:52:17
Message: <45d45781$1@news.povray.org>
liuyang wrote:
> Thorsten Froehlich <tho### [at] trfde> wrote:
>> liuyang wrote:
>>> I need the distance of each pixel to the camera in the rendered scene. Is
>>> there a way to get it in Pov ray? I am doing an experiment to study the
>>> relationship between luminance and distance in natural or simulated world,
>>> so it is really important to know the exact distance and pixel
>>> relationship. Does the z buffer or depth buffer give me this information?
>> Yes it does give you this information, but POV-Ray does not use either
>> because it is a ray-tracer. The same information is still computed, of
>> course, but you would need to modify POV-Ray to extract this information for
>> each pixel.
>>
>>  Thorsten
> 
> Thanks, but how to modify Pov-Ray to get it?

Function trace_pixel in render.cpp is the highest level function in which
this information is still available (it is returned by Trace_Primary_Ray,
and currently not used). I would print it to a file there as quick and easy
solution. Something universally usable will be a lot more work though.

	Thorsten


Post a reply to this message

From: Trevor G Quayle
Subject: Re: z-buffer or depth buffer
Date: 15 Feb 2007 08:25:00
Message: <web.45d45f1d87ff3c95c150d4c10@news.povray.org>
"liuyang" <liu### [at] gmailcom> wrote:
> Thorsten Froehlich <tho### [at] trfde> wrote:
> > liuyang wrote:
> > > I need the distance of each pixel to the camera in the rendered scene. Is
> > > there a way to get it in Pov ray? I am doing an experiment to study the
> > > relationship between luminance and distance in natural or simulated world,
> > > so it is really important to know the exact distance and pixel
> > > relationship. Does the z buffer or depth buffer give me this information?
> >
> > Yes it does give you this information, but POV-Ray does not use either
> > because it is a ray-tracer. The same information is still computed, of
> > course, but you would need to modify POV-Ray to extract this information for
> > each pixel.
> >
> >  Thorsten
>
> Thanks, but how to modify Pov-Ray to get it?
>
> Yang

I believe megaPOV has some sort of ability.  One simple way to do it in POV
without a rewrite is rerender your scene with a simple gradient pattern
applied globally to all your objects oriented along the viewing vector.
You can then cross-reference this with the regular render.

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: z-buffer or depth buffer
Date: 15 Feb 2007 08:35:00
Message: <web.45d4613d87ff3c95c150d4c10@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> I believe megaPOV has some sort of ability.

http://megapov.inetart.net/manual-1.2.1/megapov0121.html#post_processing

Yes, megaPOV has something as part of its post-processing functions.  Look
at f_output_depth(x,y) in particular.  I'm not sure how to use it, as I
have not tried the PP options yet, but there are demo files that may help.


-tgq


Post a reply to this message

From: CAS
Subject: Re: z-buffer or depth buffer
Date: 13 Apr 2014 21:15:01
Message: <web.534b35bf87ff3c956a92a3a00@news.povray.org>
"liuyang" <liu### [at] gmailcom> wrote:
> I need the distance of each pixel to the camera in the rendered scene. Is
> there a way to get it in Pov ray? I am doing an experiment to study the
> relationship between luminance and distance in natural or simulated world,
> so it is really important to know the exact distance and pixel
> relationship. Does the z buffer or depth buffer give me this information?

hey,my name is miaoyu,I am a student.I am doing an experiment to study the
luminance of each final pixel.I confronted some confusions:
1,I set the output file is openexr.I know the value of each pixel is luminance.I
know the value of standard solar irradiance in 700nm  is 1.42666,then I use the
conversion coefficient between them .That is,I converted irradiance to
illumiance as my lightsource input,in this way,did I set right?
2,my whole code in pov is as below:my goal is get luminance of pixels,can you
help me to check whether I am right?Thank you,beg a hot!

#version 3.7;
global_settings{ assumed_gamma 1.0 }
#include "spectral.inc"
#declare SpectralWavelength =700;

#declare camera_za=0;
#declare camera_aa=0;
#declare camera_h=4267.2;
#declare camera_dist=4267.2+435;

#declare camera_y = camera_dist*cos(radians(camera_za));
#declare camera_LL = camera_dist*sin(radians(camera_za));
#declare camera_x = camera_LL*sin(radians(camera_aa));
#declare camera_z = camera_LL*cos(radians(camera_aa));

camera
{
angle  7.54371
location <camera_x,camera_y,camera_z >
look_at <0,0,0>
rotate <0,-31,0>
right x
up y
}

#declare sun_za = 31.65;
#declare sun_aa = 187.89;
#declare sun_dist = 152589828000;

#declare sun_y = sun_dist*cos(radians(sun_za));
#declare sun_LL = sun_dist*sin(radians(sun_za));
#declare sun_x = sun_LL*sin(radians(sun_aa));
#declare sun_z = sun_LL*cos(radians(sun_aa));

light_source {<sun_x,sun_y,sun_z>
             SpectralEmission(3.99750132)
             }

#declare geom_file_name = "pov-xyz.txt";
#declare spec_file_name = "pov-ref.txt";
#declare max_x=689768.244495;
#declare max_y=0.000000;
#declare max_z=5200554.798986;
#fopen   Input_geom_file geom_file_name read
#while(defined(Input_geom_file))
    #read(Input_geom_file,x1,y1,z1,x2,y2,z2,x3,y3,z3)
    #if(x1>max_x)
        #declare max_x = x1;
    #end
    #if(x2>max_x)
        #declare max_x = x2;
    #end
    #if(x3>max_x)
        #declare max_x = x3;
    #end
    #if(y1>max_y)
        #declare max_y = y1;
    #end
    #if(y2>max_y)
        #declare max_y = y2;
    #end
    #if(y3>max_y)
        #declare max_y = y3;
    #end
    #if(z1>max_z)
        #declare max_z = z1;
    #end
    #if(z2>max_z)
        #declare max_z = z2;
    #end
    #if(z3>max_z)
        #declare max_z = z3;
    #end

#end
#debug concat(str(max_x,15,2),str(max_y,15,2),str(max_z,15,2),"\n")

// find min_x,min_y,min_z
#declare min_x=688921.731000;
#declare min_y=0.000000;
#declare min_z=5199708.285491;
#fopen   Input_geom_file geom_file_name read
#while(defined(Input_geom_file))
    #read(Input_geom_file,x1,y1,z1,x2,y2,z2,x3,y3,z3)
    #if(x1<min_x)
        #declare min_x = x1;
    #end
    #if(x2<min_x)
        #declare min_x = x2;
    #end
    #if(x3<min_x)
        #declare min_x = x3;
    #end
    #if(y1<min_y)
        #declare min_y = y1;
    #end
    #if(y2<min_y)
        #declare min_y = y2;
    #end
    #if(y3<min_y)
        #declare min_y = y3;
    #end
    #if(z1<min_z)
        #declare min_z = z1;
    #end
    #if(z2<min_z)
        #declare min_z = z2;
    #end
    #if(z3<min_z)
        #declare min_z = z3;
    #end
#end
#debug concat(str(min_x,15,2),str(min_y,15,2),str(min_z,15,2),"\n")

// find the center of the geometry
#declare center_x = (min_x+max_x)*0.5;
#declare center_y = (min_y+max_y)*0.5;
#declare center_z = (min_z+max_z)*0.5;
#debug concat(str(center_x,15,2),str(center_y,15,2),str(center_z,15,2),"\n\n")

#declare n = 0;
#fopen   Input_geom_file geom_file_name read
#fopen   Input_spec_file spec_file_name read
#while(defined(Input_geom_file))

    #read(Input_geom_file,x1,y1,z1)
    #read(Input_spec_file,ref)

         sphere
        {

      <x1-center_x,y1-center_y,z1-center_z>,
         1.55
           finish {
                 ambient 0
                 emission 0
                 specular ref
                   }
          }

    #declare n = n + 1;
#end
#debug concat(str(n,15,2),"\n")


Post a reply to this message

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