MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / SampleSun

Function SampleSun

BakingLab/PathTracer.cpp:74–87  ·  view source on GitHub ↗

Returns the direct sun radiance for a direction on the skydome

Source from the content-addressed store, hash-verified

72
73// Returns the direct sun radiance for a direction on the skydome
74static Float3 SampleSun(Float3 sampleDir)
75{
76 Float3 res = 0.0f;
77 if(AppSettings::EnableSun)
78 {
79 float cosSunAngularRadius = std::cos(DegToRad(AppSettings::SunSize));
80 Float3 sunDir = Float3::Normalize(AppSettings::SunDirection);
81 float cosGamma = Float3::Dot(sunDir, sampleDir);
82 if(cosGamma >= cosSunAngularRadius)
83 res = AppSettings::SunLuminance();
84 }
85
86 return res;
87}
88
89// Checks if a hit triangle is back-facing
90static bool IsTriangleBackFacing(const EmbreeRay& ray, const BVHData& bvhData)

Callers 1

PathTraceFunction · 0.85

Calls 3

cosFunction · 0.85
DegToRadFunction · 0.85
SunLuminanceFunction · 0.85

Tested by

no test coverage detected