# Can I use Path tracing together with Ray Marching?

So I'm trying to render participating media like clouds/sky/fog (Sky is the first step) etc. I had already implemented a normal pathtracer and I was thinking of extending it. But I heard terms like Ray marching/Sphere tracing are used for rendering volumes.

A quick search brings up this question where the guy is trying to use Monte Carlo methods to render the Sky. This has me confused. Does this mean we can use Path tracing together with ray marching? Or do we have to choose 1 over the other? Or is it that both are actually solving different problems? I have read up on what ray marching actually means, I just want to get a clear understanding of the connection between raymarching - raytracing/pathtracing.

• Ray marching simply solves for the intersection numerically. So it's more logical to compare it to ray casting as a technique. You can obviously use a combination of both for path tracing - you'll evaluate some points/intersections through ray marching, and others analytically. – lightxbulb Jul 1 at 18:44
• ^^ This. There are tons of other sources which imply that Ray marching is more of a an algorithm used for volume rendering, even wikipedia suggest that. Where as after getting to know it, it feels just, as you said, an algorithm to solve the intersection problem. I mean the core part of ray marching lies in using variable/fixed steps to keep marching and find the intersection point along that ray, the sampling along that ray part is more related to volumetric rendering and not to ray marching in general. Is that correct? – gallickgunner Jul 2 at 7:07
• The articles and wikipedia are not wrong per se. The issue is that based on the context it can mean different things. You use ray marching both for volume rendering (since you march along the ray to integrate over space) and for numerical surface intersection. It's just how some "terms" work in CG - they've been overloaded with various meanings in multiple papers. – lightxbulb Jul 2 at 7:28
• Okay but if we are using progressive Monte Carlo methods, we don't necessarily have to take n samples or steps along the ray to integrate over the space, right? We'd just probabilistically select a sample point along the ray and weigh the whole thing by the probability of selecting that point. – gallickgunner Jul 2 at 8:40
• I dont think the term is overloaded. Its just describing how its done. I mean i can describe traveling to work as taking the bus, driving car or walking. But that doea not man my mode of transportation tells where im going. So its valid to do other things with those modes of transportation. – joojaa Jul 2 at 23:14