POV-Ray : Newsgroups : povray.newusers : Color Generation: How do I get rid of pink. Server Time
4 Nov 2024 19:14:47 EST (-0500)
  Color Generation: How do I get rid of pink. (Message 1 to 8 of 8)  
From: oldmicah
Subject: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 10:10:01
Message: <web.3f11680f918f5c4d9cfc34200@news.povray.org>
I'm working on a scene with a library at night, where I am filling
bookshelves with random books.  Overall, I'm pleased with the way it is
working out, but I'm getting some shockingly pink books that look way out
of place in a library.  There is an image at
http://homepage.mac.com/sstrange/POV/libraryatnight.jpg

Right now my code generates random colors, and then try to weed out the pink
colors. As the above image shows, so far I've failed in this approach.  The
problem is that 'pink' seems to show up when red and blue are close to each
other and green is significantly lower.  However, there seem to be other
obnoxious pink combinations in there.

Another option I've considered is to pregenerate a huge table of
'acceptable' colors and then pull randomly from it.  I'm just loathe to do
the work of generating sever thousand good book colors.

So assuming that I can't get over my feelings of masculine insecurity and I
want to get rid of the pink, can anyone come up with a better way to do it?

many thanks,
Steven


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 10:14:49
Message: <3f116959$1@news.povray.org>
Well, if you' experiment a little, you'll find the rgb values
around which pink occurs. Making the different
colors thus dependant on each other so that they avoid
it might be a way to go.
First, calculate red and green. If both of them are in
a certain designated range, just leave blue out, or
weak, or strong, or whatever.

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights


> I'm working on a scene with a library at night, where I am filling
> bookshelves with random books.  Overall, I'm pleased with the way it is
> working out, but I'm getting some shockingly pink books that look way out
> of place in a library.  There is an image at
> http://homepage.mac.com/sstrange/POV/libraryatnight.jpg
>
> Right now my code generates random colors, and then try to weed out the
pink
> colors. As the above image shows, so far I've failed in this approach.
The
> problem is that 'pink' seems to show up when red and blue are close to
each
> other and green is significantly lower.  However, there seem to be other
> obnoxious pink combinations in there.
>
> Another option I've considered is to pregenerate a huge table of
> 'acceptable' colors and then pull randomly from it.  I'm just loathe to do
> the work of generating sever thousand good book colors.
>
> So assuming that I can't get over my feelings of masculine insecurity and
I
> want to get rid of the pink, can anyone come up with a better way to do
it?
>
> many thanks,
> Steven
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.495 / Virus Database: 294 - Release Date: 30.06.2003


Post a reply to this message

From: oldmicah
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 11:25:01
Message: <web.3f117928fe91850d9cfc34200@news.povray.org>
Yup, been trying something close to that. I've been looking at the initial
red value and then trying to adjust the green and blue so that they
produced less pink.  Modulating the blue based on my red and green values
would have been easier.

The problem I've been running into is that there are a wide range of colors
I don't like.  i.e. playing around with a color sampler (rgb 255), these
are some of colors (ranges)  I consider 'annoying' pinks:
255, 175, (255 through 170)
255, 129, (255 through 120)
255, (0-230), 240
255, 129, 180
200,0, (160 through 75)
180,0, (180 through 75)
170,0,(130 through 110)
170,(0 through 70), 90

The killer has been that I can get the undisirable pinks in a red range of
170-255, green range of 0-230, and blue range of 75-255.  I've been amazed
at the sheer number of pinks I don't like. :)  I could definitely write  a
large block of logic that avoids all of those ranges, and that may be the
least painful option available.

I was hoping for some sort of color space magic bullet like: "to avoid
annoying pinks, add the arctangent of green + blue to the red".  Of course,
I also hope for world peace, but I don't want to give up on either hope
just yet.

thanks,
Steven


Tim Nikias v2.0 wrote:
>Well, if you' experiment a little, you'll find the rgb values
>around which pink occurs. Making the different
>colors thus dependant on each other so that they avoid
>it might be a way to go.
>First, calculate red and green. If both of them are in
>a certain designated range, just leave blue out, or
>weak, or strong, or whatever.
>
>Tim Nikias v2.0
>Homepage: http://www.digitaltwilight.de/no_lights
>


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 12:16:23
Message: <3f1185d7$1@news.povray.org>
You could also do something different:
imagine the blue-component as a linear
interpolation from 0 to 1. The closer
the value gets to 1, the more blue you
get.

