|
![](/i/fill.gif) |
Le 07/09/2013 00:30, Ger nous fit lire :
> I use an external program to create png files that contain height data.
> The difference between adjacent points is generally very little but as
> povray renders the height fields it shows very large jumps in height.
>
> is it
>
> height of pixel = (R x 256 x 256) + (G * 256) + B?
See:
> http://wiki.povray.org/content/Reference:Height_Field
If the png is a colour-one (instead of grey), it is used as it is done
for tga and ppm: red and green bytes of each pixel are used to store 16
bits number: Most Significant Byte (MSB) is red, Least Significant Byte
is green (and blue is irrelevant, as long as there is only up to 8 bits
per channel): (255.0*Red + Green)*255.0
(with Red the value between 0 and 1.0 (so, it's your R/255))
In term of bits-operation, it it is ((R<<8)|G) (with R & G in 0..255),
or Rx256+G (max value of height field is 65535)
If the png is a grey one, the grey value is used as the height.
(remember that png can have more than 8 bits per channel, you can have a
16 bits grey png without any problem)
If the png is a coloured one with more than 8 bits per channel, the
grey-equivalent is used :
0.297*Red + 0.589*Green + 0.114*Blue
Post a reply to this message
|
![](/i/fill.gif) |