Task 022: Alternative camera

Your task is to implement an alterative ray generator (camera, interface ICamera) for our ray-based renderer. Your new camera has to be tested in a sample scene. You might want to create a new better scene to demonstrate (panoramic) capabilities of your camera.

Fish eye example

Basis

You will work in the template application 048rtmontecarlo or 048rtmontecarlo-script from the repository grcis. There is the form capable of choosing a scene from a list-box, setting up various options.. After pressing the "Render" button, the scene will be rendered and the result image will be displayed in the form window.
Use the MonteCarloRT.cs source file for your implementation, you will send me this file as a solution of the assignment. You can create new classes (minimally the one implementing a new camera model), data structures, etc. Definition of your scene (CustomScene.TestScene()) is in this file as well. Text parameter Param: will be passed to the construction function.
If you want to test our new feature - definition of a R-T scene using CSharpScript, please use the 048rtmontecarlo-script project and put your scene definition into a new .cs file (be inspired by builtin scenes in the directory data/rtscenes/). Scripts have access to the text parameter Param: as well.

Details

You have to implement an alternative projection and make it accessible for the ray-tracer using the interface ICamera. You have to get familiar with following concepts and components of our ray-tracing library:
  • ICamera - primary ray generator, general interface, you have to implement it in your new class. The basis of the interface is the GetRay() method, called to create a new primary ray. There are properties: Width, Height and AspectRatio, they define target image geometry (in real image plane). After changing the AspectRatio, the image height will be recomputed, the current image width stays the same.
  • StaticCamera - simple camera implementation of a linear perspective (projection from a central point to a rectangular image plane). Concrete instance of the camera is naturally defined by the Center of the projection, the View direction, the Up vector (wanting to be rendered as vertical in the result image) and the Horizontal viewing angle in degrees. You can take inspiration from this simple and straightforward class.
  • RayScene - data object containing data of the whole rendering task. You have to include your new camera instance in it and replace default StaticCamera instance. To show capabilities of your panoramic camera you may want to extend some standard scenes - see RayCastingScenes.cs source file (just rename any class and copy it into the MonteCarloRT.cs source file).
For your convenience, there is a InitializeScenes() function able to define default values of Form elements (checkboxes), image resolution and so on. This function will be called once in the application startup, before showing the Form1 window. Don't forget to return your name in the out string name parameter!

Survey of relevant concepts and components of our ray-tracer architecture can be found in this PDF presentation.

Ideas

Fisheye - nonlinear lens with very wide viewing angle (up to 180°). You will have to to use the posibility to return the false value from the API function GetRay() - for all the invalid (out of the image circle) projection plane points..
Panorama page on Wikipedia - direct drawing of a wide-angle (panoramic) image using alternative projection surface (usually a part of cylindric surface). In extreme way we can use the whole 360° envorinment around a viewpoint.
360°/180° "equirectangular" panorama - panorama containing view of the complete environment around a viewpoint. In realtime/HDRI we often use the simple mapping [azimuth,elevation] (thus the name "360°/180° equirectangular").
Omnidirectional photography - description of many special lenses and imaging systems, you might be inspired by some of them..

What to hand in

You must send the modified file MonteCarloRT.cs. Please include interesting settings, new scene[s] and camera positions into list-box options in the form.

There is an option to define your scene in a CS-script file (see the 048rtmontecarlo-script project), you have to hand in a script file together with your source file. Script format: see the data/rtscenes/ directory in the repository.

Deadline

Hand in the assignment before: 16. 4. 2018

Points

Basis: 18 points (functional ray generator, at least one new test scene),
up to additional 8 points: bonus for interesting camera, implementation or parametrization
Bonus points for interesting scene will be assigned via the task 061, the scene must be defined using a CSscript! Please leave a note in the mail body that you ask for bonus points for the scene.

Project

Visual Studio project: 048rtmontecarlo or 048rtmontecarlo-script

Source file

Modify and hand in the source file: MonteCarloRT.cs
Edit your name in the InitializeScenes() function!


Copyright (C) 2011-2018 J.Pelikán, last change: 2020-02-17 00:43:03 +0100 (Mon, 17 Feb 2020)