I’ve been toying around with a color picker UI that is nothing more than 4 sliders (RGBA). It all works great, but the maximum value for each channel appears to be 0.5 rather than 1. Is this how it was designed, or should I start digging through my code for some obscure error in my math?
The sliders appear to work fine for other objects like audio level, so I’m doubtful that I’ve screwed them up.
The thing is that when I set the scale from 0 to 1, the saturation of a texture appears to max out halfway along the slider. This is based on appearance, as the inspector itself reports that the values do go between 0 and 1. Is there a reason that the texture would only be able to handle 50% of the value; or to say it another way, is there a particular way to save a texture to make the color applied to it follow the complete spectrum?
There shouldn’t be anything special. We just directly copy the color values over. (Converting to the specific texture format used of course)
You are using texture.SetPixel?
That’s one thing about Unity’s lighting system. All the light intensities, colors etc. are multiplied by two at the end.
For example for diffuse shader the final color is: texture * materialcolor * lightcolor * 2. Multiplying by two lets you have “overbright” lighting and other nice effects - you can see that if you place lights near the surface.
If you have, say, pure red color, then at 50% intensity it’s already going to be pure red (because of *2 at the end), and at 100% intensity it’s not going to be brighter (pure red can’t be brighter than that). If you don’t have pure saturated colors, they will get brighter towards white.
No, I’m just setting the values in the guiTexture.color.r, g, b, and a. I just want to change the color of a particular GUI element, like a guiText or guiTexture.
Is it just the values of GuiTexture.color that are multiplied by two? If I were to implement some sliders to change the color of a material, would I need to consider the color multiplication?
Spaniard, if you’re willing to share, I would be thrilled to take a look at your implementation of RGBA sliders. It would no doubt be useful to lots of users for development or inclusion in their games. Would you mind putting it on the Unify wiki when you’re finished with it?
I’m working on a suite of GUI stuff at the moment, and I’m hoping to release it all within the next month (or less, depending on how much time I have). I’ll let you know when I have something more polished, and I will certainly post it on the wiki.