tinyraytracer icon indicating copy to clipboard operation
tinyraytracer copied to clipboard

Tinyraytracer in Python

Open masscry opened this issue 5 years ago • 4 comments

Hello!

Thank you for very interesting materials!

I ported most of code to Python (except bunny rendering...).

python-tinyraytracer It is a bit dirty and not very pythonic, but it works and produces same results.

out

masscry avatar Jan 31 '19 16:01 masscry

Good job, thank you for sharing! One minor comment:

in this place i'd put spherical coordinates instead:

x = int((math.atan2(norm_dir.z, norm_dir, x)/(2*math.pi) + 0.5)*env_width)
y = int(math.acos(norm_dir.y)/math.pi*env_height)

ssloy avatar Jan 31 '19 22:01 ssloy

Nice! That is much better!

out

I used environment map in low resolution, so background becomes too blocky without filtering.

masscry avatar Feb 01 '19 08:02 masscry

Rendering time skyrocketed (~30 minutes) with duck mesh on scene, but with bounding box I got reasonable ~2 minutes per draw.

out

masscry avatar Feb 01 '19 14:02 masscry

Yup, exponential complexity. I give this in my lectures to motivate for the rasterization technique.

I guess that Python makes it a little bit more expensive, C++ implementation takes a couple of minutes without the bounding box.

ssloy avatar Feb 01 '19 15:02 ssloy