Gridea

Physically Based Rendering

2022-03-02 · 3 min read

Blinn-Phong shading model:

L=CdiffN⋅L+Cspec(N⋅H)mL=C_{diff} N \cdot L + C_{spec} (N \cdot H)^m

CdiffC_{diff}: Diffuse color
CspecC_{spec}: Specular color
NN: Normal vector
LL: Light direction vector
HH: Half-angle vector (sight direction vector & light direction vector)
Which is also Normalized(L+V)Normalized(L + V)

BRDF:

L=fBRDFcos⁡θlL=f_{BRDF} \cos \theta_{l}

fBRDF=kdiffCdiffπ+kspecVDFf_{BRDF} = k_{diff} \frac{C_{diff}}{\pi} + k_{spec}VDF

DTR=Roughness2π(cos⁡2θh(Roughness2−1)+1)2D_{TR} = \frac{Roughness^2}{\pi (\cos^2\theta_h(Roughness^2 - 1) + 1)^2}

F=F0+(1−F0)(1−cos⁡θh)5F = F_0 + (1 - F_0)(1 - \cos \theta_h)^5

F0=Metalic×Albedo+(1−Metalic)×[0.04,0.04,0.04]F_0 = Metalic \times Albedo + (1 - Metalic) \times [0.04, 0.04, 0.04]

V=GS−GGX(θl)GS−GGX(θv)4cos⁡θlcos⁡θvV = \frac{G_{S-GGX}(\theta_l)G_{S-GGX}(\theta_v)}{4 \cos \theta_l \cos \theta_v}

GS−GGX(θ)=cos⁡θk+(1−k)cos⁡θG_{S-GGX}(\theta) = \frac{\cos \theta}{k + (1 - k) \cos \theta}

k=(Roughness+1)28k = \frac{(Roughness + 1)^2}{8}

kspec=F0k_{spec} = F_0

kdiff=(1−F0)(1−Metalic)k_{diff} = (1 - F_0)(1 - Metalic)

For Roughness:

L=fBRDFN⋅LL=f_{BRDF} N \cdot L

L=(kdiffCdiffπ+kspecVDF)N⋅LL = (k_{diff} \frac{C_{diff}}{\pi} + k_{spec}VDF) N \cdot L

L=(kdiffCdiffπ+kspec(GS−GGX(θl)GS−GGX(θv)4cos⁡θlcos⁡θv)(Roughness2π(cos⁡2θh(Roughness2−1)+1)2)F)N⋅LL = (k_{diff} \frac{C_{diff}}{\pi} + k_{spec} (\frac{G_{S-GGX}(\theta_l)G_{S-GGX}(\theta_v)}{4 \cos \theta_l \cos \theta_v}) (\frac{Roughness^2}{\pi (\cos^2\theta_h(Roughness^2 - 1) + 1)^2})F) N \cdot L