POV-Ray : Newsgroups : povray.binaries.images : texture interpolation... why rgb ? : Re: texture interpolation... why rgb ? Server Time
2 Aug 2024 10:25:23 EDT (-0400)
  Re: texture interpolation... why rgb ?  
From: Trevor G Quayle
Date: 29 Nov 2007 16:30:01
Message: <web.474f2e6c2088bdecc150d4c10@news.povray.org>
Le Forgeron <jgr### [at] freefr> wrote:
> Did you look at my code in p.b.sf ?
> H was not linearly interpolated. There is a bit of vectors involved.
> RGB or HSV/L: red & cyan mix as a shade of grey. (null saturation)
> If one is shorter than, it is defined...
> Now, should the path be alike is another problem: at any moment you
> will have to choose between the upper path and the lower path...
> There is two ways for opposites on a circle. And no good choice.

Actually I didn't look at the actual code, I was commenting more on the
appearance of the graphic.  The main problem that stood out to me was that 2
pure colours interpolated as a pure colour (red to blue = magenta) which
indicated to me that the path was interpolating between the H values, following
the perimeter of the colour space, rather than cutting directly across which
gives a different shade, whereas the opposite colours are interpolated directly
across.

>
>
>
> >
> > A second problem I see is that this really only shows the halfway colour, and
> > not the full transition from one to the other.
>
> I did as I could in SDL. Patching lighting.cpp around line 5251 is
> an idea I'm not yet ready to perform for a continuous gradation. Not
> tonight anyway.
> May be next week... but I want more control than changing it from
> RGB to HSL/HSV hardcoded.
> So reflexion is needed before trying that.
>

I can understand the problem in getting this to work.  It took me a while to
write the SDL code to get smooth transitions.


> A problem with your picture: it only uses saturated colors. What
> about lighter, darker, white & black ?
> Mixing a lighter blue & darker blue ? Not a saturated blue in RGB model.

Here's some new mixes using different shades of red:

Top to bottom:
1. red to dark red
2. red to light red
3. dark red to light red
4. red to black
5. red to white

If there's any particular mix you want I can make an image for you, or I could
post the code.  The difficult trick in the interpolation is that you have to
convert the RGB to HSV/HSL(polar) to XYZ(cartesian) coordinates, interpolate
then convert back XYZ -> HSV/HSL -> RGB.

-tgq


Post a reply to this message


Attachments:
Download 'interp2.jpg' (58 KB)

Preview of image 'interp2.jpg'
interp2.jpg


 

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