Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
imjiangjun
pbrt-v4
提交
1bbaf69d
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,发现更多精彩内容 >>
提交
1bbaf69d
编写于
12月 26, 2021
作者:
M
Matt Pharr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update from book source. No functional changes.
上级
64c0a5cc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
50 deletion
+44
-50
src/pbrt/base/medium.h
src/pbrt/base/medium.h
+1
-1
src/pbrt/bxdfs.cpp
src/pbrt/bxdfs.cpp
+25
-28
src/pbrt/bxdfs.h
src/pbrt/bxdfs.h
+4
-8
src/pbrt/cameras.h
src/pbrt/cameras.h
+6
-6
src/pbrt/util/math.h
src/pbrt/util/math.h
+8
-7
未找到文件。
src/pbrt/base/medium.h
浏览文件 @
1bbaf69d
...
...
@@ -75,7 +75,7 @@ class RayMajorantIterator
// Medium Definition
class
Medium
:
public
TaggedPointer
<
// Medium Types
HomogeneousMedium
,
CloudMedium
,
GridMedium
,
RGBGri
dMedium
,
NanoVDBMedium
HomogeneousMedium
,
GridMedium
,
RGBGridMedium
,
Clou
dMedium
,
NanoVDBMedium
>
{
public:
...
...
src/pbrt/bxdfs.cpp
浏览文件 @
1bbaf69d
...
...
@@ -859,16 +859,13 @@ std::string Tensor::ToString() const {
// MeasuredBxDFData Definition
struct
MeasuredBxDFData
{
// MeasuredBxDFData Public Members
using
Warp2D3
=
PiecewiseLinear2D
<
3
>
;
Warp2D3
spectra
;
pstd
::
vector
<
float
>
wavelengths
;
using
Warp2D0
=
PiecewiseLinear2D
<
0
>
;
using
Warp2D2
=
PiecewiseLinear2D
<
2
>
;
Warp2D0
ndf
;
Warp2D2
vndf
;
Warp2D0
sigma
;
PiecewiseLinear2D
<
3
>
spectra
;
PiecewiseLinear2D
<
0
>
ndf
;
PiecewiseLinear2D
<
2
>
vndf
;
PiecewiseLinear2D
<
0
>
sigma
;
bool
isotropic
;
Warp2D2
luminance
;
PiecewiseLinear2D
<
2
>
luminance
;
MeasuredBxDFData
(
Allocator
alloc
)
:
ndf
(
alloc
),
sigma
(
alloc
),
...
...
@@ -948,24 +945,24 @@ MeasuredBxDFData *MeasuredBxDFData::Create(const std::string &filename, Allocato
}
/* Construct NDF interpolant data structure */
brdf
->
ndf
=
Warp2D0
(
alloc
,
(
float
*
)
ndf
.
data
.
get
(),
ndf
.
shape
[
1
],
ndf
.
shape
[
0
],
{}
,
{},
false
,
false
);
brdf
->
ndf
=
PiecewiseLinear2D
<
0
>
(
alloc
,
(
float
*
)
ndf
.
data
.
get
(),
ndf
.
shape
[
1
]
,
ndf
.
shape
[
0
],
{},
{},
false
,
false
);
/* Construct projected surface area interpolant data structure */
brdf
->
sigma
=
Warp2D0
(
alloc
,
(
float
*
)
sigma
.
data
.
get
(),
sigma
.
shape
[
1
],
sigma
.
shape
[
0
],
{},
{},
false
,
false
);
brdf
->
sigma
=
PiecewiseLinear2D
<
0
>
(
alloc
,
(
float
*
)
sigma
.
data
.
get
(),
sigma
.
shape
[
1
],
sigma
.
shape
[
0
],
{},
{},
false
,
false
);
/* Construct VNDF warp data structure */
brdf
->
vndf
=
Warp2D2
(
alloc
,
(
float
*
)
vndf
.
data
.
get
(),
vndf
.
shape
[
3
],
vndf
.
shape
[
2
],
{{(
int
)
phi_i
.
shape
[
0
],
(
int
)
theta_i
.
shape
[
0
]}},
{{(
const
float
*
)
phi_i
.
data
.
get
(),
(
const
float
*
)
theta_i
.
data
.
get
()}});
brdf
->
vndf
=
PiecewiseLinear2D
<
2
>
(
alloc
,
(
float
*
)
vndf
.
data
.
get
(),
vndf
.
shape
[
3
],
vndf
.
shape
[
2
],
{{(
int
)
phi_i
.
shape
[
0
],
(
int
)
theta_i
.
shape
[
0
]}},
{{(
const
float
*
)
phi_i
.
data
.
get
(),
(
const
float
*
)
theta_i
.
data
.
get
()}});
/* Construct Luminance warp data structure */
brdf
->
luminance
=
Warp2D2
(
alloc
,
(
float
*
)
luminance
.
data
.
get
(),
luminance
.
shape
[
3
],
luminance
.
shape
[
2
],
{{(
int
)
phi_i
.
shape
[
0
],
(
int
)
theta_i
.
shape
[
0
]}},
{{(
const
float
*
)
phi_i
.
data
.
get
(),
(
const
float
*
)
theta_i
.
data
.
get
()}});
brdf
->
luminance
=
PiecewiseLinear2D
<
2
>
(
alloc
,
(
float
*
)
luminance
.
data
.
get
(),
luminance
.
shape
[
3
],
luminance
.
shape
[
2
],
{{(
int
)
phi_i
.
shape
[
0
],
(
int
)
theta_i
.
shape
[
0
]}},
{{(
const
float
*
)
phi_i
.
data
.
get
(),
(
const
float
*
)
theta_i
.
data
.
get
()}});
/* Copy wavelength information */
size_t
size
=
wavelengths
.
shape
[
0
];
...
...
@@ -974,12 +971,12 @@ MeasuredBxDFData *MeasuredBxDFData::Create(const std::string &filename, Allocato
brdf
->
wavelengths
[
i
]
=
((
const
float
*
)
wavelengths
.
data
.
get
())[
i
];
/* Construct spectral interpolant */
brdf
->
spectra
=
Warp2D3
(
alloc
,
(
float
*
)
spectra
.
data
.
get
(),
spectra
.
shape
[
4
],
spectra
.
shape
[
3
],
{{(
int
)
phi_i
.
shape
[
0
],
(
int
)
theta_i
.
shape
[
0
],
(
int
)
wavelengths
.
shape
[
0
]}},
{{(
const
float
*
)
phi_i
.
data
.
get
(),
(
const
float
*
)
theta_i
.
data
.
get
(),
(
const
float
*
)
wavelengths
.
data
.
get
()}},
false
,
false
);
brdf
->
spectra
=
PiecewiseLinear2D
<
3
>
(
alloc
,
(
float
*
)
spectra
.
data
.
get
(),
spectra
.
shape
[
4
],
spectra
.
shape
[
3
],
{{(
int
)
phi_i
.
shape
[
0
],
(
int
)
theta_i
.
shape
[
0
],
(
int
)
wavelengths
.
shape
[
0
]}},
{{(
const
float
*
)
phi_i
.
data
.
get
(),
(
const
float
*
)
theta_i
.
data
.
get
(),
(
const
float
*
)
wavelengths
.
data
.
get
()}},
false
,
false
);
measuredBRDFBytes
+=
sizeof
(
MeasuredBxDFData
)
+
4
*
brdf
->
wavelengths
.
size
()
+
brdf
->
ndf
.
BytesUsed
()
+
brdf
->
sigma
.
BytesUsed
()
+
...
...
@@ -1018,13 +1015,13 @@ SampledSpectrum MeasuredBxDF::f(Vector3f wo, Vector3f wi, TransportMode mode) co
Float
theta_m
=
SphericalTheta
(
wm
),
phi_m
=
std
::
atan2
(
wm
.
y
,
wm
.
x
);
Point2f
u_wo
(
theta2u
(
theta_o
),
phi2u
(
phi_o
));
Point2f
u_wm
(
theta2u
(
theta_m
),
phi2u
(
brdf
->
isotropic
?
(
phi_m
-
phi_o
)
:
phi_m
));
u_wm
.
y
=
u_wm
.
y
-
pstd
::
floor
(
u_wm
.
y
);
u_wm
[
1
]
=
u_wm
[
1
]
-
pstd
::
floor
(
u_wm
[
1
]
);
// Evaluate inverse parameterization $R^{-1}$
PLSample
ui
=
brdf
->
vndf
.
Invert
(
u_wm
,
phi_o
,
theta_o
);
// Evaluate spectral 5D interpolant
SampledSpectrum
fr
(
0
)
;
SampledSpectrum
fr
;
for
(
int
i
=
0
;
i
<
NSpectrumSamples
;
++
i
)
fr
[
i
]
=
std
::
max
<
Float
>
(
0
,
brdf
->
spectra
.
Evaluate
(
ui
.
p
,
phi_o
,
theta_o
,
lambda
[
i
]));
...
...
src/pbrt/bxdfs.h
浏览文件 @
1bbaf69d
...
...
@@ -174,14 +174,10 @@ class DielectricBxDF {
PBRT_CPU_GPU
BxDFFlags
Flags
()
const
{
if
(
eta
==
1
)
return
BxDFFlags
::
Transmission
|
(
mfDistrib
.
EffectivelySmooth
()
?
BxDFFlags
::
Specular
:
BxDFFlags
::
Glossy
);
else
return
BxDFFlags
::
Reflection
|
BxDFFlags
::
Transmission
|
(
mfDistrib
.
EffectivelySmooth
()
?
BxDFFlags
::
Specular
:
BxDFFlags
::
Glossy
);
BxDFFlags
flags
=
(
eta
==
1
)
?
BxDFFlags
::
Transmission
:
(
BxDFFlags
::
Reflection
|
BxDFFlags
::
Transmission
);
return
flags
|
(
mfDistrib
.
EffectivelySmooth
()
?
BxDFFlags
::
Specular
:
BxDFFlags
::
Glossy
);
}
PBRT_CPU_GPU
...
...
src/pbrt/cameras.h
浏览文件 @
1bbaf69d
...
...
@@ -252,7 +252,7 @@ class ProjectiveCamera : public CameraBase {
std
::
string
BaseToString
()
const
;
ProjectiveCamera
(
CameraBaseParameters
baseParameters
,
const
Transform
&
screenFromCamera
,
const
Bounds2f
&
screenWindow
,
const
Transform
&
screenFromCamera
,
Bounds2f
screenWindow
,
Float
lensRadius
,
Float
focalDistance
)
:
CameraBase
(
baseParameters
),
screenFromCamera
(
screenFromCamera
),
...
...
@@ -282,10 +282,10 @@ class ProjectiveCamera : public CameraBase {
class
OrthographicCamera
:
public
ProjectiveCamera
{
public:
// OrthographicCamera Public Methods
OrthographicCamera
(
CameraBaseParameters
baseParameters
,
const
Bounds2f
&
screenWindow
,
Float
lensRadius
,
Float
focalDist
ance
)
OrthographicCamera
(
CameraBaseParameters
baseParameters
,
Bounds2f
screenWindow
,
Float
lensRadius
,
Float
focalDist
)
:
ProjectiveCamera
(
baseParameters
,
Orthographic
(
0
,
1
),
screenWindow
,
lensRadius
,
focalDist
ance
)
{
focalDist
)
{
// Compute differential changes in origin for orthographic camera rays
dxCamera
=
cameraFromRaster
(
Vector3f
(
1
,
0
,
0
));
dyCamera
=
cameraFromRaster
(
Vector3f
(
0
,
1
,
0
));
...
...
@@ -340,9 +340,9 @@ class PerspectiveCamera : public ProjectiveCamera {
public:
// PerspectiveCamera Public Methods
PerspectiveCamera
(
CameraBaseParameters
baseParameters
,
Float
fov
,
const
Bounds2f
&
screenWindow
,
Float
lensRadius
,
Float
focalDistance
)
Bounds2f
screenWindow
,
Float
lensRadius
,
Float
focalDist
)
:
ProjectiveCamera
(
baseParameters
,
Perspective
(
fov
,
1e-2
f
,
1000.
f
),
screenWindow
,
lensRadius
,
focalDist
ance
)
{
lensRadius
,
focalDist
)
{
// Compute differential changes in origin for perspective camera rays
dxCamera
=
cameraFromRaster
(
Point3f
(
1
,
0
,
0
))
-
cameraFromRaster
(
Point3f
(
0
,
0
,
0
));
...
...
src/pbrt/util/math.h
浏览文件 @
1bbaf69d
...
...
@@ -204,19 +204,13 @@ struct CompensatedFloat {
template
<
int
N
>
class
SquareMatrix
;
PBRT_CPU_GPU
inline
Float
SinXOverX
(
Float
x
);
// Math Inline Functions
PBRT_CPU_GPU
inline
Float
Lerp
(
Float
x
,
Float
a
,
Float
b
)
{
return
(
1
-
x
)
*
a
+
x
*
b
;
}
// http://www.plunk.org/~hatch/rightway.html
PBRT_CPU_GPU
inline
Float
SinXOverX
(
Float
x
)
{
if
(
1
+
x
*
x
==
1
)
return
1
;
return
std
::
sin
(
x
)
/
x
;
}
template
<
typename
T
>
inline
PBRT_CPU_GPU
typename
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
T
>
FMA
(
T
a
,
T
b
,
T
c
)
{
...
...
@@ -342,6 +336,13 @@ PBRT_CPU_GPU inline constexpr Float EvaluatePolynomial(Float t, C c, Args... cRe
return
FMA
(
t
,
EvaluatePolynomial
(
t
,
cRemaining
...),
c
);
}
// http://www.plunk.org/~hatch/rightway.html
PBRT_CPU_GPU
inline
Float
SinXOverX
(
Float
x
)
{
if
(
1
+
x
*
x
==
1
)
return
1
;
return
std
::
sin
(
x
)
/
x
;
}
PBRT_CPU_GPU
inline
float
SafeASin
(
float
x
)
{
DCHECK
(
x
>=
-
1.0001
&&
x
<=
1.0001
);
return
std
::
asin
(
Clamp
(
x
,
-
1
,
1
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录