|
Aims | Current
state | Simulation results and Discussion
| Source code and binaries | References | email: golas at cs dot unc
dot edu |
Aims:
This assignment had the following aims:
I
have implemented soft shadows for area lights, and depth of field. For
reference on both, I referred to ‘Realistic Ray Tracing’ by Peter Shirley.
Soft Shadows:
A new
arealight class has been added to the types of light sources available. A
modification to the base light class was made to allow the system to identify
which lights can result in soft shadows. An area light is assumed to be an
infinitely thin circular disk with a specified location, radius, and
orientation. Using this specification, the shading system for each light was
changed. Earlier, the shader was given a list of visible light sources by the
renderer in advance by doing visibility tests. Now, in addition, a list of
weights is provided which provides a measure of visibility of a light source.
For backward compatibility and by common sense, point light sources carry a
weight of 1, as they are added to the list only if visible. For area lights, a
certain number of visibility testing rays are shot from the point of interest
to randomly jittered locations on the area light disk. The ratio of the number of
unoccluded light rays to the total number of light rays shot, determines the
weight for the light source.
Depth of Field (DOF):
For
adding depth of field effects, the camera base class has been updated to allow
for DOF effects for any camera. A jittered sampler has been added to seed
points on the disk containing the virtual lens. The input specification for a
DOF enabled camera requires the additional parameters of focal length,
f-number, and distance at which to focus the camera. The modifications to the
rendering algorithm are minimal. More importantly, the image plane is moved to
the distance s, at which the camera is to be focused, and is scaled
appropriately in order to capture the same field-of-view as earlier. The radius
of the lens is also calculated from the f-number (radius=focal
length/2*f-number). The modification to the rendering algorithm is only that
for each sampled ray shot, a jittered source is calculated using the jittered
sampler added to the camera class. The number of samples value for this sampler
is taken from the samples-per-pixel value provided for the scene.
Other Comments:
With
this version I have added the following features/fixed the following bugs:
·
Fixed problems with triangle normals and intersection code which
were causing incorrect rendering
·
Fixed some of the problems with the parser which gave incorrect
inputs
·
Added optional SMP (by one simple OpenMP directive!)
Still
to do:
·
Add a ray pipeline approach for better spatial coherence in
large models and improved
·
Add texture support and transparency
·
Add .obj support for better models
Simulation results and
Discussion:
Soft shadows:
For
demonstrating soft shadows, I use the following scene:
The
following are renderings of the same scene with varying radii of the area light
source:
The
above scenes are rendered with area light source 5 units, 15 units and 25 units
respectively, where the sphere is of radius 5 units and the light source is ~140
units away. As is expected, with increasing source radius, the radius of the penumbra
increases proportionally. The rather unsightly bands of color on the sphere can
be attributed to the highly specular material of the sphere in the render. The
examples used 100 samples per pixel to determine light visibility, and 9 rays
per pixel, though I believe similar results can be obtained by using lesser
number of samples for determining light source visibility.
Depth of Field:
A
sample scene with balls distributed throughout the scene at varying distances.
Base scene with no
DOF:
Scene
with DOF, with varying focus (f=10, f-number=5.6):
S=15 S=30 S=45
Where S is the distance being focused at. The
S values correspond to the centers of the 3 smaller circles. The results are as
expected, with the objects coming into focus when the camera is focused at
them.
Scene
with DOF, with varying f-number, focused at S=15 (f=10):
a b
c d
The same scene is shown above with f-numbers
a - 0.6, b - 1.2, c - 5.6, and d – 11
The set shown above confirms the obvious
theoretical projection that smaller f-numbers, meaning larger lenses, will
result in images with more blur. The above images are at 36 samples per pixel.
Though higher number of samples, as expected, results is clearer images, I
noticed that any number of samples less than 16 samples per pixel results in
unacceptable graininess in images, while the range 16-36 samples per pixel has
images which are still of poor quality. All the above renders were done for a
film size of 30x30 units.
* Copyrights of their respective owners
Site last updated: Monday, September 8, 2008 12:00 AM