|
@@ -46,13 +46,13 @@ float D_GGX( const in float alpha, const in float dotNH ) {
|
|
|
}
|
|
|
|
|
|
// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
|
|
|
-vec3 BRDF_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
|
|
|
+vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
|
|
|
|
|
|
float alpha = pow2( roughness ); // UE4's roughness
|
|
|
|
|
|
- vec3 halfDir = normalize( incidentLight.direction + viewDir );
|
|
|
+ vec3 halfDir = normalize( lightDir + viewDir );
|
|
|
|
|
|
- float dotNL = saturate( dot( normal, incidentLight.direction ) );
|
|
|
+ float dotNL = saturate( dot( normal, lightDir ) );
|
|
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|
|
float dotNH = saturate( dot( normal, halfDir ) );
|
|
|
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
@@ -198,12 +198,12 @@ float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-vec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
|
|
|
+vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
|
|
|
|
- vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
|
|
|
+ vec3 halfDir = normalize( lightDir + viewDir );
|
|
|
|
|
|
- float dotNH = saturate( dot( geometry.normal, halfDir ) );
|
|
|
- float dotVH = saturate( dot( geometry.viewDir, halfDir ) );
|
|
|
+ float dotNH = saturate( dot( normal, halfDir ) );
|
|
|
+ float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
|
|
|
|
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
|
|