Where can i find the Cycles ray tracing kernel in source files?

Hello. I am very interested in the concept of ray tracing and would like to modify it for my personal research and hobby. I love Blender and Cycles is the best for it, but I don’t know where the source code is at all. The only languages I know are Delphi and Python, but that didn’t stop me from diving into the Blender C++ sources, etc. I tried for a very long time to find the most central core of Cycles, sailing through the endless expanses of C++ Blender, but my search was unsuccessful. The best I could dig up was some kind of data structure called Ray, some functions scene_intersect() and ShaderData.
Can anyone help me point out which file is the core of Cycles ray tracing? I want to have the lowest access to ray position and ray direction. I just want to change the position after the ray hits and the direction the ray will take next.

By the “Cycles core”, I mean the place where the next “fly away” of the ray is formed, and its next intersection with a scene. I want to access this place. How to change it is already my second problem. The main thing is to find where it is.

Just point me to the file and I’ll go explore the Blender source code further on my own.

Edit: Thank you all for your help!

Answer to your question: blender/cycles at main - blender - Blender Projects
Better advice: https://www.pbr-book.org/

1 Like

with little experience PBRT may still be a bit heavy, I’d probably give

a whirl to familiarize your self with the basics

2 Likes

Wavefront path tracing makes it a bit difficult to point out the core since it’s broken up into different kernels. But this should give you an idea of how they fit together.
https://wiki.blender.org/wiki/Source/Render/Cycles/KernelScheduling
https://wiki.blender.org/wiki/Source/Render/Cycles/SourceLayout

1 Like