Thursday, 23 September 2010

Reflective Recursion

With the exception of refraction, which I am not yet happy with (total internal reflection problems), the raytracer is coming together fantastically. This is my favourite render so far featuring diffuse and specular reflections with 2 pass antialiasing. The image was rendered at 2200x1600 and cropped to give the final image:

Not bad for flash, about 30 minutes render time.

Once mathematical problems with internal reflection are fixed I will be releasing the library under an open source license, let me know if you have any last minute requests!

Below is a similar image but rendered to 3300x2400 pixels in about 90 minutes:

Monday, 20 September 2010

New Ray Tracer Features

I mentioned a short while ago that I was creating a brand new ray tracer for actionscript 3. It is beginning to take shape and I thought I'd run through a quick feature list:

  • Objects: spheres, planes, boxes - triangular meshes in the pipeline
  • Materials - reflective, transparent, bitmap
  • Unlimited reflection and refraction (within reason)
  • Direction lighting (multiple light points)
  • Phong shading
  • Camera with 6 degrees of freedom
  • Sky object - simple sky rendering
  • Save output as .JPG, .PNG or .BMP
  • Render progress
  • Color lights
  • Soft lighting
  • Low resolution real-time rendering (for small numbers of objects/lights)
  • Antialiasing and effects
  • Anaglyph rendering

No doubt the feature list will grow and let me know if you have any requests. I would really like to have curved surface and formula collisions as part of the package, so I'll try to get this working then release the library under the name ASTrace. Currently the first below (10 spheres, 1100x800 resolution, 1 light) renders in about 10 seconds which I am very happy with, and the second scene (30 spheres, 1100x800, 1 light, 10 reflections) in about 150 seconds - not so good, but not bad.

I will post demos up as I make them, here is one showing reflection and planes. It looks like there is something wrong with the reflections despite the render looking fantastic, so I will look into that (100 seconds, 1100x800):

Another nice demo, still haven't fixed the reflection problem though:

A new example with the reflection problem ironed out (50 spheres, 2200x1600, about 15 minutes):

An example showing antialiasing and plane/sphere reflection:

Sunday, 12 September 2010

Underwater Scene

Just created quite a nice little underwater scene, with bubbles and lighting. Just need to add some fish! I've been finding it quite relaxing just to watch. It is completely dynamically resizable just like the cloud background I made a few months ago. Click to launch it.

Saturday, 11 September 2010

Conway's Game Of Life using Pixelbender

Couldn't resist trying to create a pixelbender filter for use in the Game of Life. In an article a few years ago I created a simple Life application. Pixelbender has the potential to massively increase the speed of calculations such as those used in Life, the results are obvious. On top of this the simplicity within flash is fantastic, to advance the game you simply need to apply a filter to a bitmapData object. Click to launch the app:

Experimentalized - New Look

Just updated my homepage, check it out here.

Real Time Regional Differencing

I little while ago I produced a method for extracting interesting regions from images which I called regional differencing (see post). I have optimised the code, and it now runs in real time. It works very well as a simple edge detector with the ability to produce much thinner lines than the Sobel detector, notice in the image below the maximum line thickness is one pixel. The algorithm works by comparing more and less pixelated versions of an image to find local differences compared to a local mean.

To improve the algorithm I switched from the RGB colour space to NUV as this improved results (albeit reducing performance marginally). The detector doesn't quite have the quality of something like the Canny detector, but it requires a lot less processing which in flash is very important!

Anyway check out the demo by clicking on the link below, the slider changes the pixel size of the comparison bitmap, with some interesting results. The default settings use a size of 2 pixels producing lines of a maximum one pixel thick.

Friday, 10 September 2010

Visual Human Interfaces

Making human interfaces intuitive, simple and accurate is a huge challenge. Some of the biggest challenges lie in the field of motion and gesture detection. Analysing visual data in real time can be very processor intensive.

This is a fairly simple implementation of an interface which has the ability to track on screen button presses and swipes (it is part of an ongoing research project):

Click to launch a demo video:

Monday, 6 September 2010

Crossfade Using Pixelbender

I am currently doing some work for a client which involves background subtraction. I have been getting into using pixel bender to calculate filters in flash for a while now, but doing some research I found there is actually huge scope for using pixel bender to carry out other calculations (see this article).

The following example uses pixel bender as a part of the background subtraction process. Consecutive frames from the webcam are blended with all previous frames. The eventual result is to produce a good estimate of the background pixels. The example uses the blendShader property of a display object with blend mode set to BlendMode.SHADER, and a custom Pixelbender shader that mixes pixels. Check it out (click to launch):