1. icon for News
  2. icon for TCHOW


Friday, May 17, 2013

Stylish [Rain]bows

Today's hacking on Rainbow proceeded under Linux with OpenGL3 for output. I've built a helper class that should (fingers crossed) mean that everything transitions cleanly to OpenGL ES (at least as far as streaming vertex attributes).

Today, I worked on making the rainbow draw more nicely. The first step was to start using a special purpose shader.

The shader takes the position of each vertex and three info values -- the index of the frequency band, the position within the frequency band (shown above), and an alpha value which modulates the band's transparency.

A 1D profile texture (with mipmap) provides "fake" antialiasing, while a 1D color texture tints each band.

The above screenshot also shows off, to some extent, decent bow overlapping. In the Javascript version of Rainbow, overlapping is depth-buffer based (basically, bands are ordered based on the amount of time they've been controlled). This wasn't really satisfying, because it could result in hard edges where band orders switched.

This shows my first attempt at resolving the overlap problem by adding smooth fades. Unfortunately, without some sort of matching fade out, there are slight edges induced (especially in the infrared and ultraviolet). Solving this is going to involve slinging a fair number more dynamic vertices around, so I'm going to jump back to iPhone and see how my performance is faring before getting too far into things.

No comments:

Post a Comment