Light attenuation

December 9th, 2009 by

I modified light sources to have a range instead of a falloff. Previously I calculated the attenuation of light with the formula

I/d^2

Where d is the distance to the surface and I is the light intensity. This formula has a quadratic falloff of light just as in the real world however this formula never reaches zero so it is almost impossible to determine when an object is not lit by a light. The first thing I tried was to calculate a range based on the above formula and a predefined value that determines when the amount of light is no longer noticeable. The problem is that the light formula converges very slowly to zero

Light falloff

Light falloff

so either the range got very large or the light cuttoff value got larger. To combat this problem I devised another attenuation formula based on the range of the light itself instead of a falloff and came up with this:

(1 - d^2/R^2)^2

Where R is the light range. The HLSH code also makes sure it is saturated. It looks very good but could definitely be optimized more, for now however I will just use this code. Before I can really use this though I need to clean the octree code because there are some bugs with dynamic lights.

Octree

December 7th, 2009 by

I have partially created an octree implementation. It is now possible to write and convert a scene in maya into an octree. This file is then read by the engine and rendered. It works well except for a few things:

  • Performance drops to about 160 FPS with 80000 polygons. (It was 3000 before)
  • The export seems to have incorrect face winding with mirrored objects. (See the ceiling of the screenshot below)
  • I did not totally implement the octree so there is always one static light and one material.
  • Culling is not implemented. (But also not required for the scene below)

I will work on the implementation this week.

Research project

December 3rd, 2009 by

Me and my friend Marries are working on a research project into different types of renderers. Our goal is to compare forward which is standard to deferred and inferred rendering. These techniques actually all define how dynamic lighting on visual objects is done.

We are programming a rendering engine in C++ that is capable of supporting all theses types of rendering. We developed a complex material system that heavily depends on DirectX HLSL shaders to support all these features. Because we need to support lots of types of rendering for a single material the HLSL effect files tend to grow very large and complex. I noticed this early on in the project and decided to pick up and old interrest of mine: a visual node editing system or node based material system as I prefer to call it. I am creating a stand alone application in C# where a user is able to drag nodes and link them together to form a material. Nodes can have properties that define their behavior in the final effect file. The output of the application is a HLSL file ready to be used by our engine.

Last week we hit a milestone as we were able to use the material system of our engine. We completely decoupled the scene management stuff from the rendering stuff. I wrote some plugins for maya that export content to a file format that our engine is able to load. This week we hit another milestone, the forward renderer is kinda operational.

This project is actually taking a lot of my time. Fortunately I only have two days of college (two full days though) so that gives me lots of free time.

Sis

November 7th, 2009 by

I have been to my little sister who lives in Amsterdam to help her paint her appartement. She moved to her new appartement some time ago but it still needed painting.
I also saw her cat ‘Bokito’ again who staid at my place for a few weeks last year. He is just so cute!

O while writing this we are passing the Ajax player tourbus!

Anyway! I am now on my way to my parents because it is their 25th anniversary.

Update

November 2nd, 2009 by

Long time no blog.. It has been so long that a fresh start is in order.

I am currently working on a few projects so I decided to talk about each of them in a seperate post. In this post I will talk a little about my ray/path tracer.

I implemented a raytracer that is a better than what I had made previously. The result looks very good but I am all but happy with it. The above cornell like scene took about 4 hours to render in full HD on my dual core laptop. I find that disapointing. I am still trying to find out how I can integrate CUDA in my raytracer. I also took the liberty to implement instant global illumination(IGI) but I have not implemented the technique correctly as you can see in the attached screenshot.


Well thats all I will update my blog soon with information about my other projects.