|
|
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
|
|
|
|
> 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
|
|
|
|
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 :
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
|
|