 	vec3 albedo;			// diffuse light absorbtion value (rgb)
 	vec3 R;				// reflection vector
 	vec3 F;				// fresnel term computed from f0, N and V
-	void Update();
 };
 
-void Surface::Update()
-{
-	NdotV = abs(dot(N, V)) + 1e-5f; // avoid artifact
-
-	albedo = baseColor.rgb * (1.0 - metalness);
-	f0 = lerp(vec3(0.04), baseColor.rgb, metalness);
-	R = -reflect(V, N);
-	float f90 = saturate(50.0 * dot(f0, vec3(0.33,0.33,0.33)));
-	F = F_Schlick(f0, f90, NdotV);
-}
-	
+void updateSurface(inout Surface surface)
+{
+	surface.NdotV = abs(dot(surface.N, surface.V)) + 1e-5f; // avoid artifact
+
+	surface.albedo = surface.baseColor.rgb * (1.0 - surface.metalness);
+	surface.f0 = lerp(vec3(0.04), surface.baseColor.rgb, surface.metalness);
+	surface.R = -reflect(surface.V, surface.N);
+	float f90 = saturate(50.0 * dot(surface.f0, vec3(0.33,0.33,0.33)));
+	surface.F = F_Schlick(surface.f0, f90, surface.NdotV);
+}
+
 Surface createSurface(vec4 normDepth, sampler2D colorBuffer, sampler2D matInfoBuffer, in vec2 uv, in vec3 wsEyePos, in vec3 wsEyeRay, in mat4 invView)
 {
 	Surface surface;// = Surface();

	surface.metalness = gbuffer2.a;
	surface.ao = gbuffer2.g;
	surface.matFlag = gbuffer2.r;
	surface.Update();
	return surface;
}


  surface.ao = pbrProperties.g;
  surface.matFlag = pbrProperties.r;

    updateSurface(surface);
	return surface;
}

