PyTracer : Ray tracing with Python

  Рет қаралды 5,980

Shawn Wang

Shawn Wang

4 жыл бұрын

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

Пікірлер: 27
@MACHINEBUILDER
@MACHINEBUILDER 4 жыл бұрын
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!!
@ShawnWang
@ShawnWang 4 жыл бұрын
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!
@MACHINEBUILDER
@MACHINEBUILDER 3 жыл бұрын
@@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
@ShawnWang
@ShawnWang 3 жыл бұрын
@@MACHINEBUILDER That's excellent! A fun process, isn't it?! Thanks for sharing it. :)
@MACHINEBUILDER
@MACHINEBUILDER 3 жыл бұрын
@@ShawnWang yeah it was really fun :) And glad you like it haha
@thehandleiwantedwasntavailable
@thehandleiwantedwasntavailable 2 жыл бұрын
Great to see this Shawn :)
@infancy8846
@infancy8846 4 жыл бұрын
The rendering process is beautiful
@ShawnWang
@ShawnWang 4 жыл бұрын
thank you!
@isaacdiaz3221
@isaacdiaz3221 4 жыл бұрын
Damn it, that's a glorious work.
@ShawnWang
@ShawnWang 4 жыл бұрын
Wow, thank you so much Isaac!
@marwans4018
@marwans4018 4 жыл бұрын
Wow that is amazing
@ShawnWang
@ShawnWang 4 жыл бұрын
Thank you!
@aaronspeedy3087
@aaronspeedy3087 3 жыл бұрын
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
@ShawnWang
@ShawnWang 3 жыл бұрын
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. :)
@aaronspeedy3087
@aaronspeedy3087 3 жыл бұрын
@@ShawnWang Oh,Cool. I might look into that
@cybermascot
@cybermascot 4 жыл бұрын
excellent job , thanks for codes.
@ShawnWang
@ShawnWang 4 жыл бұрын
Thank you Asad!
@SimulatingPhysics
@SimulatingPhysics 3 жыл бұрын
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!
@ShawnWang
@ShawnWang 3 жыл бұрын
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
@novygaming5713
@novygaming5713 Жыл бұрын
Its called the thread module
@novygaming5713
@novygaming5713 Жыл бұрын
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.
@kangsan2014
@kangsan2014 3 жыл бұрын
Looks really good but too much noise!
@lethenparkesTeamRacc
@lethenparkesTeamRacc 3 жыл бұрын
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
@ShawnWang
@ShawnWang 3 жыл бұрын
Right, to make a production ready ray tracer, C++ is definitely necessary. This is mainly a coding practice to learn ray tracing algorithms.
@MrBricks148
@MrBricks148 3 жыл бұрын
Allow pypy to introduce itself www.pypy.org/
@0.Andi.0
@0.Andi.0 2 жыл бұрын
@@MrBricks148 True, im currently implementing ray tracing in one weekend and the performance diference between pypy and the clasical CPython is huge!
@dissolvesoftware
@dissolvesoftware 4 жыл бұрын
Make the video downloadable
I made a better Ray-Tracing engine
17:38
NamePointer
Рет қаралды 245 М.
Ray Tracing: How NVIDIA Solved the Impossible!
16:11
Two Minute Papers
Рет қаралды 787 М.
Countries Treat the Heart of Palestine #countryballs
00:13
CountryZ
Рет қаралды 29 МЛН
Sprinting with More and More Money
00:29
MrBeast
Рет қаралды 183 МЛН
I'm Coding an Entire Physics Engine from Scratch
9:19
Gonkee
Рет қаралды 1,6 МЛН
Raytracing on a Graphing Calculator (again)
13:38
The Science Elf
Рет қаралды 1,9 МЛН
Making FPS Games in Python
8:52
Sacko
Рет қаралды 250 М.
Welcome to Ray Tracing
23:48
The Cherno
Рет қаралды 188 М.
Planet Unknown (2016) Short Film
9:16
Shawn Wang
Рет қаралды 4 МЛН
Turn Python BLAZING FAST with these 6 secrets
5:01
Dreams of Code
Рет қаралды 35 М.
MARBLE MARCHER: Real-Time Ray Tracing on Fractal Race Courses! (Experimental game)
11:48
Randomise User: The Best Indie Games
Рет қаралды 109 М.
I created my own Ray Tracing Engine from scratch
7:21
NamePointer
Рет қаралды 93 М.
Building a Ray Tracer in Python - Part 1 (Points in 3D Space)
58:08
Arun Ravindran ArunRocks
Рет қаралды 33 М.
Disney's Practical Guide to Path Tracing
9:32
Walt Disney Animation Studios
Рет қаралды 845 М.
i love you subscriber ♥️ #iphone #iphonefold #shortvideo
0:14
Si pamerR
Рет қаралды 3,5 МЛН
сюрприз
1:00
Capex0
Рет қаралды 1,4 МЛН
Неразрушаемый смартфон
1:00
Status
Рет қаралды 1,2 МЛН
MacBook Air Японский Прикол!
0:42
Sergey Delaisy
Рет қаралды 534 М.
📦Он вам не медведь! Обзор FlyingBear S1
18:26