Visualizing rays from Path Tracer

Hello,

i am playing around with some lens glass meshes in Cycles just to see how good a path tracer is at optical ray simulations. It is a lot of fun.
Now i am curious about the ray distribution of the simulation. How does it look like.
Is there a method to visualize the ray in cycles?
That would be cool.
Thank you.

Not really by default, but if you’d like to see it and know a bit of C coding, you can simply add a printf() call to the ray intersection code to dump all the rays into an output file.
Also, you might be interested in https://benedikt-bitterli.me/tantalum/ :wink:

I have just started to learn C++.
Where can i see the source code of the path tracer. I know how Monte Carlo Ray Tracing and Rasterisation works from scratch-a-pixel.com
Really great site.
Your site seems to be very informing too. Will save it for later. :slight_smile:

I correct ,your ray visualizer is pure ice cream.

The main path tracing code is in intern/cycles/kernel/kernel_path.h, in your case, you’ll probably want to add a printf() to line 627 (that’s where the main rays are processed, shadow rays from lamp sampling are handled elsewhere).
If you have any questions about the code, you can also just ask in #blendercoders or #cycles on IRC :slight_smile:

Oh, and btw: The ray visualizer isn’t mine, I just happened to have in in my bookmarks…

Thank you so much. I hope i don’t break something up in the code.