Skip to content

AndyLow14/CSharp-RayTracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c# Ray Tracer

Name: Andy Jun Cheng Low
Student Number: 1136438
Username: ANDYJUNCHENG
Email: [email protected]

Completed stages

Stage 1
  • Implement vector mathematics
  • Fire a ray for each pixel
  • Calculate ray-entity intersections
  • Output primitives as solid colours

Stage 2
  • Diffuse materials
  • Shadow rays
  • Reflective materials
  • Refractive materials
  • The Fresnel effect
  • Anti-aliasing

Stage 3 - Add-ons
  • Option A - Emissive materials

  • Option B - Ambient lighting/occlusion

  • Option C - OBJ models

  • Option D - Glossy materials

  • Option E - Custom camera orientation

  • Option F - Beer's law

  • Option G - Depth of field

  • (Glossy Materials) Glossy materials have a reflective component and a diffuse component, we choose a suitable ratio between the two to obtain the desired glossy effect

  • (Beer's Law) Calculate the light absorbance of a material, depending on the color obsorbence of the material

  • (Depth of field) Shoot a ray through the pixel with a fixed focal length to find the focal point, fire multiple random rays within a circle about the camera determined by the aperture size throught the focal point and obtain an average color

Final scene render

My final render

Rendering time 10 minutes and 13 seconds.

With the following command:

dotnet run -- -f tests/final_scene.txt -o output.png --aperture-radius 0.01 --focal-length 0.8

Sample outputs

Sample 1
dotnet run -- -f tests/sample_scene_1.txt -o images/sample_scene_1.png -x 4

Sample 2
dotnet run -- -f tests/sample_scene_2.txt -o images/sample_scene_2.png -x 4

References

About

A C# implementation of a ray tracer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages