<p>Suppose we are sampling camera rays of a perspective camera with a finite aperture. The <a href="http://www.pbr-book.org/3ed-2018/Camera_Models/Projective_Camera_Models.html#TheThinLensModelandDepthofField" rel="nofollow noreferrer">PBRT implementation</a> of the sampling scheme looks like this:</p>

<pre><code>Float PerspectiveCamera::GenerateRay(const CameraSample &amp;sample,
                                     Ray *ray) const {
    ProfilePhase prof(Prof::GenerateCameraRay);
    // Compute raster and camera sample positions
    Point3f pFilm = Point3f(sample.pFilm.x, sample.pFilm.y, 0);
    Point3f pCamera = RasterToCamera(pFilm);
    *ray = Ray(Point3f(0, 0, 0), Normalize(Vector3f(pCamera)));
    // Modify ray for depth of field
    if (lensRadius &gt; 0) {
        // Sample point on lens
        Point2f pLens = lensRadius * ConcentricSampleDisk(sample.pLens);

        // Compute point on plane of focus
        Float ft = focalDistance / ray-&gt;d.z;
        Point3f pFocus = (*ray)(ft);

        // Update ray for effect of lens
        ray-&gt;o = Point3f(pLens.x, pLens.y, 0);
        ray-&gt;d = Normalize(pFocus - ray-&gt;o);
    }
    ray-&gt;time = Lerp(sample.time, shutterOpen, shutterClose);
    ray-&gt;medium = medium;
    *ray = CameraToWorld(*ray);
    return 1;
}
</code></pre>

<blockquote>
  <p>Let <span class="math-container">$X_0\in M$</span> and <span class="math-container">$\Omega_1\in S^2$</span> denote the sampled point on the camera and direction, respectively. The next surface point in a path tracer would be <span class="math-container">$$Y:=X+d_M(X,\Omega)\Omega,$$</span> where <span class="math-container">$$d_M(x,\omega):=\inf\left\{t&gt;0:x+t\omega\in M\right\}\;\;\;\text{for }x\in M\text{ and }\omega\in S^2.$$</span> What is the conditional distribution of <span class="math-container">$Y$</span> given <span class="math-container">$(X,\Omega)$</span>?</p>
</blockquote>

<p>From page 303 in <a href="http://graphics.stanford.edu/papers/veach_thesis/thesis.pdf" rel="nofollow noreferrer">Veach's thesis</a> the conditional distribution of <span class="math-container">$Y$</span> given <span class="math-container">$X$</span> should have a density with respect to the projected solid angle kernel <span class="math-container">$$\sigma_M^\perp(x,B):=\int_B\sigma_{S^2}({\rm d}\omega)|\langle\nu_M(x),\omega\rangle|\;\;\;\text{for }(x,B)\in M\times\mathcal B(S^2).$$</span></p>

<p>Formally, we assume that the lens is part of our scene geometry <span class="math-container">$M$</span>, which is assumed to be an oriented embedded <span class="math-container">$C^1$</span>-submanifold of <span class="math-container">$\mathbb R^3$</span>, <span class="math-container">$\nu_M$</span> denotes the outer normal field on <span class="math-container">$M$</span> and <span class="math-container">$\sigma_M$</span> denotes the surface measure on <span class="math-container">$\mathcal B(M)$</span>. Moreover, let <span class="math-container">$S^2$</span> denote the unit <span class="math-container">$2$</span>-sphere, <span class="math-container">$$S^2(x):=\left\{y\in\mathbb R^3:|x-y|=1\right\}=x+S^2\;\;\;\text{for }x\in\mathbb R^3$$</span> and <span class="math-container">$$\omega_{x\to y}:=\frac{y-x}{|y-x|}\in S^2\;\;\;\text{for }x,y\in\mathbb R^3\text{ with }x\ne y.$$</span> For simplicity, assume that <span class="math-container">$$d_M(x,\omega):=\inf\left\{t&gt;0:x+t\omega\in M\right\}&lt;\infty\;\;\;\text{for all }x\in M\text{ and }\omega\in S^2\tag1$$</span></p>

