if(sample.r > level)
{
sample.r = 1.0;
}
else
{
sample.r = 0.0;
}
if(sample.g > level)
{
sample.g = 1.0;
}
else
{
sample.g = 0.0;
}
if(sample.b > level)
{
sample.b = 1.0;
}
else
{
sample.b = 0.0;
}
The problem with this method is that It will always glow either red, green or blue. For example a bright purple would glow red.Method 2:
if((0.2126*sample.r) + (0.7152*sample.g) + (0.0722*sample.b) > level)
{
sample.r = 1.0;
sample.g = 1.0;
sample.b = 1.0;
}
else
{
sample.r = 0.0;
sample.g = 0.0;
sample.b = 0.0;
}
This method works by determining the overall brightness (luminance?). But it never seems to glow any color but white.So I developed two methods but neither seem to work right. Does anyone have any methods that they have used successfully? Or any suggestions on how to improve mine?
Edited by ic0de, 12 October 2012 - 05:59 AM.








