Skip to content

Commit 605f3c4

Browse files
Create reflection.hlsl
1 parent 3671194 commit 605f3c4

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (C) 2018-2020 - DevSH Graphics Programming Sp. z O.O.
2+
// This file is part of the "Nabla Engine".
3+
// For conditions of distribution and use, see copyright notice in nabla.h
4+
#ifndef _NBL_BUILTIN_HLSL_BXDF_REFLECTION_INCLUDED_
5+
#define _NBL_BUILTIN_HLSL_BXDF_REFLECTION_INCLUDED_
6+
7+
#include <nbl/builtin/hlsl/bxdf/common.hlsl>
8+
9+
namespace nbl
10+
{
11+
namespace hlsl
12+
{
13+
namespace bxdf
14+
{
15+
namespace reflection
16+
{
17+
18+
template<class RayDirInfo>
19+
LightSample<RayDirInfo> cos_generate(const surface_interactions::Isotropic<RayDirInfo> interaction)
20+
{
21+
return LightSample<RayDirInfo>(interaction.V.reflect(interaction.N,interaction.NdotV),interaction.NdotV,interaction.N);
22+
}
23+
template<class RayDirInfo>
24+
LightSample<RayDirInfo> cos_generate(const surface_interactions::Anisotropic<RayDirInfo> interaction)
25+
{
26+
return LightSample<RayDirInfo>(interaction.V.reflect(interaction.N,interaction.NdotV),interaction.NdotV,interaction.T,interaction.B,interaction.N);
27+
}
28+
29+
// for information why we don't check the relation between `V` and `L` or `N` and `H`, see comments for `nbl::hlsl::transmission::cos_quotient_and_pdf`
30+
template<typename SpectralBins>
31+
quotient_and_pdf<SpectralBins> cos_quotient_and_pdf()
32+
{
33+
return quotient_and_pdf<SpectralBins>::create(SpectralBins(1.f),nbl::hlsl::numeric_limits<float>::inf());
34+
}
35+
36+
}
37+
}
38+
}
39+
}
40+
41+
#endif

0 commit comments

Comments
 (0)