I switched to the new PBR shader which I spied from another resource and I see again this weird specular artifact. Or is every Sponza supposed to be like that?
sponza artifact 1 sponza artifact 2
Here is my PBR shader:
float4 albedo = gBufferAlbedo.Sample(pointTextureSampler, uv);
float4 normalAndRough = gBufferNormalRoughness.Sample(pointTextureSampler, uv);
float3 normal = normalAndRough.rgb;
float roughness = normalAndRough.a;
float metallic = gBufferPositionMetallic.Sample(pointTextureSampler, uv).w;
float3 WorldPos = gBufferPositionMetallic.Sample(pointTextureSampler, uv).xyz;
float3 N = normalize(normal);
float3 V = normalize(camPos - WorldPos.xyz);
float3 F0 = float3(0.04, 0.04, 0.04);
F0 = lerp(F0, albedo.rgb, metallic);
// reflectance equation
float3 Lo = float3(0.0, 0.0, 0.0);
for (int i = 0; i < numLights; ++i)
{
// calculate per-light radiance
float3 L = normalize(lightPos[i].xyz - WorldPos.xyz);
float3 H = normalize(V + L);
float distance = length(lightPos[i].xyz - WorldPos.xyz);
float attenuation = 1.0 / (conLinQuad[0] + conLinQuad[1] * distance + conLinQuad[2] * (distance * distance));
float3 radiance = lightColor * attenuation;
// cook-torrance brdf
float NDF = DistributionGGX(N, H, roughness);
float G = GeometrySmith(N, V, L, roughness);
float3 F = FresnelSchlick(max(dot(H, V), 0.0), F0);
float3 kS = F;
float3 kD = float3(1.f, 1.f, 1.f) - kS;
kD *= 1.0 - metallic;
float3 numerator = NDF * G * F;
float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0);
float3 specular = numerator / max(denominator, 0.001);
// add to outgoing radiance Lo
float NdotL = max(dot(N, L), 0.0);
Lo += (kD * albedo.rgb / PI + specular) * radiance * NdotL;
}
return float4(Lo, 1.f);
I tried to change this Sponza to another and the artifacts remained the same.