orels1 / orels-Unity-Shaders

A collection of practical Unity shaders for your next project
https://shaders.orels.sh
Other
177 stars 15 forks source link

[ORL-75] Ambient Occlussion doesn't occlude specular on Avatars #76

Open orels1 opened 3 months ago

orels1 commented 3 months ago

Seems like AO map doesn't participate in Specular Occlusion calculation on non-baked meshes

From SyncLinear.com | ORL-75

orels1 commented 3 months ago

After some investigation - this is what the issue turned out to be:

When the object has Baked Specular enabled and isn't lightmapped - the lightprobe light direction is used to create specular highlights (otherwise metallic objects would be incredibly flat).

However, that specular contribution was added directly to the final direct specular, which does not get specular occlusion applied to it (should it? not sure).

I adjusted the logic so that direct specular derived from lightmaps or lightprobes gets its specular adjusted correctly as well.

I also added a relevant slider in case this new effect makes the objects too dark

NVIDIA_Overlay_NHkIwwrfVP.mp4

orels1 commented 2 months ago

After lots of tweaking and renaming things - there should now be options to make this look how you want it to look