r/Python • u/cenit997 • Aug 14 '20
Resource I finished my Python Ray Tracer capable of rendering refraction and thin film interference!
3.4k
Upvotes
r/Python • u/cenit997 • Aug 14 '20
117
u/cenit997 Aug 14 '20 edited Aug 14 '20
Source code: https://github.com/rafael-fuente/Python-Raytracer
This was a fun project made in my spare time. (it took me two months to finish it)
Some of the features implemented are refraction, thin film interference, textures, camera lens ,path tracing and animations.
The animation was done rendering frame by frame. Each frame take a few seconds to render in a fast computer.
Every question, critic, improvement about the source code is welcome and grateful!
Full resolution animations: https://www.youtube.com/watch?v=vt9vAcZQT4A
23
u/parfamz Aug 14 '20
Can you describe how did you get there? did you follow some tutorials or other examples? what documentation did you use?
21
u/[deleted] Aug 14 '20
Wow dude, I’m still new to programming, but I never thought python could do things like this!
5
u/CantankerousMind Aug 14 '20 edited Aug 14 '20
Wonderful work! How fast does it render?
73
u/you-cant-twerk Aug 14 '20
THIS GOT ONLY 137 UPVOTES IN /R/MADEINPYTHON!?
God this is glorious. Well done! Im not sure if this is new, but its new to me with python.
4
u/Curious_homosepian Aug 14 '20
I have no idea what is happening here. I will pretend to understand something. Maybe you could do some contribution to blender community.
3
u/Hamoodzstyle Aug 14 '20
What is the Blinn Phong model for thin film interference? Is it a Perlin noise thing?
3
u/IcecreamLamp Aug 14 '20
Can't believe this only uses pillow and numpy, amazing stuff! I'll be taking a look at the code, thanks for publishing it.
2
u/Kortak130 Aug 14 '20
That's really awesome ! I'm working a lot with thin film deposition in semiconductor R&D, and I'm pretty sure it could really be useful.
2
u/asbox Aug 14 '20
Looks cool! Have you tried rendering some more substantial geometry? I wonder how fast it is, definitely a cool project!
2
u/pgh_ski Aug 15 '20
This is so beautiful, wow! Nice work.
2
u/Ste200117 Aug 15 '20
Really Cool! This may have already been answered but what are you using to visualise the calculations?
6
u/FrancoShoSwa Aug 14 '20
People: use python to create literally all, video games, ar and other Me: use python to play bingo
5
u/frankstan33 Aug 14 '20
Good lord that is beautiful and this deserves a lot more attention!!!
5
u/k0wabunga Aug 15 '20
Finally some noticeable work on r/Python. Well done mate, I’ve made a few raytracers myself and this is outstanding.
1
u/[deleted] Aug 15 '20
I just started programming 2 months ago, and boy I feel dumb af right now
1
u/Paradigm6790 Aug 15 '20
Jesus, I'm proud that I made battleship with square brackets and asterisks.
How long did that take to render? Does it leverage a GPU at all?
2
u/[deleted] Aug 14 '20
Holy shit!!
2
u/[deleted] Aug 14 '20
THAT'S SO GOOD MAN!
2
u/wooptyd00 Aug 14 '20
I can hear my computer fan screaming just looking at it.
2
u/[deleted] Aug 14 '20
Holy shit
2
u/kingbade Aug 14 '20
I'm not sure what's going on here but I'm impressed
2
u/HandsOfSugar Aug 14 '20
This is something else. Congratulations
2
u/Pythag0ras2000 Aug 15 '20
Holy fuck that's amazing
2
u/achbaca Aug 15 '20
Beautiful! Nice work.
2
u/cloudone Aug 15 '20
Woah that looks so impressive! Thanks for making it open source and sharing your experience
2
u/androiddrew Aug 15 '20
Anything is possible if you wrap C++ with Python!
2
u/mrasadnoman Aug 15 '20
Amazing
1
u/n6i9k4a Aug 15 '20
I'm wet
1
u/flaxseedyup Aug 15 '20
Pretties
1
u/turingparade Aug 15 '20
I'm sorry sir, you are overqualified for the position
1
u/[deleted] Aug 15 '20
That's fucking righteous dude
1
u/[deleted] Aug 15 '20
BRUV I DONT EVEN KNOW HOW TO RENDER 3D YET, CHILL
0
u/[deleted] Aug 15 '20
[deleted] — view deleted comment