Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
imjiangjun
pbrt-v4
提交
d4dc2008
P
pbrt-v4
项目概览
imjiangjun
/
pbrt-v4
9 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
d4dc2008
编写于
5月 10, 2023
作者:
M
Matt Pharr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add temperature scale and offset controls to GridMedium
上级
b8a7238e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
4 deletion
+19
-4
src/pbrt/media.cpp
src/pbrt/media.cpp
+11
-3
src/pbrt/media.h
src/pbrt/media.h
+8
-1
未找到文件。
src/pbrt/media.cpp
浏览文件 @
d4dc2008
...
...
@@ -212,8 +212,9 @@ STAT_MEMORY_COUNTER("Memory/Volume grids", volumeGridBytes);
GridMedium
::
GridMedium
(
const
Bounds3f
&
bounds
,
const
Transform
&
renderFromMedium
,
Spectrum
sigma_a
,
Spectrum
sigma_s
,
Float
sigmaScale
,
Float
g
,
SampledGrid
<
Float
>
d
,
pstd
::
optional
<
SampledGrid
<
Float
>>
temperature
,
Spectrum
Le
,
SampledGrid
<
Float
>
LeGrid
,
Allocator
alloc
)
pstd
::
optional
<
SampledGrid
<
Float
>>
temperature
,
Float
temperatureScale
,
Float
temperatureOffset
,
Spectrum
Le
,
SampledGrid
<
Float
>
LeGrid
,
Allocator
alloc
)
:
bounds
(
bounds
),
renderFromMedium
(
renderFromMedium
),
sigma_a_spec
(
sigma_a
,
alloc
),
...
...
@@ -221,6 +222,8 @@ GridMedium::GridMedium(const Bounds3f &bounds, const Transform &renderFromMedium
densityGrid
(
std
::
move
(
d
)),
phase
(
g
),
temperatureGrid
(
std
::
move
(
temperature
)),
temperatureScale
(
temperatureScale
),
temperatureOffset
(
temperatureOffset
),
Le_spec
(
Le
,
alloc
),
LeScale
(
std
::
move
(
LeGrid
)),
majorantGrid
(
bounds
,
{
16
,
16
,
16
},
alloc
)
{
...
...
@@ -316,9 +319,14 @@ GridMedium *GridMedium::Create(const ParameterDictionary ¶meters,
sigma_s
=
alloc
.
new_object
<
ConstantSpectrum
>
(
1.
f
);
Float
sigmaScale
=
parameters
.
GetOneFloat
(
"scale"
,
1.
f
);
Float
temperatureOffset
=
parameters
.
GetOneFloat
(
"temperatureoffset"
,
parameters
.
GetOneFloat
(
"temperaturecutoff"
,
0.
f
));
Float
temperatureScale
=
parameters
.
GetOneFloat
(
"temperaturescale"
,
1.
f
);
return
alloc
.
new_object
<
GridMedium
>
(
Bounds3f
(
p0
,
p1
),
renderFromMedium
,
sigma_a
,
sigma_s
,
sigmaScale
,
g
,
std
::
move
(
densityGrid
),
std
::
move
(
temperatureGrid
),
Le
,
std
::
move
(
LeGrid
),
alloc
);
std
::
move
(
densityGrid
),
std
::
move
(
temperatureGrid
),
temperatureScale
,
temperatureOffset
,
Le
,
std
::
move
(
LeGrid
),
alloc
);
}
std
::
string
GridMedium
::
ToString
()
const
{
...
...
src/pbrt/media.h
浏览文件 @
d4dc2008
...
...
@@ -271,6 +271,7 @@ class GridMedium {
GridMedium
(
const
Bounds3f
&
bounds
,
const
Transform
&
renderFromMedium
,
Spectrum
sigma_a
,
Spectrum
sigma_s
,
Float
sigmaScale
,
Float
g
,
SampledGrid
<
Float
>
density
,
pstd
::
optional
<
SampledGrid
<
Float
>>
temperature
,
Float
temperatureScale
,
Float
temperatureOffset
,
Spectrum
Le
,
SampledGrid
<
Float
>
LeScale
,
Allocator
alloc
);
static
GridMedium
*
Create
(
const
ParameterDictionary
&
parameters
,
...
...
@@ -303,7 +304,12 @@ class GridMedium {
// Compute emitted radiance using _temperatureGrid_ or _Le_spec_
if
(
temperatureGrid
)
{
Float
temp
=
temperatureGrid
->
Lookup
(
p
);
Le
=
scale
*
BlackbodySpectrum
(
temp
).
Sample
(
lambda
);
// Added after book publication: optionally offset and scale
// temperature based on user-supplied parameters. (Match
// NanoVDBMedium functionality.)
temp
=
(
temp
-
temperatureOffset
)
*
temperatureScale
;
if
(
temp
>
100.
f
)
Le
=
scale
*
BlackbodySpectrum
(
temp
).
Sample
(
lambda
);
}
else
Le
=
scale
*
Le_spec
.
Sample
(
lambda
);
}
...
...
@@ -341,6 +347,7 @@ class GridMedium {
DenselySampledSpectrum
Le_spec
;
SampledGrid
<
Float
>
LeScale
;
bool
isEmissive
;
Float
temperatureScale
,
temperatureOffset
;
MajorantGrid
majorantGrid
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录