你好,欢迎来到残梦的博客园啊

【计算机图形学】体渲染专题 (二)

首先,老规矩:

未经允许禁止转载(防止某些人乱转,转着转着就到蛮牛之类的地方去了)

B站:Heskey0


【Computer Graphics】Photorealistic Rendering of Volume Effect

Heskey0 (Bilibili)

December 2021

Based On Mark Pauly's Thesis[1999] and 《PBRT》

Chapter 1 . Sampling Techniques In Path Tracing

1.1. Inverse CDF (Cumulative Density Function)

There are many techniques for generating random variates from a specified probability distribution such as the normal, exponential, or gamma distribution. However, one technique stands out because of its generality and simplicity: the inverse CDF sampling technique.

The algorithm is as follows:

  1. Obtain or generate a draw (realization) u from the standard uniform distribution UUnif(0,1)
  2. The draw x from the CDF F(x) is given by x=F1(u)

Example of inverse CDF method:

Let p(θ)=sinθ be the probability density function, F(θ)=1cosθ the cumulative density function of θ

  1. generate a draw ξ from the standard uniform distribution UUnif(0,1)

  2. the draw θ from the PDF p(θ) is given by θ=F1(ξ)=arccos(1ξ)

1.2. Uniformly sampling a hemisphere

a uniform distribution means that the density function is a constant, so we know that p(x)=c

S2p(ω)dω=1cS2dω=1c=12π

hence p(ω)=12π, dω=sinθdθdϕ, p(θ,ϕ)=sinθ2π

Consider sampling θ first. To do so, we need θ's marginal density function p(θ):

p(θ)=02πp(θ,ϕ)dϕ=02πsinθ2πdϕ=sinθ

Now, compute the conditional density for ϕ:

p(ϕ|θ)=p(θ,ϕ)p(θ)=12π

Notice that the density function for ϕ itself is uniform, then use the inverse CDF sampling technique to sample each of these PDFs in turn

P(θ)=0θsinθdθ=1cosθθ=arccosξ1

P(ϕ|θ)=0ϕ12πdϕ=ϕ2πϕ=2πξ2

Converting these back to Cartesian coordinates, we get the final sampling formula:

x=sinθcosϕ=cos(2πξ2)1ξ12

y=sinθsinϕ=sin(2πξ2)1ξ12

z=cosθ=ξ1

1.3. Sample area light

def sample_area_light(hit_pos, pos_normal):
    # sampling inside the light area
    x = ti.random() * light_x_range + light_x_min_pos
    z = ti.random() * light_z_range + light_z_min_pos
    on_light_pos = ti.Vector([x, light_y_pos, z])
    return (on_light_pos - hit_pos).normalized()

1.4. Cosine-weighted Sampling

p(ω)cosθp(ω)=ccosθ

S2p(ω)dω=1c=1πp(ω)=cosθπp(θ,ϕ)=1πcosθsinθ

We could use the inverse CDF sampling technique as before, but instead we can use a technique known as Malley’s method to generate these cosine-weighted points.

The algorithm is as follows:

  1. sample a unit disk (Concentric Mapping)

    r=x;ϕ=yxπ4

  2. project up to the unit hemisphere

1.5. Multiple importance sampling

MIS allows us to combine m different sampling strategies to produce a single unbiased estimator by weighting each sampling strategy by its probability distribution function.

Ij=i=1m1nij=1niwi(Xi,j)f(Xi,j)pi(Xi,j)

where Xi,j are independent random variables drawn from some distribution function pi and wi(Xi,j) is some heuristic for weighting each sampling technique with respect to pdf.

balance heuristic:

ws(x)=nsps(x)inipi(x)

power heuristic:

ws(x)=(nsps(x))βi(nipi(x))β

Veach determined empirically that β=2 is a good value


本文未经允许禁止转载
作者:Heskey0
B站:https://space.bilibili.com/455965619
邮箱:3495759699@qq.com

posted @   Heskey0  阅读(250)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南

本站勉强运行 1191 天 16 小时 08 分 55 秒

喜欢请打赏

扫描二维码打赏

支付宝打赏

点击右上角即可分享
微信分享提示