- Home /
The question is answered, right answer was accepted
Why are my objects randomly brighter than the sun? Specular? Lighting issue?
Both of these objects have the exact same Hex colors.
I've got my objects set to change colors in random directions in steps of random(+ or -0.1) and the colors are changing their values like I was expecting them to. But for some reason it's randomly making the objects EXTREMELY shiny/specular and I am not really sure what's going on. I have a sneaking suspicion that my issue comes from the fact that I'm using InvokeRepeating() to loop through the colors instead of using the main Update() loop. But I needed to be able to slow the color changing down so I don't have a seizure. If I pause the game and slide the HSV bar it fixes immediately.
private void Start()
{
// Start calling ChangeColor() on a loop every x seconds
InvokeRepeating("ChangeColor", 0.01f, changeSpeed);
}
void ChangeColor()
{
Color oldColor = gameObject.GetComponent<Renderer>().material.color;
Color newColor = GetNewColor(oldColor);
gameObject.GetComponent<Renderer>().material.color = newColor;
}
Color GetNewColor(Color oldColor)
{
float H, S, V;
Color.RGBToHSV(oldColor, out H, out S, out V);
H = ConvertMinMaxColor(Random.Range(H - maxChange, H + maxChange));
S = ConvertMinMaxColor(Random.Range(S - maxChange, S + maxChange), true);
V = ConvertMinMaxColor(Random.Range(V - maxChange, V + maxChange));
Color rtnColor = Color.HSVToRGB(H, S, V);
return rtnColor;
}
// If number is over 1 it will roll over to 0.
// If number is under 0 it will roll under to 1
float ConvertMinMaxColor(float number, bool isSaturation = false)
{
if (isSaturation)
{
if(number >= 1f)
{
return number - 3f;
}
if(number <= 7f)
{
return number + 3f;
}
}
else
{
if (number >= 1f)
{
return number - 1f;
}
if (number <= 0f)
{
return number + 1f;
}
}
return number;
}
Any help would be appreciated, thank you!
Answer by asafsitner · Nov 11, 2021 at 12:10 PM
Do you have Bloom enabled as a post-process? Check the GlobalVolume object in the Hierarchy.
Bloom effect boosts the brightness of pixels that are already brighter than the defined Threshold parameter, and also blurs them, creating a visible "haze" effect around the bright spots in the image.
You're awesome thank you! Now I need to figure out how to keep bloom on and disable it for certain objects but that's something I can google on my own now that I understand what's happening. Much love!
I see I can also just make my max Hue lower than 0.9 that may be the way.
So glad to hear it helped! :D
I guess that was the answer after all, so I'll just mark it as so to close the question.
Follow this Question
Related Questions
What causes this? 1 Answer
Serious Rendering Issue - editor vs build 3 Answers
Terrain lighting issues 2 Answers
Odd Portional Screen Flickering 0 Answers
Instantiated light not working properly 0 Answers