Posts tagged with 'Curves'

Functy 0.24 released

  • Posted on May 29, 2012 at 7:26 pm

I’m very pleased to announce the release of Functy version 0.24, which can now be obtained from the downloads page.

The main changes from the previous version are the following.

  • Addition of the new curve function type. This complements the existing Cartesian and spherical functions by allowing parametric curves to be defined with cross-sections based on cylindrical co-ordinates.
  • All function types can now be rendered either using the CPU (as before) or entirely using the GPU.
  • GPU rendering provides per-pixel lighting calculated using the derived normal function (rather than using interpolated normals as used by most per-pixel algorithms).
  • Available for Windows and Linux, and also as a new ARM Debian version for use with the Raspberry Pi.

Functy is still very much a work-in-progress, and won’t be entirely bug-free, so if you stumble across a problem or have any difficulty with it please let me know.

Enjoy!

Working Curves

  • Posted on May 28, 2012 at 8:00 pm

The latest version of Functy in the repository now has a (roughly) working version of the curve rendering code. This allows a cylindrical coordinate cross section to be extruded along the length of a parametrically defined curve. In other words, something like a tube.

The code is fairly incomplete. Trying to define functional colours will cause a crash, and vertices are all positioned on the CPU, so that animation isn’t particularly efficient. Both of these should be fixed soon, including GPU rendering of the entire curve.
Here’s a brief video demo of this early code to give a flavour of how it can be used.

The Art of Good Design?

  • Posted on May 24, 2012 at 1:42 am

Designing a really good library is a difficulty task. Since around August last year I’ve been writing a program called Knot, which I also recently open sourced. This makes extensive use of 3D Bezier tubes to render Celtic Knots, and having written the code for this, it seemed sensible to try to integrate it into Functy, to allow arbitrary tubes to be rendered using curved cylindrical coordinates. So, that made it a perfect candidate - or so I thought - for implementing as a library. This way, improvements from the Knot code could be easily merged into Functy and vice versa.

Designing the library turned out to be tricky, especially the task of managing and animating all of the curves. I figured that if I put the effort in to getting the library right, it would make the process of integrating into Functy that much easier.

I was wrong. After painstakingly implementing everything needed in the library, I tried to integrate it into Functy, only to realise that Functy already has all of the management and animation functionality needed. Given that I wrote the Functy code, you’d have thought I might have know this.

The consequence is that I’ve ended up dropping all of the curve library methods and cut and paste the relevant code straight in to Functy. If I hadn’t done this Functy would have ended up with two totally separate lists of functions, two separate animation steps and two separate update steps. It would have been a mess.

It’s taken longer to modify the curve code for Functy as a result, but the final structure is much better. Unfortunately it also means the library is now redundant. I’ll have to find some other use for it.

There’s a design moral to this story I’m sure, but I’m not exactly sure what it is. I’ve ended up with a nice clean library implementation that doesn’t work for what it was designed for, a new implementation that doesn’t use this library, and what seems like a lot of wasted time. It feels like somewhere something went a bit wrong. At least Functy can now render curves, so even if it was a circuitous route, maybe the journey wasn’t entirely wasted after all.

Curvy Screenshots

  • Posted on May 7, 2012 at 2:16 pm

The Curves library is currently being integrated into Functy in order to provide parametric tubes to be added to function scenes. To give an idea about the sort of results this might allow, here are a few screenshots taken from the development version.

In all of these images the tubes follow a path constructed from cubic Bezier curves:

((((1 - a)3) × P1) + (3 × ((1 - a)2) × a × D1) + (3 × (1 - a) × (a2) × D2) + ((a3) × P2))

where a is the parametric variable, P1, P2, D1 and D2 are the control points. It’s a bit crazy using Bezier curves for this since the library could handle a spiral far more easily, but it was just a product of the way the demo developed. For the first image the function used for the radius was the following.

((2 - cos((((s × a) + o) × 6 × π)) + (sin ((12 × p)) / 5)) / 2).

Here a and p are the parametric variables for the position along the curve and angle around the radius respectively. The values s and o are offsets and scaling factors that are changed for each quarter-circle segment of the spring.

The intention is to allow these functions to be entered directly into Functy to generate curves such as these. There’s still quite a bit of work to be done. Although the Curves library is coming along, this still needs to be integrated with Functy, and the shader code for these parametric tubes also needs to be implemented (it’s certainly possible, but I’m anticipating problems!).

Top