Skip to content

Instantly share code, notes, and snippets.

View brunosantiagovazquez's full-sized avatar

Bruno Santiago Vázquez brunosantiagovazquez

View GitHub Profile
@brunosantiagovazquez
brunosantiagovazquez / raytracing.py
Last active January 31, 2017 12:19 — forked from rossant/raytracing.py
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
import numpy as np
import matplotlib.pyplot as plt
import sys
resolution = 1.5
w = 400*resolution
h = 300*resolution
def normalize(x):
x /= np.linalg.norm(x)