Overte C++ Documentation
BRDF.h
1 #pragma once
2 //
3 // BRDF.h
4 //
5 // Created by Olivier Prat on 04/04/19.
6 // Copyright 2019 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 #ifndef SHARED_BRDF_H
12 #define SHARED_BRDF_H
13 
14 #include <glm/vec2.hpp>
15 #include <glm/vec3.hpp>
16 
17 // GGX micro-facet model
18 namespace ggx {
19  float evaluate(float NdotH, float roughness);
20  glm::vec3 sample(const glm::vec2& Xi, const float roughness);
21 }
22 
23 // Smith visibility function
24 namespace smith {
25  float evaluateFastWithoutNdotV(float alphaSquared, float NdotV, float NdotL);
26 
27  inline float evaluateFast(float alphaSquared, float NdotV, float NdotL) {
28  return evaluateFastWithoutNdotV(alphaSquared, NdotV, NdotL) * NdotV;
29  }
30 
31  inline float evaluate(float roughness, float NdotV, float NdotL) {
32  return evaluateFast(roughness*roughness*roughness*roughness, NdotV, NdotL);
33  }
34 }
35 
36 #endif // SHARED_BRDF_H