I’m working on a mobile game in unity 5.5.0. We’re using the Mobile/Bumped Specular shader for our materials and the scene is lit by a single dynamic directional light. The issue is that the shader does not support normal mapping in shadows and the half of the scene in shadows looks terrible as a result.
We’re using the bumped specular shader for performance reasons but i haven’t had the time to figure out profiling and actually profile a scene with the standard shader vs the bumped specular shader. does anyone know the performance difference (even approximately) between the mobile shader and the standard one? switching to the normal shader would be one way to solve the problem.
the other option is to write a custom shader based upon the the mobile bumped shaderd that includes the standard shader’s ability to render normal maps in shadows. i’ve looked at the two shaders but i don’t know enough to figure out what i need to copy from standard and google hasn’t been a help.
The mobile shader does diffuse ambient lighting per vertex rather than per pixel. I believe the legacy diffuse bump (non-mobile) may do it post pixel, but it’s possible it also only does per vertex ambient.
The main change to get per pixel ambient lighting is look for the line with ShadeSH9 in the mobile shader, you’ll find it in the vert function. You’ll need to move that into the fragment shader, supplying the appropriate world normal as calculated in the fragment shader. That’ll get you lighting in the shadows.
However the standard shader additionally does per pixel ambient specular reflections. This I believe is what you’re actually seeing and likely makes the most significant difference in appearance between the standard and mobile bumped shader, especial if you’ve got your editor set to emulate mobile graphics. https://docs.unity3d.com/Manual/GraphicsEmulation.html
If you’re looking to use that feature your better off just using the standard shader than trying to update the mobile shader, but those reflections are one of the more expensive parts of the shader for mobile (even though it’s nearly free on desktop).
so if i’m understanding you correctly, moving ShadeSH9 will change lighting to per pixel but that might not solve my issue. i’ll try and move that line and see what the results are and i need to bite the bullet and do profiling.
In this case you could also just fake it by adding the lighting you want to see in the shadow to the diffuse map. For desktop I would recommend adding some directional lightmaps, but for mobile this might just be the trick.