This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float D_GGX(float linearRoughness, float NoH, const vec3 h) { | |
// Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces" | |
// In mediump, there are two problems computing 1.0 - NoH^2 | |
// 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights) | |
// 2) NoH doesn't have enough precision around 1.0 | |
// Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well | |
// However, we can do better using Lagrange's identity: | |
// ||a x b||^2 = ||a||^2 ||b||^2 - (a . b)^2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cinder/app/AppCocoaTouch.h" | |
#include "cinder/app/Renderer.h" | |
#include "cinder/Camera.h" | |
#include "cinder/CinderResources.h" | |
#include "cinder/ImageIo.h" | |
#include "cinder/gl/Texture.h" | |
#include <vector> | |
#include <map> | |
#include <list> |
NewerOlder