cubemap reflection update
This commit is contained in:
@@ -55,8 +55,6 @@ inline void dirLight(in float3 P, in float3 N, in float3 V, in float roughness,
|
||||
specular = g_xDirLight_col.rgb * BRDF_SPECULAR(roughness, f0);
|
||||
diffuse = g_xDirLight_col.rgb * BRDF_DIFFUSE(roughness);
|
||||
|
||||
specular += EnvironmentReflection(N, V, P, roughness, f0);
|
||||
|
||||
float sh = max(NdotL, 0);
|
||||
float4 ShPos[3];
|
||||
ShPos[0] = mul(float4(P,1),g_xDirLight_ShM[0]);
|
||||
@@ -92,6 +90,8 @@ inline void dirLight(in float3 P, in float3 N, in float3 V, in float roughness,
|
||||
diffuse *= sh;
|
||||
specular *= sh;
|
||||
|
||||
specular += EnvironmentReflection(N, V, P, roughness, f0);
|
||||
|
||||
diffuse = max(diffuse, 0);
|
||||
specular = max(specular, 0);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ inline float3 EnvironmentReflection(in float3 N, in float3 V, in float3 P, in fl
|
||||
float2 size1;
|
||||
float mipLevels1;
|
||||
texture_env1.GetDimensions(mip1, size1.x, size1.y, mipLevels1);
|
||||
float3 ref = reflect(N, V);
|
||||
float3 ref = -reflect(V, N);
|
||||
float4 envCol0 = texture_env0.SampleLevel(sampler_linear_clamp, ref, roughness*mipLevels0);
|
||||
float4 envCol1 = texture_env1.SampleLevel(sampler_linear_clamp, ref, roughness*mipLevels0);
|
||||
#ifdef ENVMAP_CAMERA_BLEND
|
||||
|
||||
@@ -98,15 +98,15 @@ inline void DirectionalLight(in float3 N, in float3 V, in float3 P, in float3 f0
|
||||
float3 lightColor = GetSunColor();
|
||||
BRDF_MAKE(N, L, V);
|
||||
specular = lightColor * BRDF_SPECULAR(roughness, f0);
|
||||
diffuse = lightColor * BRDF_DIFFUSE(roughness);
|
||||
|
||||
specular += EnvironmentReflection(N, V, P, roughness, f0);
|
||||
diffuse = lightColor * BRDF_DIFFUSE(roughness);
|
||||
|
||||
float sh = max(NdotL, 0);
|
||||
|
||||
diffuse *= sh;
|
||||
specular *= sh;
|
||||
|
||||
specular += EnvironmentReflection(N, V, P, roughness, f0);
|
||||
|
||||
diffuse = max(diffuse, 0);
|
||||
specular = max(specular, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user