POV-Ray : Newsgroups : povray.advanced-users : how do i get on the up and up with color? Server Time
26 Nov 2024 22:29:38 EST (-0500)
  how do i get on the up and up with color? (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Noah A
Subject: how do i get on the up and up with color?
Date: 10 Aug 1999 19:11:22
Message: <37B0B1A0.FBD5B159@powersurfr.com>
i'm using a while statment to make a bunch of "things" as they rise on
the y access i'd like them to incease certain colors. how would i use an
array to do this?


Post a reply to this message

From: Ken
Subject: Re: how do i get on the up and up with color?
Date: 10 Aug 1999 19:44:13
Message: <37B0B908.75630A9D@pacbell.net>
Noah A wrote:
> 
> i'm using a while statment to make a bunch of "things" as they rise on
> the y access i'd like them to incease certain colors. how would i use an
> array to do this?

An array is one possible solution but it would probably be easier to
eimple use the value of the while loop to increment the colors.

#declare a = 0;
  #while (a < 10 )
    sphere {<0,a,0>, 1
      pigment { rgb <a*0.1, a*0.1, a*0.1> }
      }
    }
  #declare a = a + 1;
#end

  The above example will change each rgb value by 0.1 for each sphere it
produces. There are tricks to using this approach and the example I gave
is a very basic one. If you really want to change the colors using an array
you will still need to write out each color you want to store in the array
before passing it into the while loop. This could be a very tedious task
but it is possible if you really want to do it. If my while loop example
is not what you want let me know and I will work out an array solution for
you.

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Margus Ramst
Subject: Re: how do i get on the up and up with color?
Date: 10 Aug 1999 20:06:57
Message: <37B0BEA2.8CA57F86@peak.edu.ee>
I suggest you use this interpolation macro, it's very flexible:

//Interpolation
//GC - global current
//GS - global start
//GE - global end
//TS - target start
//TE - target end
//EXP - interpolation exponent (linear, cubic etc.)

#macro Interpolate(GC,GS,GE,TS,TE,EXP)
        (TS+(TE-TS)*pow((GC-GS)/(GE-GS),EXP))
#end

Do something like this:

#declare StartColor=<1,1,0>;
#declare EndColor=<0,1,0>;
#declare N=10;
#declare C=0;

#while(C<10)
    sphere{y*C, 0.5
           pigment{rgb Interpolate(C,0,N,StartColor,EndColor,1)}
          }
    #declare C=C+1;
#end

Here, pigment changes from StartColor to EndColor as C changes from 0 to N. The
final parameter is 1, meaning linear interpolation.
I use this macro extensively, even though this particular example could be
achieved more efficiently.

Margus

Noah A wrote:
> 
> i'm using a while statment to make a bunch of "things" as they rise on
> the y access i'd like them to incease certain colors. how would i use an
> array to do this?


Post a reply to this message

From: Nieminen Mika
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 03:04:16
Message: <37b12070@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: #declare a = 0;
:   #while (a < 10 )
:     sphere {<0,a,0>, 1
:       pigment { rgb <a*0.1, a*0.1, a*0.1> }
:       }
:     }
:   #declare a = a + 1;
: #end

  But Ken! That's quite good indentation... :)
  (Although the #while and the #end are not indented at the same level...)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 04:25:43
Message: <37B13342.E296D852@pacbell.net>
Nieminen Mika wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> : #declare a = 0;
> :   #while (a < 10 )
> :     sphere {<0,a,0>, 1
> :       pigment { rgb <a*0.1, a*0.1, a*0.1> }
> :       }
> :     }
> :   #declare a = a + 1;
> : #end
> 
>   But Ken! That's quite good indentation... :)
>   (Although the #while and the #end are not indented at the same level...)

I'm sorry 8`[

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Nieminen Mika
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 04:48:57
Message: <37b138f9@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
:>   But Ken! That's quite good indentation... :)

: I'm sorry 8`[

  I praise you and you are sorry? I don't understand.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 05:00:36
Message: <37B13B6F.68D8617F@pacbell.net>
Nieminen Mika wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> :>   But Ken! That's quite good indentation... :)
> 
> : I'm sorry 8`[
> 
>   I praise you and you are sorry? I don't understand.

I do have a reputation to maintain you know !

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Noah A
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 05:14:09
Message: <37B13EEF.474A43B7@powersurfr.com>
thank you ken. it works like a charm

Ken wrote:

> Noah A wrote:
> >
> > i'm using a while statment to make a bunch of "things" as they rise on
> > the y access i'd like them to incease certain colors. how would i use an
> > array to do this?
>
> An array is one possible solution but it would probably be easier to
> eimple use the value of the while loop to increment the colors.
>
> #declare a = 0;
>   #while (a < 10 )
>     sphere {<0,a,0>, 1
>       pigment { rgb <a*0.1, a*0.1, a*0.1> }
>       }
>     }
>   #declare a = a + 1;
> #end
>
>   The above example will change each rgb value by 0.1 for each sphere it
> produces. There are tricks to using this approach and the example I gave
> is a very basic one. If you really want to change the colors using an array
> you will still need to write out each color you want to store in the array
> before passing it into the while loop. This could be a very tedious task
> but it is possible if you really want to do it. If my while loop example
> is not what you want let me know and I will work out an array solution for
> you.
>
> --
> Ken Tyler
>
> See my 700+ Povray and 3D Rendering and Raytracing Links at:
> http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Ken
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 05:24:30
Message: <37B14105.C85DF276@pacbell.net>
Noah A wrote:
> 
> thank you ken. it works like a charm

Glad to be of service. Now if you just fix my bounding problem for me...

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Nieminen Mika
Subject: Re: how do i get on the up and up with color?
Date: 11 Aug 1999 13:11:48
Message: <37b1aed4@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: I do have a reputation to maintain you know !

  Ah, now I understand :)
  I assure you that there's nothing you have to be ashamed of.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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