Specular Highlights in Deferred Rendering

Hello!

I’m trying to make a specular highlight that can become very small by changing the max value of the default shader’s _Shininess property to be greater than 1.

Using BlinnPhong in forward rendering, the effect works fine and specular highlights can become very small. However I’m using a deferred path for my game. Since deferred rendering is locked to _PrePass lighting models which cannot use lightDir, I am unable to make a custom lighting model in my shaders, and am thus stuck using the default BlinnPhong which, in deferred rendering, is unable use _Shininess levels above 1. I know I am able to use forward rendering on a per material basis, but for my purposes this is not an option. I must use the deferred path.

Can anyone figure out a way to create very small spec highlights while using a deferred rendering path? I have tried everything I can think of and nothing works.

Thank you.

Have you tried replace the default UnityCG.cginc with your own edition?
I have never tried, but aras says you can make it

Although the specular exponent (_Shininess) ranges from [0.03,1.0], it is multiplied by 128.0 in the BlinnPhong lighting function. You can change the scale in the deferred renderer too, by editing line 240 of a copy of Internal-PrePassLighting.shader in your project and restarting Unity.

It is possible to use a custom lighting model with deferred lighting, as described at this link under the header ‘Lighting Pass’. You don’t have to replace UnityCG.cginc, you have to place a modified version of the built-in ‘Internal-PrePassLighting.shader’ in a folder called ‘Resources’, located somewhere in your project’s Assets folder.

You can download the built-in shaders at this link.

[Edit] Daniel, you ninja! :smile:

Brilliant! That worked like a charm. Thank you so much, guys. You saved me so much headache!