Submission to Assignement 2 (PDF)

Ray Tracing & Curves and Surfaces


  1. Raytracer
    1. Simple Raytracing:

        The method makes it possible to see something on the screen. As the objects could be arbitrary deformed it would be tedious to get the formular of the surface to make an intersection testing possible. To handle the problem easily, not the object but the ray is transformed to primitive space. The ray is inserted in the spere equation and this is solved.

        The functionality is implemented in the sphere class of package scene. Pixel by pixel it determines by itself if it's hit by the current view ray or not. If so it returns a hitPoint to the raytraceableScene class which draws it on the given canvas (screen). To obtain the correct colour for the pixel the normal at that point has to be calcullated. This is done by the normalAt method.

      pic of raytraced deformed spheres

    2. Shadows

        When calculating the light at the point of interest, the light has to cast a ray towards the point of interest and determine if there is anything in the way. If the light source can’t actually "see" the point at which the illumination is required the light class returns a null directional component. So that particular surface point is not painted an thus appears as in shadow.

        For this part of the Raytracer the directionalLight class has to be altered, as the illumination is not done by the object of the scene but by the different light sources. To make use of a second type of light source, the point light, it would be necessary to implement the illumination method. This wasn't done by me as the scenes only consisted of spheres in directional light, but it would be a could exercise for everyone to get to knoe illumination.

      pic of 'face' with shadows

    3. Reflections

        For reflective objects, the normal Phong surface colour is calculated first and then a reflection ray is traced. The colour along that ray is multiplied by the given reflfective colour of the surface and added to the accumulated surface colour. Refraction is not implemented.

        The implementation is done in the corresponding class, namely PhongMaterial . If the current surface point does not lie in shadow a ray is casted in opposite to the direction the light comes from. It's tested wether there is any object in the way. If so the objects colour is partly added to the current point's colour. Recursive reflection is implemented up to a boundary of depth five. The implementation would do more, but more is not necessary as one can't recognise reflections of order three.

      reflections in the eyes

  2. Curves and Surfaces
    1. Prove that the Hermite curve is invariant under translation!

        Done on paper. Maybe coming soon as PDF/PS!

    2. Equation for a quadratic B-spline with three given control points:

        Done on paper. Maybe coming soon as PDF/PS!

    3. Derive the Catmull-Rom basis function!

        Done on paper. Maybe coming soon as PDF/PS!

      1. Prove that the quadratic Bezier with the following 2D homogenous coordinate control points defines a 2D quarter circle: (0,1,1), (sqrt(2)/2, sqrt(2)/2, sqrt(2)/2), (1,0,1). Where is the centre and what is the radius?

          Done on paper. Maybe coming soon as PDF/PS!

      2. Using the result from (a), what would be the control points and knots for the equivalent quadratic NURB curve (still in 2D)?

          Done on paper. Maybe coming soon as PDF/PS!

    4. Your job is to write a program that displays a wire-frame mesh of a given point representation of a teapot lid. must write the code to display the mesh yourself - you are not allowed to use the NURBS-rendering capabilities provided in the OpenGL GLU package. The user should be able to rotate the image using the virtual trackball. There should be a single text field (or slider if you want to be a bit more fancy) in the output window that allows control of the degree of subdivision of the mesh. You should allow a variation from no subdivision (i.e. s and t take the values 0 and 1 only for each quadrant) through to some suitably fine structure.

    5. Extension of previous task: include a check box that, when checked, causes the teapot to be displayed Gouraud shaded rather than by a wireframe.

[ Back ]

eMail me! :)