Simple and Easy Ray Tracer

This is possibly one of the simplest ray tracer, written not to technically achieve anything, but to understand the basic theory. This code is minimal, written in C, uses just the algorithms needed to trace, very less pointers usage, and no use of any external libraries other than ones which come packaged with Gcc by default. The code implements the following lighting models: ambient, diffuse, specular, hard shadows, reflections and one sided refractions. Please find the download link after a sample output, it is shared with the most relaxed license.

Generated Output

DOWNLOAD [ZIP] [16KB]

This was done for a one day workshop at BITS Pilani Hyderabad Campus few days ago (for their technical fest ATMOS). The challenge was to teach introduction to computer graphics and the basic theory of ray tracer, in one day, to a wide range of undergraduate students who may not be coming from a computer science background. I hope the students gained something and found it interesting.

Our team: Adi Shayan, Sneha Venkatraman, Yash Agrawal, Shiben Bhattacharjee, Naveen Kumar, Nitish Tripathi

5 thoughts on “Simple and Easy Ray Tracer

  1. Hi, can you explain a little bit how the objects creation works? , the sphere's ecuation is X^2 + Y^2 + Z^2 = r2, and in your code are many triangles, in the camera struct they are some position and look (obviously), but these vectors hori, vert, up.

    Like

Leave a Reply to Anonymous Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.