After dealing with surface properties in our previous articles, we'll go a bit more in depth of what a raytracer allows us to do easily.

One of the interesting property of ray tracing is to be independent of the model of camera, and that is what makes it possible to simulate advanced camera model with only slight code modification. The model we'll explore in this page is the one of the pin hole camera with a conic projection and a depth of field. Another interesting property is that contrary to a lot of other rendering methods such as rasterization, adding implicit objects is the matter of defining that object equation and intersection, in some cases (spheres) it is easier to compute intersection with the implicit object than it is with the equivalent triangle based one. Spheres are one possible implicitly defined primitive. We'll add a new one which we'll call blobs. Finally ray tracing is good for reflections as we've seen in our previous articles, but it can as easily simulate another physical effect called refraction. Refraction is a property of transparent objects, allowing us to draw glass-like or water-like surfaces.

Comments

And what about the beer's law?..

It was in the work.. but then lack of free time outside of my job struck.

It's not dead, I haven't translated it yet.

@guest
Make sure those files are in your "current directory" so that the executable can find them. This has probably nothing to do with programming or C++, but only with how and from where you run your program.

@Ununquadium
I'm sorry this tutorial is 6 years old almost, so I don't have this particular scene file anymore, but you should be able to download the one in the summary for this page and tweak it to get a similar looking scene.

I'm new to Visual C++. How do you add the scene.txt file and the image files to your project? Are they added as resource files? I've copied the code for page 4 just to run it and see what it looks like and I get "Mal formed Scene file : No Scene section.", which is clearly in scene.txt. I am definitely doing something wrong. I went under Project Properties/Configuration Properties/Debugging/Command Arguments and entered "Raytracer.exe scene.txt Output.tga" (without the quotes). Is this the correct way to add the command lines? It can't read the file. Thanks

can you publish or send to me scene file to picture: http://www.codermind.com/files/raytracer/reflectrefract2.jpg

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code>
  • Lines and paragraphs break automatically.

More information about formatting options

Partner websites : LEGREG | GRAPHICS | GRAPHISME | PHOTOGRAPHY | OUT OF MY MIND | ANIMATION MENTOR | GREEN LIVING | VOXEL | RAY TRACING | GUENARDI | Add this page rank counter to your page.