Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tinyraytracer in Python #16

Open
masscry opened this issue Jan 31, 2019 · 4 comments
Open

Tinyraytracer in Python #16

masscry opened this issue Jan 31, 2019 · 4 comments

Comments

@masscry
Copy link

masscry commented Jan 31, 2019

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

@ssloy
Copy link
Owner

ssloy commented Jan 31, 2019

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)

@masscry
Copy link
Author

masscry commented Feb 1, 2019

Nice! That is much better!

out

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

@masscry
Copy link
Author

masscry commented Feb 1, 2019

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

out

@ssloy
Copy link
Owner

ssloy commented Feb 1, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants