Skip to content

Commit 6f48c75

Browse files
committed
Add Geometric specular roughness to Lit shader
1 parent 96385d8 commit 6f48c75

7 files changed

+6
-0
lines changed
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.

Sandbox/internal/shaders/default/Lit.glsl

+6
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ void main() {
230230
roughness *= RoughnessMul;
231231
emission *= EmissionColor;
232232

233+
// Geometric aliasing roughness
234+
vec3 vNormalWsDdx = dFdx(worldNormal);
235+
vec3 vNormalWsDdy = dFdy(worldNormal);
236+
float geometricRoughnessFactor = pow(clamp(max(dot(vNormalWsDdx, vNormalWsDdx), dot(vNormalWsDdy, vNormalWsDdy)), 0.0, 1.0), 0.333);
237+
roughness = max(roughness, geometricRoughnessFactor);
238+
233239
o_Albedo = vec4(albedo, ao);
234240
o_Specular = vec4(0.0, 0.0, metallic, roughness);
235241
o_Emission = vec4(emission, 0.0);

0 commit comments

Comments
 (0)