Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
imjiangjun
pbrt-v4
提交
de901103
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,发现更多精彩内容 >>
提交
de901103
编写于
4月 24, 2021
作者:
M
Matt Pharr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ignore area lights with "interface" material.
Thus, "interface" is purely for specifying medium transitions. Issue #112.
上级
30c5815a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
64 addition
and
26 deletion
+64
-26
src/pbrt/cpu/render.cpp
src/pbrt/cpu/render.cpp
+15
-8
src/pbrt/gpu/accel.cpp
src/pbrt/gpu/accel.cpp
+30
-18
src/pbrt/gpu/pathintegrator.cpp
src/pbrt/gpu/pathintegrator.cpp
+19
-0
未找到文件。
src/pbrt/cpu/render.cpp
浏览文件 @
de901103
...
...
@@ -164,14 +164,21 @@ void CPURender(ParsedScene &parsedScene) {
Light
area
=
nullptr
;
if
(
sh
.
lightIndex
!=
-
1
)
{
CHECK_LT
(
sh
.
lightIndex
,
parsedScene
.
areaLights
.
size
());
const
auto
&
areaLightEntity
=
parsedScene
.
areaLights
[
sh
.
lightIndex
];
area
=
Light
::
CreateArea
(
areaLightEntity
.
name
,
areaLightEntity
.
parameters
,
*
sh
.
renderFromObject
,
mi
,
s
,
&
areaLightEntity
.
loc
,
Allocator
{});
if
(
area
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
lightsMutex
);
lights
.
push_back
(
area
);
if
(
!
mtl
)
Warning
(
&
sh
.
loc
,
"Ignoring area light specification for shape "
"with
\"
interface
\"
material."
);
else
{
const
auto
&
areaLightEntity
=
parsedScene
.
areaLights
[
sh
.
lightIndex
];
area
=
Light
::
CreateArea
(
areaLightEntity
.
name
,
areaLightEntity
.
parameters
,
*
sh
.
renderFromObject
,
mi
,
s
,
&
areaLightEntity
.
loc
,
Allocator
{});
if
(
area
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
lightsMutex
);
lights
.
push_back
(
area
);
}
}
}
if
(
area
==
nullptr
&&
!
mi
.
IsMediumTransition
()
&&
!
alphaTex
)
...
...
src/pbrt/gpu/accel.cpp
浏览文件 @
de901103
...
...
@@ -347,12 +347,16 @@ OptixTraversableHandle GPUAccel::createGASForTriangles(
hgRecord
.
triRec
.
alphaTexture
=
alphaTexture
;
hgRecord
.
triRec
.
areaLights
=
{};
if
(
shape
.
lightIndex
!=
-
1
)
{
// Note: this will hit if we try to have an instance as an area
// light.
auto
iter
=
shapeIndexToAreaLights
.
find
(
shapeIndex
);
CHECK
(
iter
!=
shapeIndexToAreaLights
.
end
());
CHECK_EQ
(
iter
->
second
->
size
(),
mesh
->
nTriangles
);
hgRecord
.
triRec
.
areaLights
=
pstd
::
MakeSpan
(
*
iter
->
second
);
if
(
!
material
)
Warning
(
&
shape
.
loc
,
"Ignoring area light specification for shape with
\"
interface
\"
material."
);
else
{
// Note: this will hit if we try to have an instance as an area
// light.
auto
iter
=
shapeIndexToAreaLights
.
find
(
shapeIndex
);
CHECK
(
iter
!=
shapeIndexToAreaLights
.
end
());
CHECK_EQ
(
iter
->
second
->
size
(),
mesh
->
nTriangles
);
hgRecord
.
triRec
.
areaLights
=
pstd
::
MakeSpan
(
*
iter
->
second
);
}
}
hgRecord
.
triRec
.
mediumInterface
=
getMediumInterface
(
shape
,
media
,
alloc
);
...
...
@@ -428,12 +432,16 @@ OptixTraversableHandle GPUAccel::createGASForBLPs(
hgRecord
.
bilinearRec
.
alphaTexture
=
alphaTexture
;
hgRecord
.
bilinearRec
.
areaLights
=
{};
if
(
shape
.
lightIndex
!=
-
1
)
{
auto
iter
=
shapeIndexToAreaLights
.
find
(
shapeIndex
);
// Note: this will hit if we try to have an instance as an area
// light.
CHECK
(
iter
!=
shapeIndexToAreaLights
.
end
());
CHECK_EQ
(
iter
->
second
->
size
(),
mesh
->
nPatches
);
hgRecord
.
bilinearRec
.
areaLights
=
pstd
::
MakeSpan
(
*
iter
->
second
);
if
(
!
material
)
Warning
(
&
shape
.
loc
,
"Ignoring area light specification for shape with
\"
interface
\"
material."
);
else
{
auto
iter
=
shapeIndexToAreaLights
.
find
(
shapeIndex
);
// Note: this will hit if we try to have an instance as an area
// light.
CHECK
(
iter
!=
shapeIndexToAreaLights
.
end
());
CHECK_EQ
(
iter
->
second
->
size
(),
mesh
->
nPatches
);
hgRecord
.
bilinearRec
.
areaLights
=
pstd
::
MakeSpan
(
*
iter
->
second
);
}
}
hgRecord
.
bilinearRec
.
mediumInterface
=
getMediumInterface
(
shape
,
media
,
alloc
);
...
...
@@ -517,12 +525,16 @@ OptixTraversableHandle GPUAccel::createGASForQuadrics(
hgRecord
.
quadricRec
.
alphaTexture
=
alphaTexture
;
hgRecord
.
quadricRec
.
areaLight
=
nullptr
;
if
(
s
.
lightIndex
!=
-
1
)
{
auto
iter
=
shapeIndexToAreaLights
.
find
(
shapeIndex
);
// Note: this will hit if we try to have an instance as an area
// light.
CHECK
(
iter
!=
shapeIndexToAreaLights
.
end
());
CHECK_EQ
(
iter
->
second
->
size
(),
1
);
hgRecord
.
quadricRec
.
areaLight
=
(
*
iter
->
second
)[
0
];
if
(
!
material
)
Warning
(
&
s
.
loc
,
"Ignoring area light specification for shape with
\"
interface
\"
material."
);
else
{
auto
iter
=
shapeIndexToAreaLights
.
find
(
shapeIndex
);
// Note: this will hit if we try to have an instance as an area
// light.
CHECK
(
iter
!=
shapeIndexToAreaLights
.
end
());
CHECK_EQ
(
iter
->
second
->
size
(),
1
);
hgRecord
.
quadricRec
.
areaLight
=
(
*
iter
->
second
)[
0
];
}
}
hgRecord
.
quadricRec
.
mediumInterface
=
getMediumInterface
(
s
,
media
,
alloc
);
...
...
src/pbrt/gpu/pathintegrator.cpp
浏览文件 @
de901103
...
...
@@ -120,6 +120,25 @@ GPUPathIntegrator::GPUPathIntegrator(Allocator alloc, const ParsedScene &scene)
const
auto
&
shape
=
scene
.
shapes
[
i
];
if
(
shape
.
lightIndex
==
-
1
)
continue
;
auto
isInterface
=
[
&
]()
{
const
SceneEntity
*
mtl
=
nullptr
;
if
(
shape
.
materialIndex
!=
-
1
)
mtl
=
&
scene
.
materials
[
shape
.
materialIndex
];
else
{
for
(
auto
iter
=
scene
.
namedMaterials
.
begin
();
iter
!=
scene
.
namedMaterials
.
end
();
++
iter
)
if
(
iter
->
first
==
shape
.
materialName
)
{
mtl
=
&
iter
->
second
;
break
;
}
CHECK
(
mtl
!=
nullptr
);
}
return
(
mtl
->
name
==
"interface"
||
mtl
->
name
==
"none"
||
mtl
->
name
.
empty
());
};
if
(
isInterface
())
continue
;
CHECK_LT
(
shape
.
lightIndex
,
scene
.
areaLights
.
size
());
const
auto
&
areaLightEntity
=
scene
.
areaLights
[
shape
.
lightIndex
];
AnimatedTransform
renderFromLight
(
*
shape
.
renderFromObject
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录