PyTracer : Ray tracing with Python
HTML-код
- Опубликовано: 6 дек 2019
- PyTracer was a fun coding project I worked on back in 2017. The idea was inspired by MelRay which was a ray tracer written completely in Maya’s Mel language and done by my CG supervisor Clinton Downs at New Holland.
Why not write a ray tracer in Python? That was the initial spark that triggered me to accept this challenge.
It took two months of my spare time. I had learned plenty of math and physics through the process. Camera, shadow ray, sampling, dof..... So many topics that I never thought about when I was using renderers in 3D programs.
Of course the final product is not perfect, noisy, slow, can’t render anything but spheres and planes. And I still believe my hemisphere sampling is not correctly implemented. But I’m happy with the journey and the outcome is satisfying.
Again special thanks to Clinton for the resources and inspiration.
If you are interested, grab the code here and give it go on your machine:
github.com/NMVHS/PyTracer
Other failure renders:
shawnwangvfx.com/PyTracer - Наука
So impressive!!!
I've been writing my own ray tracing engine recently, also in python :) & I've only just implemented reflections... But this is crazy!!
Thank you! Yeah, it's very fun to write your own ray tracer. You can learn a lot. Would love to see your rendered image when you are done!
@@ShawnWang sorry this took so long lol (I just completely forgot about everything raytracing related as soon as I finished programming the raytracer)
but I just came back to this video, and here's the finished rendered image:
cdn.discordapp.com/attachments/619767228832808960/771921628211707914/4k30s6rb.png
I didn't get around to supporting refraction, I didn't implement specular, and I didn't implement anti-aliasing :P
@@MACHINEBUILDER That's excellent! A fun process, isn't it?! Thanks for sharing it. :)
@@ShawnWang yeah it was really fun :)
And glad you like it haha
Great to see this Shawn :)
The rendering process is beautiful
thank you!
Damn it, that's a glorious work.
Wow, thank you so much Isaac!
excellent job , thanks for codes.
Thank you Asad!
Ray tracing is the process of shooting a single ray per pixel to get an image. Path tracing (the one in the video) is the process of shooting multiple rays for every pixel then randomizing the bounce depending on roughness and averaging every ray to get a final image.
Wow that is amazing
Thank you!
GodDamn
This is awesome,I'm currently writing my own Raytracing Shader in Python,C,C++ and C#,and Comparing them in performance,but Im only done with rendering Pixels onto a .PPM file. Wow,This is Impressive
Hey Aaron, that sounds fascinating! Would love to see your comparison results. You might be interested in a render window with PyQt. See it rendering in buckets is very fun. :)
@@ShawnWang Oh,Cool. I might look into that
Really nice project!
I also written a Python Ray tracer, but I'm surprised of one thing. How do you manage to use all your cpu cores at 100%?
Do you share it in the python subreddit?. We love these projects!
Hi Rafael, thank you! It was Python's multi-processing module that allowed me to utilize all the cpu cores. Sounds nice! I'd love to share it in the forum. Also codes available here: github.com/NMVHS/PyTracer
Its called the thread module
Looks really good but too much noise!
i feel like python isnt the correct language to write stuff like this in as seeing the performance of the programming language as a whole to better languages like C++ etc
Right, to make a production ready ray tracer, C++ is definitely necessary. This is mainly a coding practice to learn ray tracing algorithms.
Allow pypy to introduce itself www.pypy.org/
@@MrBricks148 True, im currently implementing ray tracing in one weekend and the performance diference between pypy and the clasical CPython is huge!
Make the video downloadable