Task 022: 360°/180° panoramic camera

Your task is to implement an alterative ray generator (camera, interface ICamera) for our ray-based renderer. Panoramic 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.

Panorama example


You will work in the template application 048rtmontecarlo-script (or 048rtmontecarlo) 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.


You have to implement a panoramic projection (usually called "equirectangular 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. For a 360°/180° panorama, the "image aspect ratio" of 2 : 1 is recommended.
  • 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.

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

Upload of an panoramic image

You will have to render at least one nice panoramic picture and upload it to some public web (Facebook, Google) where such images can be viewed using a panoramic viewer/explorer. Please read the detailed instructions, use all necessary arrangements/settings and upload the image to some public place (Facebook, Google) where I will be able to view it in panoramic mode.


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").

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.

In addition to that, you have to finalize at least one panoramic image for public server upload (Google, Facebook) and send a public URL of your image (interactive panoramic viewer).


Hand in the assignment until: 21. 4. 2019


Basis: 18 points (functional 360°/180° ray generator, arbitrary image resolution, panoramic image on FB/Google),
up to 4 points: bonus for viewing angles parametrization (incomplete panorama),
up to additional 8 points: bonus for interesting/nice new demo scenes..


Visual Studio project: 048rtmontecarlo-script or 048rtmontecarlo

Source file

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

Copyright (C) 2011-2019 J.Pelikán, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)