3D Lighting and Shading in C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
json
math
ppm
raycaster
Makefile
README.md
main.c

README.md

Illumination Jarid_Bredemeier

This is a graphics application that implements a raycaster which creates a PPM (Portable PixMap) image of mathematical primitives drawn from a JSON (JavaScript Object Notation) file. The data is loaded into pixel buffer where specular and diffuse reflection components are added to the scene of objects to produce lighting and coloring effects.

Screenshots

Usage

raycast width height input.json output.ppm

Example json scene data

[
	{
		"type": "camera",
		"width": 2.0,
		"height": 2.0
	},
	{
		"type": "sphere",
		"radius": 2.0,
		"diffuse_color": [1, 0, 0],
		"specular_color": [1, 1, 1],
		"position": [0, 1, 5]
	},
	{
		"type": "plane",
		"normal": [0, 1, 0],
		"diffuse_color": [0, 1, 0],
		"position": [0, -1, 0]
	},
	{
		"type": "light",
		"color": [2, 2, 2],
		"theta": 0,
		"radial-a2": 0.125,
		"radial-a1": 0.125,
		"radial-a0": 0.125,
		"position": [1, 3, 1]
	}
]

Built With

  • Cygwin - 64-bit version for Windows
  • GNU Compiler Collection (GCC) release 5.4.0
  • GNU Make release 4.2.1
  • Windows 10 Professional

Author

  • Jarid Bredemeier

Resources