Hard Surface Shaders Pro, Unity 5, broken

So, Hard Surface Shaders Pro, don’t work in Unity5 Free.
Actually the only refraction part doesnt work.
Does anyone know how to fix it? Maybe there were any changes in unity shader API between unity 4 and unity 5. coz HSSP works in Unity 4.6.

Surface shaders alpha channel change

By default all opaque surface shaders
output 1.0 (“white”) into alpha
channel now. If you want to stop that,
use “keepalpha” option on the #pragma
surface line.

All alpha blended surface shaders use
alpha component computed by the
lighting function as blend factor now
(instead of s.Alpha). If you’re using
custom lighting functions, you
probably want to add something like
“c.a = s.Alpha” towards the end of it.

And this

Unity 5.0 removed support for this
fixed function shader functionality:

UV coordinate generation (TexGen command).

Here is a useful link

http://docs.unity3d.com/Manual/SL-ImplementingTexGen.html

Strangely, the texgen warning has gone away even though I haven’t fixed it yet.

By the way I’ve been using Free Opaque Spec.

Is there a glass shader in PBR as good as the Hard Surface Pro shaders? Because the one that comes in standard assets > FX > glass is nothing compared to the refraction done in hard surface pro. I need a shader that makes glass feel real like the way lenses bend light. It took me some time but I was able to fix up Bruno Rime’s shader code.

  1. To get transparency to work I had to add the alpha option to the surface shader declarations. There were many of these all over the transparent shader files. One example is,

#pragma surface surf BlinnPhongHardsurfaceFront to #pragma surface surf BlinnPhongHardsurfaceFront alpha.

  1. To make the brightness normal I had to stop the doubling of the attenuation value in HardSurfaceLighting.cginc, because in Unity 5 they double the value before it gets to the shader.

c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten * 2); to c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * atten;

  1. On my Mac everything was fine but on Windows I had to fix the SHADER_API_D3D9 to also work with SHADER_API_D3D11. I did this by adding an OR clause to the #ifdef SHADER_API_D3D9 preprocessing statements.
    #ifdef SHADER_API_D3D9 to #if defined(SHADER_API_D3D9) || defined(SHADER_API_D3D11)
    I had to make this change in 6 places, 2 lines each in HardSurface.cginc, HardSurfaceProScreenSpaceReflection.cginc, and HardSurfaceProScreenSpaceRefraction.cginc.

I think everything is now working as it was when I first bought HSP with Unity 3.3.

The author Bruno Rime
Hard Surface Shaders Pro | VFX Shaders | Unity Asset Store may or may not update these for Unity 5.

As a long term solution, I strongly suggest migrating to Unity’s built in PBR… Physically Based Shaders, a feature now available on both Free, Personal, and Pro versions.

They can convincingly reproduce reflective metal and glass, which were our two primary uses of Hard Surface Shaders.

primer: