Description


Raytracing engine with simple GUI. Written in C# 4.0. Only source code available. Solution for VS2010.

How to use

Download latest source code. Compile. Run project 'Raytracer' as release with CTRL+F5, click 'Generate' on toolbar, click 'Generate all xmls', wait..., open some xml from "\RaytracerTest\TestScenes"

Features

Simple GUI

gui.png
  • loading and saving xmls (my own format)
  • generating xmls for tests (all scenes are creating from code)
  • generating images for tests
  • testing xmls against generated images
  • scene graph in tree
  • property editor for scene elements
  • popup menu for some tree elements - adding, deleting

Cache system
  • simple cache system for textures, all textures are load only once,
  • unsued textures are remov from memory after some time, they are also remove when cache is full
  • cache size is fixed

Attenuations

atten.png
  • two models: exponential, like in real world, and polynomial like in OpenGL

Camera
  • for now only simple perspective camera
  • each camera have film

Compound materials

mattree.png
  • currently no 3D textures or 3D procedural textures
  • each material property like diffuse, specular highlight can be composed with operations like add, sub, div, mul, alpha blending, offset, transform with 3x3 matrix (offset, scale, rotate), threshold). Those operations forms tree where leaves are textures, solid colors, solid values, procedural textures
  • textures filters: bilinear, bicubic (via kernel approximation)
  • earth on image has been created from textures: clouds, earth, earth height map, land-water black-white. It's hard to see but only water reflects plane below.

Procedural textures

checker.png
  • editable scripts-like classes, compiled at runtime, with no protection, without any help, errors reporting, typical namespaces are injects automatically
  • parameters in scripts which has beeb marked with special attribute are store in xmls and few known types can be edited via property editor

Bump mapping

bump.png
  • only through bitmaps, normals map hasn't been implemented, available with all shapes

Lights
  • only simple omni light has been implemented

Math
  • General purpose classes: Vector2, Vector3, Matrix3, Matrix4, Polynomial, FFT and FFT2 (only Radix-2), ColorFloat
  • Polynomial solvers: algebraic (degree 1,2,3,4 ), sturm (any degree), only real root greater then zero
  • Root finders: Bisection, False Position or Regula Falsi (also modified version which always converge), Secant, Newton, Halley

Each camera has film, each film has postprocessor
  • Postprocessors: Gamma, Tone Mapping (more later), FFT2, Twirl Effect (on image)
  • also internal: SRGBToLinear, LinearToSRGB - rendering is in linear color space

twirl.png

Common shapes like cone, disk, cylinder, sphere, plane, triangle
  • cone

cone.png
  • disc

disc.png
  • Cylinder with camera going through it.

cylinder.png
  • Two spheres and plane

spheres_plane.png

Not so common shapes: torus, superquadric, superellipsoid
  • torus

torus.png
  • superquadric

sq.png
  • superellipsoid

se.png
  • triangle, on image are two textured triangle, this is not a mesh

triangle.png
  • all render directly from equations without teselation

Polynomial surfaces

heart.png
  • render directly from textual equation, on image is so called heart surface
(x^2+9/4y^2+z^2-1)^3-x^2z^3-9/(80)y^2z^3=0
  • render directly from equations without teselation

Resampling
  • exact - directly from interpolation formula
  • localgrid - small grid precaluclated from interpolation formula
  • resizer - only for stratified samplers, works like image resizing
  • .net resizer - same as above, but use .NET for resizing
  • supported filters: box, nearest neighbour, triangle, gaussian, lanczos, mitchell, bicubic

resamplers.png

Samplers
  • stratified: grid, jitter (random)
  • nonuniform: poisson-disc
  • low discrepancy sequences: halton, hamerrsley, sobol

samplers.png
  • samples visualizer renderer

samvis.png
  • fft2 (only radix-2) postprocessor for samples visualizer

fft2.png
  • periodogram renderer (sums fft2)

perio.png

Reflection, Refraction
  • Fresnel terms for non-magnetic media
  • additional layers for relfection and refraction transmittance

hearttrans.png

Shadow testers
  • for solid shadows, transfluent shadows for refractive materials - diffrent versions - trying to simulate good looking transluent shadows with local illumination

solidshad.png

transshad.png

UV Mappers
  • almost each rederable shape has its own uv mapper property. We have: conical, cylindrical, spherical, toroidal. Some of them like toroidal, conical reqiure additional parameters
  • on image you can see torus polynomial surface
(((x*(R+r))^2+(y*r)^2+(z*(R+r))^2+R^2-r^2)^2-4R^2((x*(R+r))^2+(z*(R+r))^2))
with toroidal mapping
toroidal.png

Tone Mapping
  • simple, no HDR

tm.png



My Blog: http://anutom.blogspot.com/

Last edited Feb 3, 2012 at 3:46 PM by tomanu, version 26