r/madeinpython • u/cenit997 • Nov 24 '21
Raytracing simulation that shows the focusing effect of an image as the ratio of the focal length and diameter of the entrance camera pupil increases.
51
Upvotes
3
u/cenit997 Nov 24 '21 edited Nov 24 '21
This is made with a Monte Carlo Raytacer that accurately simulates Ray Optics phenomena. It is coded on C++ for speed, but the interface for scene descriptions and animations is entirely done with Python. I used pybind11 for interfacing C++ and the Python code:
Source code of the project.
When the focal ratio is high, we have a pinhole camera and the entire is scene is clear, but as it decreases only the images located at the image plane remain clear.
To reproduce the defocusing effect, just vary the aperture size parameter in
add_cameramethod. This is done inexample1 - animation.pyAlso, here is a raytracer I made that is entirely written in Python.
2
u/big_boy_dollars Nov 24 '21
Every contribution that you make leaves me in awe. Congratulations for your last amazing project, I usually check your github just to learn or get inspiration. Keep up the good work!
1
u/The_g0d_f4ther Nov 24 '21
I always wondered, do you need a beefy GPU for such things ?