 	return schlick(F0 * F0, HdotV);
 }
 
-float TrowbridgeReitz(float a, float NdotH)
-{
-		float a2 = a * a;
-		float pi = 3.1417;
-		float denominator2 = ((NdotH * NdotH) * (a2 - 1.0) + 1.0);
-		float denominator  = pi * (denominator2 * denominator2);
-		
-		return a2 / denominator;
-}
-
-float DGGXTrowbridgeReitz(float roughness, float NdotH)
+float d_gtr2(float roughness, float NdotH)
 {
 	float a2 = roughness * roughness;
-	float deno = 3.1417 * pow((NdotH * NdotH) * (a2 - 1.0) + 1.0, 2.0);
+	float term1 = 3.1417;
+	float term2 = (NdotH * NdotH) * (a2 - 1.0) + 1.0;
+	float deno = term1 * (term2 * term2);
 	return a2 / deno;
 }
 
-float compute_spec(float ior, float roughness, vec3 H, vec3 L, vec3 N, vec3 V, float F)
+vec3 compute_specular(float ior, float roughness, directions dir, float F)
 {
 	/*
 		Cook-Torrance Microfacet model.

		G = geometric attenuation.
		F = fresnel coefficient.
	*/
	float NdotH = max(0.0, dot(N, H));
	float NdotV = max(0.0, dot(N, V));
	float VdotH = max(0.0, dot(V, H));
	float NdotL = max(0.0, dot(N, L));

	float gauss = 9.0;

	float G = min(
		1.0, 

	uniform vec3 cameraPosition;
*/

/*
	Contains common vectors for different stuff,
	unclutters the code quite a bit.
*/
struct directions
{
	vec3 H;
	vec3 L;
	vec3 N;
	vec3 V;
};

float schlick(float F0, float HdotV)
{
	return F0 + (1.0 - F0) * pow((1.0 - HdotV), 5.0);
