Showing posts with label weird. Show all posts
Showing posts with label weird. Show all posts

2011/07/16

Weird Voronoi Pro

Finally, I published my professional version of my live-wallpaper. Currently (while I'm writing those words), the live-wallpaper is not available on the Market, BUT NOW IT'S AVAILABLE. I think there's a delay before a paid apps is officially available (I hope it's not too long).

The big changes compared with the free version is the number of functions. First, you can choose a "ratio" as a basic value. For each pixel, before determining its color, the three closest points (according to the distance function used, not necessary the straight line) are found. Let d1, d2 and d3 be those distances. In the free version, the only ratio that exists is d1/d2. Which is the basic one used to draw Voronoi diagram. The background used on this blog is drawn with that ratio. Remember that where there's a Voronoi's edge, it means that two points are a the same distance, so d1/d2 = 1. If the pixel is right on a point, then d1/d2 = 0.

But in this new version, you have access to other ratio, like d1/d3, d2/d3 and (d1*d2)/(d3*d3). You, currently, have 11 choices for this. And the ratio influence the shape of the cells. For the color, only ratio using d1 and d2 make sense. All the other creates weird interaction. But some people might like it.

Second, the functions. For now, the function used to compute the distribution of the color consist of 4 steps. Let R be the ratio, then you have:

  1. x = f(R)
  2. y = f(x)
  3. z = f(y)
  4. c = f(z)

where 'c' is the value used for the color. For each step, you can choose among 55 functions (but let say 54, because if you choose f(R) = 1, then you remove a lot of choices). The default function is f(R) = R.
So, if we consider all possible choices (and ignore those that opposed each other), you have 54^4 possibles functions with 11 ratios. Therefore, you have 93 millions functions available to you.

NOTE that all function are f:[0,1] -> [0,1]. So, by restraining to this interval, it's easier to control at each steps.

Among the functions, there's some that use [?] and [!], two values between 0 and 1. These are values controlled elsewhere in the computation.

  • [?] is a random value that changes for each frame rendered. This value is not stable so it creates effects that some time might look like lightnings.
  • [!] on the other hand is more stable. It's a wave that follow the positive values of a sine. Therefore, it goes from 0 to 1 and then from 1 to 0. It can be used to have a regular effects over the color distribution. By default, it takes 4 seconds to have a full cycle, but it's possible to change the speed.

Here's the qr code and the direct link:

https://market.android.com/details?id=com.blogspot.widgg_research.WVP

Here's some screenshots:



The settings for the function. From the settings, click on "Functions" then "Cell and Color functions". You can see the selection of the ratio first followed by the four steps of functions.





I also post an update for the [!] feature. First, I was using the function sin(pi * t) where t is in [0;1]. But I forgot that this function is not continuous on the first derivative. This mean that at some point, the transition was not very fluid. It was following an half-circle and going fast on the 0 and took a lot of time around the 1.

Therefore, I changed it to cos(2*pi*t) * 0.5 + 0.5. With this, the function is still in the [0;1] range but the transition is very smooth. There's no drastic, unaesthetic, changes. All of this because the this function is continuous on the first derivative.

2011/06/16

Live Wallpaper (some progress)

So, I progressed a lot in developing my first Live Wallpaper for Android. For now, I call this app "Weird Voronoi" because it uses the concept of the Voronoi diagram with some tweaks to create various visual effects.

I had a bit of difficulties to convert directly my fragment shader used on my machine to a fragment shader that can be used on Android with OpenGL ES 2.0. There's some restriction over the language that requires a certain adaptation. But in the end, the result is mostly the same.

Other problem in development, the emulators available cannot run shaders. So I have to debug completely on my Galaxy S. This mean that I know it's working on my phone, but I don't know about any other. I suspect that any phones more recent than the Galaxy S won't have any problem running it.

For now, in the project, I made the majority of the test I wanted to do. To see what are the limits. And actually, compared to a desktop, it's very limited. On my phone, running more than 4 points can be tricky while on the desktop, hundred points is not really a problem. So the objective was also to use this limited amount of points to be able to create some nice effect and I think I managed to do this.

Here's a first images of what the Live Wallpaper will look like:

I took this images from an app I'm developing on my desktop, but the visual effect is mostly the same.

Now that I know the limitation and the possibilities, the main thing left to be able to produce a first version to put on the Android Market is the settings to control the Live Wallpaper.

For now, the common options would be to choose the number of points. Even if 4 on my phone is the limit, there's some benchmark showing that some phones might be able to handle 16 points without a problem. The users will be able to choose if the points are moving, and at which speed. Same thing of the spirals (or if they want a spiral or not).

A variety of functions will be available to choose the right distribution of color. And the possibility to choose between a colored version or a gray scale version.

When the app will be available on the Market, I will give more detail about the features.

Meanwhile, I might post other images of other functions to show other visual effects.