Image Generation (Raytrace 3)

I made a number of additions to the raytracer over the last few weeks. They are all a bit bitty and dont need their own post so I will lump them together.

Materials

I have updated the materials, they can now have different types and reference other materials. This is demonstraited by a checkerboard material which uses 3D boolean function to switch between two other materials. I hope to use this to experiment and be able to show off other 3D materials for example different noise methods

Checkboard Material.

Ambient Lighting

Previously we had no way of adding in lighting information – we only have base colour and reflection. I added a simple lighting model which scales the colour by the amount of light recieved. This is done by tracing rays in the half space from the contact – these either return light if they escape the scene, recurse if they hit a surface or black if the depth is reached.

This method is very slow – a lot of rays are cast and I need to add some bounding code to speed up the tracing of rays but produces some ok results.

Ambient lighting – All grey material:

Ambient Lighting.

However the simplistic method i used – just averaging the light rays together is not enough to produce good results in general. I might have a go at adding point lights and looking at how materials reach to lightings from different direction – probably via a book / paper.

Camera

I have separated out the camera and allowed for greater control. It can now be positioned and set to look at a point.

For most of my work (so far) I am interested in rendering a particular 3D object so I added an automatic mode to bound the scene and dolly the camera back until the entire scene was in view.

Cylinders / Entity Directions

For the L-Systems and botanitcal modelling work I wanted to use the ray-tracer to render the scene – to have fun and keep things in house. This required adding a new primitive – cylinders and adding more control over the placement of entities – previous thye could be positioned rolled around the Z axis – now the Z axis can be directed this gives the full space of rigid embeddings.

3D Space Filling.