Task 079: Implicit surface for ray-tracing

Your task is to implement a general implicit function as a new solid (ISolid) to our ray-tracer. The new solid will be defined using a function F - the formula is F(x,y,z) = 0.

Implicit flake (c) 1999 Andrei Sherstyuk

You have to implement a general algorithm for ray-surface intersection and prove its functionality by rendering some implicit surfaces, prefereably including some form of parametrization. There is no need to implement symbolic formula evaluation, you should concentrate on intersection calculations.

Ideas

Literature about ray-tracing of implicit surfaces:

Math: function roots can be found using some classical method, bisection, Newton iteration, Fibonacci search, etc. More efficient approaches will be rated by bonus points, but I recommend implementing some naive algorithm first (for debugging). Intersection point and normal vector accuracy is our priority (i.e. no artefacts on shape contours).

Technical details

Your solution will have two parts: you have to create a new class for implicit surface solid and you must use the new surface in at least one ray-tracing scene (C# definition function or CS-script).

1. New solid

The new class must implement an interface ISolid. You have to implement two functions: Intersect() and CompleteIntersection() (see C# ray-tracing page for details).
Recommended procedure is to create a new class as an descendant of DefaultSceneNode. See the class Sphere for inspiration. Your class declaration could look like:
public class ImplicitSurface : DefaultSceneNode, ISolid { .. Do not forget to compute correct normal vertices (tangent vertices) in the second function CompleteIntersection().
Implicit surface parameters can be defined in a constructor, it is recommended to use function delegates (and lambda expressions) for this purpose.

2. 3D scene

Your new solid will be used in the scene definition (CustomScene or CS-script), you might want to modify light sources, materials, camera angle, ..
To make a new scene public, you must insert it in the list-box (see the InitializeScenes () function) or you can use a new .cs file with the CS-script code.

What to modify

You have to add your new classes (implicit surface, any support classes, ..) into the MonteCarloRT.cs file, scene definition is in the CustomScene.TestScene() function. If you will prepare more sample scenes, please create more scene-initializer functions and keep all of them accessible from the list-box (see the InitializeScenes() function). Scene-construction function is called with the string parameter Param: from the form.

If you want to define your scene using CS-script, you have to use the 048rtmontecarlo-script project instead, your scene-definition script will be in a separate .cs file (see the data/rtscenes/ for inspiration and scripting instructions). Scripts have access to the text paramter Param: as well.

What to hand in

You must send the modified file MonteCarloRT.cs. You can include a couple of nice pictures.

In case you will be using 048rtmontecarlo-script project, you must include your scene definition[s] in separate file[s]. Script format: see the data/rtscenes/ directory in the repository.

Deadline

Hand in the assignment before: 10. 6. 2018

Points

Basis: 25 points (at least one nontrivial implicit surface, intersections and normals must be ok),
Bonus points: for more interesting surfaces, efficient computation, etc.

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!
Don't forget the .cs script if you are defining your scene using CS-script.


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