Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
imjiangjun
pbrt-v4
提交
4426f455
P
pbrt-v4
项目概览
imjiangjun
/
pbrt-v4
12 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pbrt-v4
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4426f455
编写于
10月 06, 2020
作者:
M
Matt Pharr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up CuboidMedium::SampleTMaj() logic
上级
0e4b5ae1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
29 deletion
+21
-29
src/pbrt/media.h
src/pbrt/media.h
+20
-27
src/pbrt/shapes.cpp
src/pbrt/shapes.cpp
+1
-2
未找到文件。
src/pbrt/media.h
浏览文件 @
4426f455
...
...
@@ -222,7 +222,7 @@ class CuboidMedium {
}
// Walk ray through maximum density grid and sample scattering
Float
t0
=
tMin
,
u
=
rng
.
Uniform
<
Float
>
()
;
Float
t0
=
tMin
;
while
(
true
)
{
// Find _stepAxis_ for stepping to next voxel and exit point _t1_
int
bits
=
((
nextCrossingT
[
0
]
<
nextCrossingT
[
1
])
<<
2
)
+
...
...
@@ -242,36 +242,29 @@ class CuboidMedium {
if
(
sigma_maj
[
0
]
>
0
)
{
while
(
true
)
{
// Sample medium in current voxel
// Compute _uEnd_ for exiting voxel and continue if no valid event
Float
uEnd
=
InvertExponentialSample
(
t1
-
t0
,
sigma_maj
[
0
]);
if
(
u
>=
uEnd
)
{
u
=
std
::
min
((
u
-
uEnd
)
/
(
1
-
uEnd
),
OneMinusEpsilon
);
break
;
}
// Sample _t_ for scattering event and check validity
Float
u
=
rng
.
Uniform
<
Float
>
();
Float
t
=
t0
+
SampleExponential
(
u
,
sigma_maj
[
0
]);
if
(
t
>=
tMax
)
{
callback
(
MediumSample
(
SampledSpectrum
(
1.
f
)));
return
;
}
if
(
t
>=
t1
)
break
;
// Report scattering event in grid to callback function
Point3f
p
=
ray
(
t
);
SampledSpectrum
Tmaj
=
FastExp
(
-
sigma_maj
*
(
t
-
t0
));
// Compute _density_ and _Le_ at sampled point in grid
SampledSpectrum
density
=
provider
->
Density
(
p
,
lambda
);
SampledSpectrum
Le
=
provider
->
Le
(
p
,
lambda
);
MediumInteraction
intr
(
renderFromMedium
(
p
),
-
Normalize
(
rRender
.
d
),
rRender
.
time
,
sigma_a
*
density
,
sigma_s
*
density
,
sigma_maj
,
Le
,
this
,
&
phase
);
if
(
!
callback
(
MediumSample
(
intr
,
Tmaj
)))
return
;
// Update _u_ and _t0_ after grid medium event
u
=
rng
.
Uniform
<
Float
>
();
if
(
t
<
tMax
)
{
Point3f
p
=
ray
(
t
);
SampledSpectrum
Tmaj
=
FastExp
(
-
sigma_maj
*
(
t
-
t0
));
// Compute _density_ and _Le_ at sampled point in grid
SampledSpectrum
density
=
provider
->
Density
(
p
,
lambda
);
SampledSpectrum
Le
=
provider
->
Le
(
p
,
lambda
);
MediumInteraction
intr
(
renderFromMedium
(
p
),
-
Normalize
(
rRender
.
d
),
rRender
.
time
,
sigma_a
*
density
,
sigma_s
*
density
,
sigma_maj
,
Le
,
this
,
&
phase
);
if
(
!
callback
(
MediumSample
(
intr
,
Tmaj
)))
return
;
}
// Update _t0_ after medium interaction
t0
=
t
;
}
}
...
...
src/pbrt/shapes.cpp
浏览文件 @
4426f455
...
...
@@ -580,7 +580,6 @@ bool Curve::IntersectRay(const Ray &r, Float tMax,
L0
,
std
::
max
(
std
::
max
(
std
::
abs
(
cp
[
i
].
x
-
2
*
cp
[
i
+
1
].
x
+
cp
[
i
+
2
].
x
),
std
::
abs
(
cp
[
i
].
y
-
2
*
cp
[
i
+
1
].
y
+
cp
[
i
+
2
].
y
)),
std
::
abs
(
cp
[
i
].
z
-
2
*
cp
[
i
+
1
].
z
+
cp
[
i
+
2
].
z
)));
int
maxDepth
=
0
;
if
(
L0
>
0
)
{
Float
eps
=
std
::
max
(
common
->
width
[
0
],
common
->
width
[
1
])
*
.05
f
;
// width / 20
...
...
@@ -650,7 +649,7 @@ bool Curve::RecursiveIntersect(const Ray &ray, Float tMax, pstd::span<const Poin
Normal3f
nHit
;
if
(
common
->
type
==
CurveType
::
Ribbon
)
{
// Scale _hitWidth_ based on ribbon orientation
if
(
common
->
normalAngle
==
0
)
if
(
common
->
normalAngle
==
0
)
nHit
=
common
->
n
[
0
];
else
{
Float
sin0
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录