What about this: model an interpolation
line. For example, it takes values ranging
from 0 to 1 and returns a value from 0 to
1. In the normal world, the input-value
corresponds to the output. But, if you
create an array of vertices in the UV-Room,
and the input is used as movement along the
U-axis, and the V-axis is the output...

You could then just model an array which leaves
gaps.

Here's some code from my bsplines.inc:

//Linear_Pos
//Usage: Call Macro with Linear-I-Array and Mover between 0 and 1 (beginning
and end of spline)
#macro Linear_Pos(_Linear_Array,_LI_Mover)
 //Amount of Interpolations
 #local _Linear_Sections = dimension_size(_Linear_Array,1)-1;
 //Node_Mover-Corrections, keeps them in boundaries
 #if (_LI_Mover > 1) #local _LI_Mover=1; #end
 #if (_LI_Mover < 0) #local _LI_Mover=0; #end
 #if (_LI_Mover = 0)
  #local _Linear_Pos_ = _Linear_Array[0];
 #end
 #if (_LI_Mover = 1)
  #local _Linear_Pos_ = _Linear_Array[_Linear_Sections];
 #end
 #if (_LI_Mover > 0 & _LI_Mover < 1)
  #local _Actual = floor(_LI_Mover*_Linear_Sections);
  #local _Next = floor(_LI_Mover*_Linear_Sections)+1;
  #local _Time = _LI_Mover*(_Linear_Sections)-_Actual;
  #local _Linear_Pos_ =
_Linear_Array[_Actual]+(_Linear_Array[_Next]-_Linear_Array[_Actual])*_Time;
 #end
_Linear_Pos_
#end

For example, if you'd wanted to leave out
the region ranging from .4 to .6:

#declare Blue_Color=array[4]
{ <0,0,0>,<.499,.4,0>,<.501,.6,0>,<1,1,0>}

There would still be a very small possibility of
the wrong color being picked, but its much less
and easy to handle.

To then get the appropriate color, use this:
Linear_Pos(Blue_Color,rand(R)).y
It'll return the height of the interpolation, which'll
be used as the color...


-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights

> Yup, been trying something close to that. I've been looking at the initial
> red value and then trying to adjust the green and blue so that they
> produced less pink.  Modulating the blue based on my red and green values
> would have been easier.
>
> The problem I've been running into is that there are a wide range of
colors
> I don't like.  i.e. playing around with a color sampler (rgb 255), these
> are some of colors (ranges)  I consider 'annoying' pinks:
> 255, 175, (255 through 170)
> 255, 129, (255 through 120)
> 255, (0-230), 240
> 255, 129, 180
> 200,0, (160 through 75)
> 180,0, (180 through 75)
> 170,0,(130 through 110)
> 170,(0 through 70), 90
>
> The killer has been that I can get the undisirable pinks in a red range of
> 170-255, green range of 0-230, and blue range of 75-255.  I've been amazed
> at the sheer number of pinks I don't like. :)  I could definitely write  a
> large block of logic that avoids all of those ranges, and that may be the
> least painful option available.
>
> I was hoping for some sort of color space magic bullet like: "to avoid
> annoying pinks, add the arctangent of green + blue to the red".  Of
course,
> I also hope for world peace, but I don't want to give up on either hope
> just yet.
>
> thanks,
> Steven
>
>
> Tim Nikias v2.0 wrote:
> >Well, if you' experiment a little, you'll find the rgb values
> >around which pink occurs. Making the different
> >colors thus dependant on each other so that they avoid
> >it might be a way to go.
> >First, calculate red and green. If both of them are in
> >a certain designated range, just leave blue out, or
> >weak, or strong, or whatever.
> >
> >Tim Nikias v2.0
> >Homepage: http://www.digitaltwilight.de/no_lights
> >
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.495 / Virus Database: 294 - Release Date: 30.06.2003


Post a reply to this message

