Wednesday, 1 August 2012

Work begins on the Freecad Rendering module

Freecad: Rendering Module

How did it get to this:

I reached a point where work on a new improved sketch plane feature (Github Branch) was coming to a slow down - waiting for jrheinlaenders robust references to be tested and merged into the mainline. The principle functionality was there but surprisingly FreeCAD development has been quiet during July in general which isn't practical after having too much free time after finishing summer term (semester) at University.

I was looking for something I could really get into without having to rely on other developers. Everyone loves shiny things and people always want to show their works to their contemporaries but currently there isn't a  way to really showcase people's great work in FreeCAD.

Currently:

Currently in 0.12 and early releases it can export a view and other scene information into a  Povray compatible scene description. This has to be edited and manipulated to get good results which is something else one must learn. Without being prejudice since I've never used Povray, I think there are more moder render suites available that use better algorithms and provide nice results.

A short list of opensource render:

Freestyle - non-photo-realistic renderer for line sketching 
Lux Render
Aqsis: Open Source Render based on Renderman

Blender's Cycles Render
Yafaray
The above seem actively developed and each distinctly offer advantages in quality, speed and features against each other. Excluding Freestyle, these renderers are unbiased renderers.

Unbiased Renderers?

Unbiased renderers produce realistic results by using a realistic physical light model, without taking short cuts from biased renderers. This is my take on explaining it: Essentially the render simulates the behaviour of a light path and how it changes when it bounces off material surfaces and reaches the camera film. Light sources emit packets of light / photos that are cast throughout a scene, these bounce and react to surfaces and its properties such as colour, direction change. These packets of light 'may' reach the camera and according to the type of camera, different effects such as Depth of Field can be produced like a real camera does by setting its aperture and focal distance.Over time samples build up and this continuous field of samples  generate the rendered output.

Modelling realistic behaviour of light is computational more expensive, and each renderer uses algorithms to locate the packets of light. Initially the rendered images will have noise but increasing the rendering time, more samples can be generated, reducing a noise. This could be from ten minutes to 5 hours, but it depends on the scene.

The overall plan of action

My intention is to liberate the FreeCAD user with these rendering tools but make it both simple and quick to create  realistic outputs but allow more adept users to tweak options. I don't intend for this module to be complex, otherwise the user is more inclined to use a more advanced 3D modeller such as blender.org . I want to achieve by providing a library of scenes that the user can choose from and later allow options to manipulate the scene. 

There are many different renderers to choose from and it's sometimes not best to 'put all your eggs in the same basket'. I decided that creating an abstract interface to allow different render plugins to be developed would give users the flexibility to choose what renderer they wanted. It would also allow proprietary renderers to be used providing that they used a scene file format.