Caustics by photons in Cycles?


#1

Hi, this is just a mundane question specifically adressed to @brecht, since he is involved with Cycles development and core-design.
I’d like to know if it’s worth of consideration the idea I posted here.
In a nut-shell i proposed an alternative to those all-in-one complex modern algorithms, hard to implement (and harder on GPU), which is fragmenting rendering features into smaller ones. In this case all caustics effects would turn on a separate photonmapping engine that works in combination with pathtracer and delivers the result. So, plain path tracing and good old photonmapping, two reliable and easy engines, instead of a bigger and harder one.
What are your devs thoughts?


#2

There’s a reason to have more complex algorithms. If you add photon mapping the question becomes how to combine it with path tracing so each samples what it is best at, and then the answer is VCM. And if you then want to have it working well with volume rendering, you get to algorithms like UPBP. Rendering motion blur with photon mapping algorithms also needs extra work.

Personally my interest is most in making animation rendering work well, and there accurately rendering caustics is not the main issue. Rather sampling of many lights, subdivision and displacement, hair rendering, specular and DoF, motion blur, … are all still challenging to do. And it’s important that all these effects are fully supported, whereas renderers with different integrators often don’t support all features or don’t supper them efficiently in all integrators.

It would be good to have bidirectional path tracing and I’d be happy if someone want to contribute work towards it. For me the plan is to handle refractive caustics as transparent shadows like other renderers do, in a way that’s not entirely accurate but efficient to render.


#3

Thanks for taking the time.
Being part of my Blender jobs tied to still rendering, I just overlooked the implications of taking photonmapping into animation. As well as I didn’t think of how the caustics light can go back adding itself in the GI computation.
Nevermind.

That means the Is_shadow path trick right?


#4

Yes, but we’ll try to make it smarter and automatic.


#5

Nice. I guess it still will be limited by the bounds of the projected shadow, while the refraction caustics can go beyound that, but yet, sounds like an acceptable compromise.*
Any ideas on how to obtain refractive caustics? Some sort of inverted-direction shadow maybe?

*edit:
could it be that with some “parametrizable” vector trick, the shadow projection gets calculated as if a lamp was closer to the refractive object? So that the fake caustics can spread here and there all around.


#6

I’m 100% aligned with Brecth’s plan here. I work in animation and VFX and the number one issue with rendering using “Approximate” render methods is variance between frames. It causes splotchy, flickering in the dark parts of the scene

When using Vray, while you always here about how great and fast Irradience Caching is, it’s bad for animation. We basically never use it here.

So, while it always seeeeems like you would want to use approximate sampling methods because they are so much faster, it simply doesn’t work for animation.

I think approximate methods make sense for other kinds of work where you’re rendering large scale images for Architecture or product visualization. Which is one of the major reasons Vray because so popular in that sector. But this isn’t really the aim for Blender and I appriciate that it’s not. The 3D software market is littered with Arch and Product Vis renderers like Modo and Keyshot.

That’s not to say Blender isn’t up to the task. But with the render sizes being so large, it would make more sense to bake in the GI and use Eevee to render the final image.


#7

I don’t know how accurate it would get, but I was reading about an idea to get cycles or any path tracing to calculate places where caustics should appear: you basically put a camera at the location of the light source, points toward a glass material and checks what portions of the plane behind it the camera rays reach thanks to refraction from the glass material, and try to take account of all these portions. Than you could try to “bake” some sorte of caustic map for the plane (since, if rays emitted from the camera were able to hit those points, so it would be rays emitted by any light at the same location as the camera). Perharps a black and white texture you can use as factor for a mix node between the normal surface shader and an emission shader (where the caustics are located). I don’t know how hard is, or how efficient this method is compared with other methods to solve caustics, however. Is it possible to create an output in the LightPath node that gives only the points of a given object that are intersected by camera rays (that is, points that would be seen by the camera). This way it’s easy to take into account even factors like roughness and normal maps at the glass material

This would not work that great with area lights (and you would have to do this for every light source in your scene), but perharps it would be good enough to fake it? As I said, I don’t know how good the results would turn out to be, I just think this could be a way for cycles to clculate caustics whithout major changes in it’s engine


#8

Nvidia Iray has several kinds of caustics. The classic method generates some kind of transparent shadow that’s not uniform, for example.

I think new approximate or fake caustics methods would be welcome, just to have something instead of nothing


#9

So here are some tests I made using the technique I was talking about. It’s all thanks to this thread here by Secrop: Caustic In Cycles

As you can see, the results are pretty good, although some refinement might be warranted. I will try applying that “blur texture” technique in those caustic maps to see if the result gets better, but as I said, I believe we have a pretty good way to calculate caustics here. This image only shows refractive caustics, but this method should work with reflection caustics as well


#10

here’s the issue, though… does this method follow conservation of energy? that’s really important when considering it as a cycles feature.in any case, There’s actually some ongoing (maybe slow right now) work on adaptive rendering, where the program finds noisy areas to keep rendering longer. caustics are smooth and continuous, so it should work better for them than something like trees in the distance. I also agree with Brecht on the “caustic shadow” pass, though it really does feel like we’re missing some elegant solution for it.


#11

The method you tried suffers of the same issues that Brecht brought up for photon mapping. How could you bring the light back into GI? How to make it interact with multiple reflections/refractions?
The only answer i can see is if it was an effect visible only for the camera, which would be pretty limiting thou.


#12

I add the caustic map as an emmisive material, so it will interact with other objects in the scene. Notice that this method is not in real time, you have to render a specific image first, with the camera locked in the position of the light, and specific materials for the refraction object and the object to receive the caustics. Then you can run an algorithm which will convert this into a caustic map, let’s say, for the plane. Then you add this map to the plane material and re-render the scene.


#13

Oh yes, i miss the part of ‘emission’ shader. But noneless, you would see it in gi and ref**ctive materials, but as you stated, where is accuracy? You’re making emit something that just reflects. How to take into account shadows projected on the caustics?


#14

Any part not highlighted by the caustic map you could leave as a shadow. However I think this method gives thicker shadows than it should, because it doesn’t take into account more indirect rays contibutting for the caustics, so maybe you can mix this with the shadow ray trick. The good thing this method gives is that protion of caustics which are outside the boundaries of the shadow, and reflective caustics as well, so I think it should be a nice addition. As Nubnubbud noted, we also have the problem of the conservation of energy. You can try to reduce this problem by tinkering with the strenght of the emmisive material, or you could change that 400 setting in the code, this number kind of control the “strenght” of the caustic


#15

Still, the method doesn’t determine the correct light amount that hits the diffuse area… it just produces some cool caustic map, but not correct nor complete. That is just unfeasable to incorporate into Cycles.


#16

though-!

you could use it as a guide for a second round of rays to shoot! find the areas that sending photons to will produce caustics, and send a LOT more to just those areas. (and average them with the rest of the samples of course) I’m not sure how you would stop this method from inflating the brightness of the caustics without giving the areas the photons end up, or the entire scene in general, the same treatment.


#17

I got these using scrambling distance.


#18

Nice, I already saw this on the other thread.
I think I know how you set it, but I challenge you to use those same settings in a production scene with many lights and bounces.


#19

That’s a very nice result!!
Does this work in animations too, or is there some flickering?


#20

Er…, seems like I can’t reproduce your result in a reasonable time. So can you share your settings?