From: Micha Riser
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 15:11:50
Message: <3f11aef6@news.povray.org>
I think if you use a different colour space that rgb, that ist the HSV
colour space, this should easily be possible. Just limit the H-value to the
non-pink colours. I think there are somewhere macros availabale that
convert HSV2RGB for POV-Ray.

- Micha

-- 
POV-Ray Objects Collection: http://objects.povworld.org


Post a reply to this message

From: Christopher James Huff
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 16:01:11
Message: <cjameshuff-09FC06.14583613072003@netplex.aussie.org>
In article <web.3f11680f918f5c4d9cfc34200@news.povray.org>,
 "oldmicah" <nomail@nomail> wrote:

> Another option I've considered is to pregenerate a huge table of
> 'acceptable' colors and then pull randomly from it.  I'm just loathe to do
> the work of generating sever thousand good book colors.

Why would you need to? Make a table of a dozen or so colors. If that's 
not enough, add some random variation to the colors. You could easily 
set things up so you don't get pink unless you choose a pink base color. 
And you could also control the probability of a book being a certain 
color this way...make half the base colors shades of brown, and half 
your books will be brown.

-- 
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

From: oldmicah
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 20:15:00
Message: <web.3f11f581fe91850d9cfc34200@news.povray.org>
Hello Tim, Micha, and Christopher

  Tim, I was thinking about your solution.  The advantage is that I could
gracefully block out ranges along one color axis.  Unfortunately, the
'pinks' I'm concerned about are multi dimensional.  i.e. a certain range of
red is only invalid with certain range of blue and green.  One possibility
is to alter your code to return pointers to other tables in the case of
possible ppv's (possible pink values).  i.e. if the red value is 200-255, I
get an index to the green danger zone table which, if it checks out, I need
to check the appropriate blue table.  (Apologies if I misunderstood)
Basically, I'd be  trying to model 3 dimensional (1 axis for red, green,
and blue) blobs of invalid color areas.  If my point in rgb space was in
the ppv zone, I'd grab another random color until I succeeded.  A lot of
work.

  The big plus side is that after many years of playing with computer
graphics, thinking about your linear color space has helped me finally
internalized the concept of color spaces.

  With what Micha just mentioned, I went back and started playing with my
color table again, this time looking at hsv instead of rgb.  It looks like
if I block out hues 277 to 400, I miss almost all of the undesirable
colors.

  What is bizarre is that my first couple of attempts at limiting the Hue to
less than .68 produced almost exclusive annoying colors.  (.68 = 277/400; a
hue of 277-400 in Photoshop's HSB color sampler produced the undesirable
colors.) I had to invert hue by forcing it to be greater than .32 to lose
the colors.  Is this a bug, or am I confused?

 #macro GetBookColor (  )
 #local temphsvcolor=color <0, 0, 0>;
 #while( temphsvcolor.red < .32 )
  #declare newbookcolor=color red (.5*rand(R2R))
                           green (.5*rand(R2R)) blue (.5*rand(R2R));
  #local temphsvcolor=CRGB2HSV( newbookcolor );
 #end
#end

  Bottom line is that it all works now, and I really appreciate everyone's
help on this.  (Non-pink version is at
http://homepage.mac.com/sstrange/POV/libraryatnight.jpg )

many thanks,
Steven

Micha Riser wrote:
>I think if you use a different colour space that rgb, that ist the HSV
>colour space, this should easily be possible. Just limit the H-value to the
>non-pink colours. I think there are somewhere macros availabale that
>convert HSV2RGB for POV-Ray.
>
>- Micha
>
>POV-Ray Objects Collection: http://objects.povworld.org
>


Post a reply to this message

From: oldmicah
Subject: Re: Color Generation: How do I get rid of pink.
Date: 13 Jul 2003 20:55:01
Message: <web.3f11fe96fe91850d9cfc34200@news.povray.org>
make that (Non-pink version is at
http://homepage.mac.com/sstrange/POV/libraryatnight2.jpg )

thanks again,
Steven

oldmicah wrote:
><snip
>help on this.  (Non-pink version is at
>http://homepage.mac.com/sstrange/POV/libraryatnight.jpg )
>


Post a reply to this message

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