POV-Ray : Newsgroups : povray.general : heightfields, 16bit images and isosurfaces : Re: heightfields, 16bit images and isosurfaces Server Time
4 Aug 2024 16:07:41 EDT (-0400)
  Re: heightfields, 16bit images and isosurfaces  
From: Christopher James Huff
Date: 8 Jun 2003 12:19:12
Message: <cjameshuff-BC6AC2.11103508062003@netplex.aussie.org>
In article <3ee346e3@news.povray.org>,
 Lutz-Peter Hooge <lpv### [at] gmxde> wrote:

> > BTW, the TGA format *is* supported, but image maps load it as an 
> > ordinary color TGA,
> 
> Thats the same as not supported, isn't it?
> Interpolation would scew it up.

No. The interpolation is a weighted average, with the weights 
independant of the pixel values. Basically the same goes for the 
conversion. It's a very inefficient way to do it, requiring 
interpolation of three values when only one would do, but it will work.

ar, ag: red and blue of pixel A
br, bg: red and blue of pixel B
w1, w2: weights of the pixels

Method 1: Combining then interpolating:
(ar*255 + ag)*w1 + (br*255 + bg)*w2

Method 2: Interpolating then combining:
(ar*w1 + br*w2)*255 + (ag*w1 + bg*w2)

Which equals:
ar*w1*255 + br*w2*255 + ag*w1 + bg*w2

Rearrange:
ar*w1*255 + ag*w1 + br*w2*255 + bg*w2

Which equals this, the same as method 1:
(ar*255 + ag)*w1 + (br*255 + bg)*w2

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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