POV-Ray : Newsgroups : povray.general : Proof: 2 x 8 bit textures and interpolation Server Time
17 Nov 2024 09:16:05 EST (-0500)
  Proof: 2 x 8 bit textures and interpolation (Message 1 to 3 of 3)  
From: Wolfgang Wieser
Subject: Proof: 2 x 8 bit textures and interpolation
Date: 4 May 2003 16:23:01
Message: <3eb576a4@news.povray.org>
[Talking about "16 bit image map pattern not working with isosurface"]

Christoph Hormann wrote:
>Note this is probably an extremely bad idea since it does not work with
>interpolation 
>
I dare to object...

I think I have the mathematical proof that there is no problem 
with interpolation even when using two separate 8 bit images instead 
of one 16 bit set. You just have to use bilinear interpolation on 
both of them: 

Consider we have 16 bit topography data split into two 8 bit sets 
with low and high byte of the values. 
Look at two pixels a,b next to each other: 
  a = a_lo/256 + a_hi
  b = b_lo/256 + b_hi

Normal linear interpolation would do just that: 
  val = p * a + (1-p) * b

But using two separate textures, they get interpolated separately: 
  val_lo = p * a_lo + (1-p) * b_lo
  val_hi = p * a_hi + (1-p) * b_hi
Then, these get composed to the real value as used in the isosurface: 
  val = val_lo/256 + val_hi 
      = [ p * a_lo + (1-p) * b_lo ]/256 + p * a_hi + (1-p) * b_hi
      = p * (a_lo/256 + a_hi) + (1-p) * (b_lo/256 + b_hi)
      = p * a + (1-p) * b      
...and that's just what we want.   -- q.e.d.

Bilinear interpolation is just the same in two directions. 

Incorrect? Any comments?

Cheers,
Wolfgang


Post a reply to this message

From: Christoph Hormann
Subject: Re: Proof: 2 x 8 bit textures and interpolation
Date: 4 May 2003 16:59:00
Message: <3EB57F13.D7457A20@gmx.de>
Wolfgang Wieser wrote:
> 
> [Talking about "16 bit image map pattern not working with isosurface"]
> 
> Christoph Hormann wrote:
> >Note this is probably an extremely bad idea since it does not work with
> >interpolation
> >
> I dare to object...
> 
> I think I have the mathematical proof that there is no problem
> with interpolation even when using two separate 8 bit images instead
> of one 16 bit set. You just have to use bilinear interpolation on
> both of them:

If you read the citation in my reply you cite here:

> > I busted my head over this one too for a while. I ended up using TGA's of
> > the 16-bit-for-height_field flavor and extracting the MSB and LSB by
> >
> > function{pigment_foo(x,y,z).red+pigment_foo(x,y,z).green/256}
> >
> > which is probably where you are almost at anyway.
> 
> Note this is probably an extremely bad idea since it does not work with
> interpolation and using not interpolated image maps will result in
> infinite gradients in the function.

you can see it refers to using a TGA like it is used for 16 bit
heightfields.  I really thought this was clear.  No need to make that much
fuzz about it because everyone who has ever tried this with interpolation
will immediately recognize it is a bad idea.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Wolfgang Wieser
Subject: Re: Proof: 2 x 8 bit textures and interpolation
Date: 4 May 2003 17:10:38
Message: <3eb581ce@news.povray.org>
> you can see it refers to using a TGA like it is used for 16 bit
> heightfields.  I really thought this was clear.  No need to make that much
> fuzz about it because everyone who has ever tried this with interpolation
> will immediately recognize it is a bad idea.
> 
Ah, I see. 
I', very sorry for the misunderstanding. 

Wolfgang


Post a reply to this message

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