Skip to content

Commit

Permalink
Merge pull request doodlum#3 from Pentalimbed/TruePBR-PR-jack
Browse files Browse the repository at this point in the history
feat: pbr specular respects skylighting, slight SL specular change
  • Loading branch information
Jonahex authored Jul 26, 2024
2 parents 599373d + 117759a commit 055d835
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion features/Skylighting/Shaders/Skylighting/Skylighting.hlsli
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ sh2 fauxSpecularLobeSH(float3 N, float3 V, float roughness)
float3 D = lerp(N, R, f);
float3 dominantDir = normalize(D);

float lerpFactor = pow(f, 0.5);
sh2 directional = shEvaluate(dominantDir);
sh2 cosineLobe = shEvaluateCosineLobe(dominantDir);
sh2 result = shAdd(shScale(directional, f), shScale(cosineLobe, 1 - f));
sh2 result = shAdd(shScale(directional, lerpFactor), shScale(cosineLobe, 1 - lerpFactor));

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion package/Shaders/DeferredCompositeCS.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Texture3D<sh2> SkylightingProbeArray : register(t9);
specularIrradianceReflections = EnvReflectionsTexture.SampleLevel(LinearSampler, R, level).xyz;
specularIrradianceReflections = sRGB2Lin(specularIrradianceReflections);
}
finalIrradiance += lerp(specularIrradiance, specularIrradianceReflections, skylightingSpecular);
finalIrradiance = finalIrradiance * skylightingSpecular + lerp(specularIrradiance, specularIrradianceReflections, skylightingSpecular);
# else
half3 specularIrradianceReflections = EnvReflectionsTexture.SampleLevel(LinearSampler, R, level).xyz;
specularIrradianceReflections = sRGB2Lin(specularIrradianceReflections);
Expand Down

0 comments on commit 055d835

Please sign in to comment.