Thursday, 28 October 2010

Soft Shadows in ASTrace

Here is a nice example of fully antialiased soft shadows. The source light uses about 20 seed points spread out using a pseudo-random function, to produce reasonable effects.

Wednesday, 27 October 2010

Improved Supersampling and Antialiasing

I decided to improve the supersampling/antialiasing methods in my raytracer. Previously I applied a blur filter to the image after upsizing and then returned the image to its original size. This is not a very realistic or accurate antialiasing method so I decided to add some real supersampling to the raytracer. The two images below both have the same resolution, but the image on the right appears more realistic with fewer jagged edges. This is achieved by firing multiple rays for each pixel, and based on their relative position, calculate their contribution to the colour of that pixel. The obvious downside to this method is a largely increased rendering time, proportional to the number of rays per pixel. This means that 16 rays per pixel takes 16 times longer than a single ray. Quality definitely comes at a computational price. I think randomising the rays may improve the antialiased image quality, instead of firing them across a uniform grid and I will look into that.

The next updates are likely to be cloud maps and a sun object (infinite directional lighting).

Monday, 25 October 2010

Perlin Texturing in ASTrace

I've added simplex noise volumetric texturing to ASTrace. I found this nice little Simplex noise class by Sjeiti and implemented it in the library. Simplex is slightly faster than Perlin noise in 3 and 4 dimensions so it is ideal to use as a volumetric texture for primitives in the tracer, here are a few examples:

As an extension I decided to create an animation using 4-dimensional simplex noise, just click on the image to launch it. I am planning on implementing a cloud sphere, and this would be ideal for animations of clouds:

Thursday, 21 October 2010

Material Properties

Choosing the right material to represent a particular object is important when producing realistic 3D graphics. Factors like refractive index, specularity, and reflectivity all affect how we perceive an object both in the real world and on screen, so ideally the real world case should be simulated as closely as possible in its computer based counterpart. The three images below show how differing physical features completely change the appearance of a scene. In the top image the sphere is 100% reflective, in the second it is partly transmissive and partly reflective and in the last image, the sphere is fully transmissive with a refractive index of around 1.08. I am pleased with the results I am getting from the raytracer, but adding more features increases the render time dramatically, especially for large numbers of objects. I am looking into porting the library to C++ for use in alchemy, which would show a dramatic increase in speed, possibly rendering scenes like the one below in real time. Till then here is the library.

ASTrace Pre Release

Although the library is nowhere near complete, I thought I would release a beta to see what you think. At this stage feedback would be really useful, including any suggestions you might have about extensions to the project. I should note that there is no documentation as of yet, this will be coming as soon as I manage to get asdoc to run properly. There should be plenty of scope for you to play around with the library, it'd be great if you could send me some of your renders.

Here is a link to the library: ASTRACE

and here are some of my favourite renders using the library:

Monday, 11 October 2010

Some more ray tracer features

Here are a few more demos of new raytracer features:

Water (with transparency and reflection):

Environment and Texture Mapping:

Fog - Linear, Square and Exponential decay

Visible Lights (ideal for rendering sunlight, lamps etc):

Soft Lighting (one soft light with 10 seeds - therefore only noticable on some shadows):

Triangular Faces:

Transparency (with refraction, internal reflection etc):

A few more features are on their way (including UV mapping, environment mapping, and Fresnel shaders) and once those features are finished I will release the library.