POV-Ray : Newsgroups : povray.binaries.images : some issues : Re: some issues Server Time
5 Jul 2024 08:06:12 EDT (-0400)
  Re: some issues  
From: Le Forgeron
Date: 29 Oct 2014 16:12:54
Message: <54514a46$1@news.povray.org>
On 28/10/2014 22:40, Alain wrote:
> Le 14-10-28 03:53, Le_Forgeron a écrit :
>> Le 28/10/2014 04:58, CAS a écrit :
>>> This is my experiment, I want to output three pictures:
>>> The first is the intersection point.My aim is to get coordinates of
>>> intersection
>>> point.The second is the normal vector.My aim is to get normal vector of
>>> intersection point.The third is the scene image.My purpose is to
>>> check whether
>>> my input is correspondence with my output.But I found the
>>> intersection and
>>> normal  is wrong.I can not get the coordinates and normal of each
>>> intersection
>>> point from my "intersection.bmp" and "normal.bmp".Maybe something was
>>> wrong in
>>> my codes.I have uploaded my codes,expecting someone to give me a
>>> help.Thanks.
>>>
>>
>> Your image are bmp, the range of channel in bmp (32 bits true color) is
>> too small for the information you want.
>>
>> Give a try to HDR output (+FH).
>>
>> http://megapov.inetart.net/manual-1.2.1/megapov0121.html#hdr
>>
>> Next step: having a look in source code of megapov to understand the
>> data provided by f_output_*
>>
>> A shame there is no sample scene for pprocess with intersection or
>> normal.
>>
>>
>>
> 
> An alternative would be to use +fn16 to generate a PNG image at 16 bit
> per channel.

Right, it is easier with png.

I now had a playsession with megapov and I have the following feelings:

* normal is probably normalized (good), but you'd better expect a -1 to
1 range, so to get some correct colours, you need to scale and shift it
a bit (as only value in the 0 to 1 range are good for generating
different colours):

  post_process{
    function { 0.5+0.5*f_output_inormal_x(x,y) }
    function { 0.5+0.5*f_output_inormal_y(x,y) }
    function { 0.5+0.5*f_output_inormal_z(x,y) }
    function { f_output_alpha(x,y) }
    save_file concat("nn_",output_filename(0))

* intersection point is even stronger, the value is raw, so you need an
even better adaptation to make a descent colours out of them. (which
mean you have to know what voxel the camera is looking at for a better
formula)

* +UA and png is indeed recommend (+FN16 !) to be able to distinguish
the part with no intersection

  post_process{
    function { 0.5+.05*f_output_ipoint_x(x,y) }
    function { 0.5+.05*f_output_ipoint_y(x,y) }
    function { 0.5+.05*f_output_ipoint_z(x,y) }
    function { f_output_alpha(x,y) }
    save_file concat("ii_",output_filename(0))
  }

* Extracting the data is only a matter of inverting the previous
transformation: convert the pixel's color as float between 0 and 1, (max
colour's channel is 1, min is 0), and just revert the transformation
(such as 0.5+0.05*value --> value = (channel-0.5)*20 ).

* Reading pprocess.inc is mandatory, as many macro are needed to define
the right functions.

* png_write_finish_row is no more, so compiling was interesting... just
comment that functions from png_pov.cpp (it is used with partial
image... just avoid them now)


-- 
IQ of crossposters with FU: 100 / (number of groups)
IQ of crossposters without FU: 100 / (1 + number of groups)
IQ of multiposters: 100 / ( (number of groups) * (number of groups))


Post a reply to this message

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