POV-Ray : Newsgroups : povray.newusers : z-buffer or depth buffer : Re: z-buffer or depth buffer Server Time
29 Jul 2024 02:25:44 EDT (-0400)
  Re: z-buffer or depth buffer  
From: CAS
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.