Search Unity

What's the difference between ray tracing and path tracing?

Discussion in 'General Graphics' started by Middle-earth, Jul 23, 2020.

  1. Middle-earth

    Middle-earth

    Joined:
    Jan 23, 2018
    Posts:
    78
    Some people told me that “path tracing = ray tracing + MonteCarlo”.Do you agree with that?Somehow I doubt whether there's only that one small difference between them.
     
  2. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Conceptually, the difference is in the origin and path taken by the rays.

    In Ray tracing, rays are cast from the camera into the scene. When they hit some geometry, lighting is calculated at that point by tracing additional rays towards light sources.

    In path tracing, rays are cast from light sources containing an amount of light energy. Upon hitting a surface, the surface properties absorb some of the energy and divide the rest in multiple rays, cast back into the scene. Rays that happen to hit the camera are recorded into pixels.

    So, path tracing tries to simulate how light behaves when it bounces around and is captured by a camera. Optical effects like depth of field, caustic, and indirect lighting, for example, don't require any extra specialized algorithms, unlike raytracing.

    On the other hand, path tracing needs a lot more rays to produce an image that raytracing, and since the rays "randomly" hit the camera you never have a perfectly clean image: there is always some noise.

    Path tracing is often used to produce "ground truth" images: fully realistic lit frames to be used to benchmark faster approximations in both raytracing and rasterization.
     
    Last edited: Feb 20, 2022
  3. mohantobipul

    mohantobipul

    Joined:
    Aug 18, 2021
    Posts:
    13
    Hi @Neto_Kokku !

    I am also in the same confusion of ray vs. path tracing. Definitely path tracing is a subset of ray tracing, and ray tracing is a subset of ray casting. Isn't it? I also believed thar path tracing = ray tracing + MC equation, but now I am confused again.
    From your definition of ray tracing, if the primary ray hits a surface (let's say opaque sphere) and then it hits the light source, surface pixel gets its color. That surface hit is 1 bounce. So, if I understood it correctly, my question is, what is ray casting then? I thought ray casting does the same thing.
     
  4. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    It's just terminology. In all cases it's all a bunch of rays vs triangle intersection tests. "Casting" and "tracing" rays is conceptually the same thing.

    Ray tracing is not limited to one bounce, it's just a catch-all term for when you are using ray-triangle tracing somewhere in the rendering pipeline. Real time ray tracing doesn't usually doesn't even do primary rays from the camera, instead doing using rasterization to fill a depth+normals buffer then use that to get a list of world-space positions to cast rays from.

    BTW, in gaming rendering jargon "ray casting" usually refers to old pseudo 3D engines like Doom and Duke Nukem..
     
    BrandyStarbrite and mohantobipul like this.
  5. mohantobipul

    mohantobipul

    Joined:
    Aug 18, 2021
    Posts:
    13
    Thanks again for the clarification. The terminologies are just confusing and blurred to each others boundary.