• Advertisement

Archived

This topic is now archived and is closed to further replies.

Simple Colorizing Questions

This topic is 5185 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, You can move this to the beginners forum if so desired. In my game, I''m trying to allow colorizing of character features by rendering them using primary colors, then doing a color -> grey -> custom color conversion in my editor. Unfortunately, I''m not sure how to get the grey value OR colorize them :\ doh! Someone once told me that the greyscale value is just the average of red, green and blue. But Paint Shop Pro converts 200,70,30 into 104, not 100. Close, but I must be missing something. And then the colorizing. My first guess is that I just use the percentage of the grey value. Like if grey is 60, and sense 60 is 23% of 255, then the new pixel would be 23% of the red, green, and blue of the custom color. Is that right? Thanks for any help, Jiia

Share this post


Link to post
Share on other sites
Advertisement
There are no hard and fast rules, you can just invent your own that looks ok.

RGB->greyscale (in PSP) probably depends on converting to a different colour space and using, say, intensity rather than directly operating on the RGB. A simple average will probably work for what you want to do, but check the Forum FAQ for some links to more in-depth colour theory info.

As for greyscale->RGB, what you suggest will work ok but why don't you just try it and see whether it is what you want?

[edited by - JuNC on February 7, 2004 7:53:13 PM]

Share this post


Link to post
Share on other sites
A simple way to do it in arb_tex_env (or nv_rc) is something like this: first use dot3 on texture(or just primary color) & constant (read FAQ to get exact RGB->gray conversion values) then just multipy this value with your desired color. This works on any card supporting multitexturing.

out = (texture DOT3 (0.3, 0.5, 0.2))*color


You should never let your fears become the boundaries of your dreams.

[edited by - _DarkWIng_ on February 8, 2004 8:25:51 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I calculate grayscale values by calculating the average of the minimum and maximum intensities; for instance:

Lets say we have 100,120, and 199. The shade of gray will be 149.
If those intensities were 199, 120, and 100 we would still get 149 for the shade of gray.

Share this post


Link to post
Share on other sites
A semi-standard rgb to grayscale conversion is given by:

Y = 0.3R + 0.59G + 0.11B

where Y is the luminance. This formula tries to take into account the human eye''s relative sensitivity to different colors. There is no real "standard" for converting to grayscale, however, since it depends on the detectors response to the light.

Magius

Share this post


Link to post
Share on other sites

  • Advertisement