Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
LbLayeredSurface.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <Common/primitive_type.h>
8
9#include <vector>
10
11namespace ph
12{
13
19{
20public:
22 const std::vector<math::Spectrum>& iorNs,
23 const std::vector<math::Spectrum>& iorKs,
24 const std::vector<real>& alphas,
25 const std::vector<real>& depths,
26 const std::vector<real>& gs,
27 const std::vector<math::Spectrum>& sigmaAs,
28 const std::vector<math::Spectrum>& sigmaSs);
29
30 ESurfacePhenomenon getPhenomenonOf(SurfaceElemental elemental) const override;
31
32 std::string toString() const override;
33
34private:
35 void calcBsdf(
36 const BsdfQueryContext& ctx,
37 const BsdfEvalInput& in,
38 BsdfEvalOutput& out) const override;
39
40 void genBsdfSample(
41 const BsdfQueryContext& ctx,
42 const BsdfSampleInput& in,
43 SampleFlow& sampleFlow,
44 BsdfSampleOutput& out) const override;
45
46 void calcBsdfPdf(
47 const BsdfQueryContext& ctx,
48 const BsdfPdfInput& in,
49 BsdfPdfOutput& out) const override;
50
51 std::vector<math::Spectrum> m_iorNs;
52 std::vector<math::Spectrum> m_iorKs;
53 std::vector<real> m_alphas;
54 std::vector<real> m_depths;
55 std::vector<real> m_gs;
56 std::vector<math::Spectrum> m_sigmaAs;
57 std::vector<math::Spectrum> m_sigmaSs;
58
59 static thread_local std::vector<real> sampleWeights;
60 static thread_local std::vector<real> alphas;
61
62 std::size_t numLayers() const;
63 LbLayer getLayer(std::size_t layerIndex, const LbLayer& previousLayer) const;
64};
65
66// In-header Implementations:
67
68inline std::size_t LbLayeredSurface::numLayers() const
69{
70 return m_alphas.size();
71}
72
73inline std::string LbLayeredSurface::toString() const
74{
75 return "L.B. Layered Surface, " + SurfaceOptics::toString();
76}
77
78}// end namespace ph
Input for BsdfEvalQuery.
Definition BsdfEvalQuery.h:20
Output for BsdfEvalQuery.
Definition BsdfEvalQuery.h:47
Input for BsdfPdfQuery.
Definition BsdfPdfQuery.h:19
Output for BsdfPdfQuery.
Definition BsdfPdfQuery.h:46
The environment a BSDF query is performed under.
Definition BsdfQueryContext.h:13
Input for BsdfSampleQuery.
Definition BsdfSampleQuery.h:21
Output for BsdfSampleQuery.
Definition BsdfSampleQuery.h:45
Definition LbLayer.h:11
Laurent Belcour's layered BSDF model. This is the symmetric model as described in Section 6....
Definition LbLayeredSurface.h:19
std::string toString() const override
Definition LbLayeredSurface.h:73
LbLayeredSurface(const std::vector< math::Spectrum > &iorNs, const std::vector< math::Spectrum > &iorKs, const std::vector< real > &alphas, const std::vector< real > &depths, const std::vector< real > &gs, const std::vector< math::Spectrum > &sigmaAs, const std::vector< math::Spectrum > &sigmaSs)
Definition LbLayeredSurface.cpp:37
ESurfacePhenomenon getPhenomenonOf(SurfaceElemental elemental) const override
Get the phenomenon of a surface component. One can also setup query for a specific elemental....
Definition LbLayeredSurface.cpp:66
A sample with arbitrary dimensions with fine-grained sampling control.
Definition SampleFlow.h:19
Describes how light interacts with a surface.
Definition SurfaceOptics.h:17
virtual std::string toString() const
Definition SurfaceOptics.h:104
The root for all renderer implementations.
Definition EEngineProject.h:6
ESurfacePhenomenon
Available surface phenomena.
Definition surface_optics_fwd.h:16
int SurfaceElemental
Definition surface_optics_fwd.h:30