??? 06/10/10 06:15 Read: times |
#176577 - You need more levels. Responding to: ???'s previous message |
Chico Magalhães said:
Andy, nice would be solving my problem...
What is bothering me is the color "jumping" every 5 increments red sudenly ligths off. Of course you get jumping. That is because an index formed by merging of the R, G and B steps into a combined integer must produce jumps. You don't animate from one color to the other by stepping an index one step up or down. You do it by computing how much to increase or decrease R, G and B. If you really do have an indexed solution, you then scan through your index table to find the index that is closest to the wanted full-color value. A GIF image can have at most 256 colors. But each color can be defined as a full RGB triplet. The program that converts a full-color image to GIF will have to create a color palette that spans the full color space. You have been given an example of such a palette earlier in this thread. It's the HTML color palette available by almost all web browsers. The program that converts a full-color image to GIF then takes each and every full-color pixel and matches against the available palette to find the closest match. As an improvement, the program then computes the error and feeds this error to neighbour pixels. The same can be done when animating a color - step the animation fast enough and feed the error to the next time slice. If you step time at 200-500Hz, then you can modulate between two or three indexed colors to create an average. An index (0..124) is a onedimensional value. It just can not span a two-dimensional (color circle) or three-dimensional (color-cube or color-cone) color space without folding. And this folding, where you cut the two or three dimensions into ribbons and place after each other do give the effect you see. You can reduce the effect by using a space-filling curve. Draw a line in zig-zag over the color circle/cube/cone and make sure that the zig-zag starts and ends at the same place. That is the only way that you will get a small (as small as you can get with as little as 125 steps) color change between each and every neighbour lookup value for the index. But the video you like is nice because it has smooth toning. You have explicitly said that you are not interested in smooth toning. And without smooth toning you will not (!!!) get the nice effect from the video. To match the video, you need support for thousands of color combinations. You would get close with Eriks alternative with 32 levels for each color channel. 5 levels/channel (which is 4 non-black levels) is not even close to managing what you want (but claim that you do not want). Chico Magalhães said:
I know I cant get that smoothness in transitions, what I need is the color sequence/table. But you do know wrong. You can not (once more N.O.T.) get that smoothness with a PWM solution only having 5 steps. An analog solution with 5 steps could produce more tonality by applying oversampling and PWM. But you can't overlay PWM on a PWM solution - or at least it would be very stupid to try such a thing since any PWM solution supporting that would from the beginning have supported a higher resolution. |