Powered By Blogger

Sunday 3 July 2011

First raytracing tutorial

If you read just the FIRST page from this webpage, it goes into a lot of details of how raytracing works.  It also has pictures.  We won't be using his code as our first tutorial, it's pretty complicated for beginners.  So don't download the code.

http://www.flipcode.com/archives/Raytracing_Topics_Techniques-Part_1_Introduction.shtml

  So let's take a look at the code we will be trying.  It's really small and thus makes a good starting point.  It simply draws a sphere and has ambient light.


  They are using OpenGL for the tutorial.  I am using SDL.  So I am converting it to use SDL without hardware acceleration.  If we need higher frame rates I will change it from software rendering to hardware rendering using OpenGL, which will run under Linux and Windows.

http://www.dawnofthegeeks.com/software_rendering/index.php?section=c&page=lesson24

links to the code.  One file is for doing the graphics, the other for doing the raytracing.

http://www.dawnofthegeeks.com/software_rendering/resources/lesson24.cpp
http://www.dawnofthegeeks.com/software_rendering/resources/core.cpp

and

http://www.codermind.com/articles/Raytracer-in-C++-Introduction-What-is-ray-tracing.html




No comments:

Post a Comment

Note: only a member of this blog may post a comment.