POV-Ray : Newsgroups : povray.unofficial.patches : Megapov post_process save_file format Server Time: 30 Mar 2020 14:12:37 GMT
  Megapov post_process save_file format (Message 1 to 3 of 3)  
From: ThomasR
Subject: Megapov post_process save_file format
Date: 11 Jan 2011 11:00:00
Message: <web.4d2c3703162a5787a8dd583f0@news.povray.org>
Hello everyone,

I'm using this macro :

#version unofficial MegaPov 1.21;

#macro make_depth(max_depth, min_depth, file_name)

global_settings{



        post_process {

                PP_Init_Depth_Output()



                function { (f_output_depth(x,y)-min_depth)/(max_depth-min_depth)
}

                function { (f_output_depth(x,y)-min_depth)/(max_depth-min_depth)
}

                function { (f_output_depth(x,y)-min_depth)/(max_depth-min_depth)
}

                function { 1 }



                save_file file_name



        }



}

#end

to compute the distance to first intersection.

Everything is working allright, and I get my distance as a png image, with 256
grayscale.

Problems come on the next step : 256 grayscales are not precise enough.
Is there a way to change the format in which the save_file command saves the
image ?
I tried to write the distance into a formatted txt file, which would be
acceptable, but I need to get a float from f_output_depth(x,y), and this seems
to be a vector or color expression.

If this is documented somewhere, I dont find it...

Thanks for helping

Thomas


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Megapov post_process save_file format
Date: 11 Jan 2011 19:22:13
Message: <4d2cade5@news.povray.org>
> Problems come on the next step : 256 grayscales are not precise enough.
> Is there a way to change the format in which the save_file command saves the
> image ?

I'm not so familiar with MegaPOV but you could check if
the hf_gray_16 keyword has any effect here. Otherwise, you
might consider using a gray color gradient texture instead
of depth post-processing and using regular image output.

> I tried to write the distance into a formatted txt file, which would be
> acceptable, but I need to get a float from f_output_depth(x,y), and this seems
> to be a vector or color expression.

Possibly you could output a second image where the
function is defined not as the depth but as 256.0 times
the remainder of depth when dividing by 1/256 (or something
like that), so you get a PNG with the lower 8 bits and can
combine afterwards using external tools.


Post a reply to this message

From: ThomasR
Subject: Re: Megapov post_process save_file format
Date: 12 Jan 2011 13:35:01
Message: <web.4d2dad85f56ed354a8dd583f0@news.povray.org>
Thanks for the advice !

I adapted your second solution and wrote an RGB image and used the three R G B
fields to put the three "bits" of my sampling so that my distance is :

d = R*1/255 + G*1/255² +B*1/255³

It seems to be working fine and my precision went from 256 grays to over 16
millions grays, which is quite enough :)

I other have more elegant solutions to change the output format of save_file,
feel free to help ;)

Thomas


Post a reply to this message

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