CC BY-SA 4.0
2020-01-17T00:27:15.417Z
I noticed that you have been posting a lot in recent days. While I think it is great that you are interested in light transport, the mathematical level you are using to approach your problems is far too high for the majority of this community. Your questions are mostly research-oriented and, as such, I'm not sure how much this forum can help you. It is clear that you are coming from a pure math background like Veach. Realistically though, the intersection of people who fully understand his thesis and also lurk here is probably nil. I hope someone can prove me wrong...
Hubble
CC BY-SA 4.0
2020-01-17T21:20:47.337Z
Is this what you're looking for? https://agraphicsguy.wordpress.com/2016/02/04/the-missing-primary-ray-pdf-in-path-tracing/
lightxbulb
<raytracing><pathtracing><global-illumination><pbr><monte-carlo>
Distribution of the first vertex on a camera subpath in bidirectional path tracing
0xbadf00d
# Distribution of the first vertex on a camera subpath in bidirectional path tracing

(Asked by: username_0 on 2020-01-16)

Suppose we are sampling camera rays of a perspective camera with a finite aperture. The [PBRT implementation](http://www.pbr-book.org/3ed-2018/Camera_Models/Projective_Camera_Models.html#TheThinLensModelandDepthofField) of the sampling scheme looks like this:

```
Float PerspectiveCamera::GenerateRay(const CameraSample &sample,
                                     Ray *ray) const {
    ProfilePhase prof(Prof::GenerateCameraRay);
    // Compute raster and camera sample positions
    Point3f pFilm = Point3f(sample.pFilm.x, sample.pFilm.y, 0);
    Point3f pCamera = RasterToCamera(pFilm);
    *ray = Ray(Point3f(0, 0, 0), Normalize(Vector3f(pCamera)));
    // Modify ray for depth of field
    if (lensRadius > 0) {
        // Sample point on lens
        Point2f pLens = lensRadius * ConcentricSampleDisk(sample.pLens);

        // Compute point on plane of focus
        Float ft = focalDistance / ray->d.z;
        Point3f pFocus = (*ray)(ft);

        // Update ray for effect of lens
        ray->o = Point3f(pLens.x, pLens.y, 0);
        ray->d = Normalize(pFocus - ray->o);
    }
    ray->time = Lerp(sample.time, shutterOpen, shutterClose);
    ray->medium = medium;
    *ray = CameraToWorld(*ray);
    return 1;
}

```

> Let $X\_0\in M$ and $\Omega\_1\in S^2$ denote the sampled point on the camera and direction, respectively. The next surface point in a path tracer would be $$Y:=X+d\_M(X,\Omega)\Omega,$$ where $$d\_M(x,\omega):=\inf\left\{t>0:x+t\omega\in M\right\}\;\;\;\text{for }x\in M\text{ and }\omega\in S^2.$$ What is the conditional distribution of $Y$ given $(X,\Omega)$?

From page 303 in [Veach's thesis](http://graphics.stanford.edu/papers/veach_thesis/thesis.pdf) the conditional distribution of $Y$ given $X$ should have a density with respect to the projected solid angle kernel $$\sigma\_M^\perp(x,B):=\int\_B\sigma\_{S^2}({\rm d}\omega)|\langle\nu\_M(x),\omega\rangle|\;\;\;\text{for }(x,B)\in M\times\mathcal B(S^2).$$

Formally, we assume that the lens is part of our scene geometry $M$, which is assumed to be an oriented embedded $C^1$-submanifold of $\mathbb R^3$, $\nu\_M$ denotes the outer normal field on $M$ and $\sigma\_M$ denotes the surface measure on $\mathcal B(M)$. Moreover, let $S^2$ denote the unit $2$-sphere, $$S^2(x):=\left\{y\in\mathbb R^3:|x-y|=1\right\}=x+S^2\;\;\;\text{for }x\in\mathbb R^3$$ and $$\omega\_{x\to y}:=\frac{y-x}{|y-x|}\in S^2\;\;\;\text{for }x,y\in\mathbb R^3\text{ with }x\ne y.$$ For simplicity, assume that $$d\_M(x,\omega):=\inf\left\{t>0:x+t\omega\in M\right\}<\infty\;\;\;\text{for all }x\in M\text{ and }\omega\in S^2\tag1$$

**Tags:** raytracing, pathtracing, global-illumination, pbr, monte-carlo

> **Comments:**
> **username_1**: I noticed that you have been posting a lot in recent days. While I think it is great that you are interested in light transport, the mathematical level you are using to approach your problems is far too high for the majority of this community. Your questions are mostly research-oriented and, as such, I'm not sure how much this forum can help you. It is clear that you are coming from a pure math background like Veach. Realistically though, the intersection of people who fully understand his thesis and also lurk here is probably nil. I hope someone can prove me wrong...  
> **username_2**: Is this what you're looking for? https://agraphicsguy.wordpress.com/2016/02/04/the-missing-primary-ray-pdf-in-path-tracing/  

---

## 0 answers

