I wrote a program that loads an SVG, treats the paths like pieces of glass, and then simulates visible photon transport through the glass.
The results came out quite nice, so I thought I'd share them.
(1 million photons, 6 CPU hours)
The source code is available here: https://github.com/cjosey/svg_ray
It's tricky to set up, convoluted to use, and probably coded horribly. It also doesn't support a lot of SVG features yet, and I've only tested it on a few files. The readme lists off the features I know are unsupported.
On the bright side, the code parallelizes very well, at the cost of RAM and disk space.
(1 million photons, 7 CPU hours)
The colors are partially artificial. The photon spectrum in each pixel is weighted by a function based on the path color in the original image. If color tints are disabled, you can see some (in this case, minor) prism effects.
(4 million photons, 30 CPU hours)
The resulting images are quite huge unfortunately. There's a lot of statistical noise in the image, so it compresses poorly.
Also, this is pretty much all the SVGs I could find in the /w/ archive the code supports. I'll try to add some more support if I get time.
(900 thousand photons, 34 CPU hours)
>>1956670
Interesting. Reminds me of https://benedikt-bitterli.me/tantalum/
Is this similar?
This is pretty cool. Nice work OP.
>>1956678
It was what inspired me to write this. The main differences are that his uses the GPU so is far faster, mine is less restrictive on geometry, and I use slightly more accurate reflection physics.
What language, by chance did you code it in?,
>>1956811
He posted his code (https://github.com/cjosey/svg_ray). It's 100% Julia.
sorry im not that good in programming could someone explain this to me and also tell me how to use this??
I'm going to try to add clipping paths and shapes soon, which will basically complete the SVG feature set. I think I finally figured out a way to do clipping paths that wouldn't kill performance. Once that's done, I'll finally have a few more images to post.
I also added an installation guide for Windows (I was surprised it worked at all) here: https://github.com/cjosey/svg_ray/blob/master/INSTALL.md . It also has a really basic theory section, that I intend to expand on.
After an absurd amount of CPU time (1000 CPU hours on a small cluster), I finally rendered another.
I really need to add GPU acceleration.
It's really cool
Nice work op
I'll be sure to check out when I get home
Great stuff OP. What CPU are you using to render these?
>>1959771
The first 4 are rendered on my desktop, an i5-3570k. The last one was rendered on a 20 node cluster with dual Xeon E5420s per node.
I'm trying to figure out a way to make it take less time, but the options really are moving it to GPU or solving a much harder problem (calculate the bounding surface so that an image consists of one cell).