POV-Ray : Newsgroups : povray.general : Outputting raw pixel data? : Re: Outputting raw pixel data? Server Time
1 Aug 2024 22:15:36 EDT (-0400)
  Re: Outputting raw pixel data?  
From: scott
Date: 31 Mar 2005 09:33:11
Message: <424c0a27@news.povray.org>
Warp wrote:
> Le Forgeron <jgr### [at] freefr> wrote:
>> PS: printf usually as an issue with double precision, do not expect
>> all the digits!
>
>   printf has no issues with double precision. It's just a question of
> specifying the proper parameters.
>
>     double d = 1.234567890123456789;
>     printf("%.15f\n", d);
>
> prints:
>
> 1.234567890123457
>
>   And by the way, color values are calculated using single precision
> floating points in povray.

I would probably just write the binary to a file, rather than use printf.

So in theory I can patch the source code to output these 32-bit floats for
each colour for each pixel rendered?

I found the following code in pvbmp.cpp:

 for (i = 0 ; i < width ; i++)
  {
    out << (unsigned char) floor (line_data [i] [pBLUE] * 255.0) ;
    out << (unsigned char) floor (line_data [i] [pGREEN] * 255.0) ;
    out << (unsigned char) floor (line_data [i] [pRED] * 255.0) ;
  }

So this line_data[i][pBLUE] is a single float value that I can just write
directly to a file rather than using *255.0 and floor()...


Post a reply to this message

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