Tuesday 12 August 2008

Lighting and texturing

It's been a hectic few days, what with house guests and trying to keep Buttercup (my Landy) running. Actually she features in most of the example image processing pictures, but I digress.  With limited time only had a chance to fix the coordinate systems in cudart - the y axis was inverted right from the first version which hasn't really been a problem until the surface normals weren't in the usual direction causing a bit of a debugging headache. 

[caption id="attachment_117" align="aligncenter" width="400" caption="Colours and reflections"]Colours and reflections[/caption]

Next I've added reflections, still need a bit of work on these, but they are giving an acceptable surface reflection. (see attached images).

Although rather obvious, adding additional light sources really slows down the system as at every intersection we need to construct a ray to every light source (shadow rays).  Using very few lights while still illuminating the scene effectively is quite a challenge if you don't want the light to appear flat and uninteresting. Playing with the equation for the light surface interactions and the intensity falloff seem key to this.

Texturing, like lighting is very important to a scene. Decent texturing can really enhance a scene without increasing the geometric complexity thereby saving massive amounts of time in a raytracer (even with acceleration structures in place). Texturing does have its problems though and your sampling - especially at the edges or where the incoming ray / surface normal are nearly zero - will make a massive difference to the final quality of the image. Although I still have not got texturing going, I do have the barycentric coordinates http://en.wikipedia.org/wiki/Barycentric_coordinates_(mathematics) and have written some sampling code to attempt to get rid of edge artifacts. An even bigger boost to image quality comes from varying the surface normals according to your barycentric coordinates. This gives a massive apparent increase in geometric complexity with very little overhead.  Basically this will be procedural bump mapping although I do want to implement texture based bump mapping too.

Finally some pictures - still the old triangle on a ground plane boring stuff.  Watch this space for a Cornel box :)


No comments:

Post a Comment