Skip to content

Commit 48edef4

Browse files
committed
fix error
1 parent 62fb404 commit 48edef4

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

.github/workflows/jekyll.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Checkout
3535
uses: actions/checkout@v4
3636
- name: Setup Ruby
37-
uses: ruby/setup-ruby@v1 # v1.146.0
37+
uses: ruby/setup-ruby@v1 # latest version
3838
with:
3939
ruby-version: "3.1" # Not needed with a .ruby-version file
4040
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

_posts/2021-12-31-easy-software-rasterizer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ show_sidebar: false
2222
<div class="more"><a href="https://github.com/C-none/easy-software-rasterizer">code</a></div>
2323

2424
## Introduction
25-
This simple rasterizer is based on modern CPP, mainly before c++20. It is a good example for learning how to write a software rasterizer, including the basic rasterizing pipeline--vertex processing, primitive assembly, clipping, rasterization, visibility test, and fragment processing, .
25+
This simple rasterizer is based on modern CPP, mainly before c++20. It is a good example for learning how to write a software rasterizer, including the basic rasterizing pipeline--vertex processing, primitive assembly, clipping, rasterization, visibility test, and fragment processing.
2626
Additionally, it supports `Blinn-Phong shading model`, `texture mapping`, and `SSAA`.
2727

2828
<center>

_posts/2024-1-11-screen-probes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ The implementation of Spherical Harmonics refers to [this](https://github.com/Ep
4444
To project the irradiance to the SH basis,
4545

4646
$$
47-
\Large f_l^m=\int_{\Omega}I(\omega)Y_l^m(\omega)d\omega
47+
\huge f_l^m=\int_{\Omega}I(\omega)Y_l^m(\omega)d\omega
4848
$$
4949

5050
where $l$ indicates the band, $m$ indicates the order, $\omega$ is the direction of the incident light, $I(\omega)$ is the irradiance, $Y_l^m(\omega)$ is the SH basis, $\Omega$ is the solid angle, and $f_l^m$ is the corresponding SH coefficient.
5151

5252
To estimate coefficients,
5353

5454
$$
55-
\Large f_l^m=\frac{1}{N}\sum_{i=1}^NI(\omega_i)Y_l^m(\omega_i)/pdf(\omega_i)
55+
\huge f_l^m=\frac{1}{N}\sum_{i=1}^NI(\omega_i)Y_l^m(\omega_i)/pdf(\omega_i)
5656
$$
5757

5858
where $N$ is the number of samples, and $pdf(\omega_i)$ is the probability density function of the direction $\omega_i$.
5959

6060
To reconstruct the irradiance from the SH basis,
6161

6262
$$
63-
\Large I(\omega)=\sum_{l=0}^L\sum_{m=-l}^lf_l^mY_l^m(\omega)
63+
\huge I(\omega)=\sum_{l=0}^L\sum_{m=-l}^lf_l^mY_l^m(\omega)
6464
$$
6565

6666
### Uniform sampling on a hemisphere
@@ -72,19 +72,19 @@ Imagine that we divide the hemisphere into infinite small rings, the probability
7272
To normalize the pdf, we need to divide the pdf by the integral of the pdf:
7373

7474
$$
75-
\Large pdf(\theta)=\frac{\sin\theta}{\int_0^{\frac{\pi}{2}}\sin\theta d\theta}=\sin\theta
75+
\huge pdf(\theta)=\frac{\sin\theta}{\int_0^{\frac{\pi}{2}}\sin\theta d\theta}=\sin\theta
7676
$$
7777

7878
Thus, the cumulative distribution function of $\theta$ is:
7979

8080
$$
81-
\Large cdf(\theta)=\int_0^{\theta}pdf(\theta)d\theta=1-\cos\theta
81+
\huge cdf(\theta)=\int_0^{\theta}pdf(\theta)d\theta=1-\cos\theta
8282
$$
8383

8484
The inverse function of $cdf(\theta)$ is:
8585

8686
$$
87-
\Large \theta=acos(1-u)=acos(u)
87+
\huge \theta=acos(1-u)=acos(u)
8888
$$
8989

9090
where $u$ is a random number in $[0,1)$.
@@ -96,25 +96,25 @@ The pdf of direction is $\frac{1}{2\pi}$, because it is uniform sampling on a he
9696
Considering the rendering equation:
9797

9898
$$
99-
\Large L_o(p,\omega_o)=L_e(p,\omega_o)+\int_{\Omega}f(p,\omega_i,\omega_o)L_i(p,\omega_i)(n\cdot\omega_i)d\omega_i
99+
\huge L_o(p,\omega_o)=L_e(p,\omega_o)+\int_{\Omega}f(p,\omega_i,\omega_o)L_i(p,\omega_i)(n\cdot\omega_i)d\omega_i
100100
$$
101101

102102
In coding, I set the pdf of $\theta$ to be proportional to $(n\cdot\omega_i)=cos\theta$, which is the cosine term in the rendering equation. Thus, the pdf of $\theta$ is:
103103

104104
$$
105-
\Large pdf(\theta)=\frac{\cos\theta\sin\theta}{\int_0^{\frac{\pi}{2}}\cos\theta\sin\theta d\theta}=2\cos\theta\sin\theta=sin(2\theta)
105+
\huge pdf(\theta)=\frac{\cos\theta\sin\theta}{\int_0^{\frac{\pi}{2}}\cos\theta\sin\theta d\theta}=2\cos\theta\sin\theta=sin(2\theta)
106106
$$
107107

108108
The cumulative distribution function of $\theta$ is:
109109

110110
$$
111-
\Large cdf(\theta)=\int_0^{\theta}pdf(\theta)d\theta=\frac{1}{2}(1-\cos(2\theta))=sin^2(\theta)
111+
\huge cdf(\theta)=\int_0^{\theta}pdf(\theta)d\theta=\frac{1}{2}(1-\cos(2\theta))=sin^2(\theta)
112112
$$
113113

114114
The inverse function of $cdf(\theta)$ is:
115115

116116
$$
117-
\Large \theta=asin(\sqrt{u})=acos(\sqrt{1-u})=acos(\sqrt{u}) \tag{*}
117+
\huge \theta=asin(\sqrt{u})=acos(\sqrt{1-u})=acos(\sqrt{u}) \tag{*}
118118
$$
119119

120120
where $u$ is a random number in $[0,1)$.

0 commit comments

Comments
 (0)