<p>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. </p>

<p>A quick search brings up <a href="https://computergraphics.stackexchange.com/questions/5520/using-monte-carlo-on-rayleigh-scattering">this</a> 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.</p>

CC BY-SA 4.0
2019-07-01T18:44:27.753Z
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
CC BY-SA 4.0
2019-07-02T07:07:58.827Z
^^ 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
CC BY-SA 4.0
2019-07-02T07:28:14.170Z
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
CC BY-SA 4.0
2019-07-02T08:40:17.260Z
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
CC BY-SA 4.0
2019-07-02T09:24:59.050Z
Not always, you may want to march in probabilistic steps. Due to the attenuation law (or for anisotropic media) you may not want to just pick sample randomly over the ray, but rather march along it, so when the contribution becomes too small you can exit early. Just take the term as is - a very general term. The same way ray tracing is a very general term.
lightxbulb
CC BY-SA 4.0
2019-07-02T23:14:55.690Z
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
<pathtracing><volumetric><raymarching>
Can I use Path tracing together with Ray Marching?
gallickgunner
# Can I use Path tracing together with Ray Marching?

(Asked by: username_0 on 2019-07-01)

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](https://computergraphics.stackexchange.com/questions/5520/using-monte-carlo-on-rayleigh-scattering) 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.

**Tags:** pathtracing, volumetric, raymarching

> **Comments:**
> **username_1**: 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.  
> **username_0**: ^^ 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?  
> **username_1**: 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.  
> **username_0**: 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.  
> **username_1**: Not always, you may want to march in probabilistic steps. Due to the attenuation law (or for anisotropic media) you may not want to just pick sample randomly over the ray, but rather march along it, so when the contribution becomes too small you can exit early. Just take the term as is - a very general term. The same way ray tracing is a very general term.  
> **username_2**: 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.  

---

## 0 answers

