I think I have finally nailed the formula when it comes to optimized per-pixel SH (Spherical Harmonics, what Unity’s light probes and “Not Important” lights use) for mobile. Let me know if you want to see more.
Will post screenshots a bit later.
I think I have finally nailed the formula when it comes to optimized per-pixel SH (Spherical Harmonics, what Unity’s light probes and “Not Important” lights use) for mobile. Let me know if you want to see more.
Will post screenshots a bit later.
Smoked ham?!
I prefer my smoked ham per-vertex. Per-pixel is just too filling.
I see what you did there. And who mentioned smoked ham?
Point being, yes, on some devices, it is a little fill-rate hungry, (speaking of food… :p) but I did manage to drop the instructions the best I could without sacrificing too much.
Another thing I am yet to do as well is clean the portable version of my shader up (atm, it has a separate pass for a custom shadow mapper I built) and perhaps add unity’s shadows in. On top of this, I will also have to make a directional lightmap version for GLES2 devices. (Means dir lightmaps actually work on android! :))
Oh yea, a screen of it.
And yes, that’s reflection and a simple fresnel. It’s also affected by the normal that’s computed for the SH lighting.
The shadow comes from my shadow mapping engine.
Looks fun man, keep it up!
I can say that it also runs on SM2.0 hardware. On my tablet, with nothing else affecting the scene, it runs at about 30FPS.
^ future unity staff member?
I still don’t know what SH means
me either. spherical harmonics?
Me too. I thought that SH is something like SSH, but that “per-pixel” left me confused
Yeah I’m wondering what SH means as well, I loved Smoked Ham though! lol.
I’m betting on this one as well as there is a Wikipedia entry covering spherical harmonic lighting.
Eh, I’m fine with the standard lighting. Maybe make a new lighting model to at least give certain lighting changes depending on the surface type to make things more realistic depending on the surface type and which lighting model used. But aside from that, I see no reason to use SH. I think Unity has done a great job creating their lighting model for Standard Shader. But could be better I suppose lol.
Hmmm, des this SH shading seems to be ideal for shading games where one chose to use all materials and no textures?
Yes, you’re correct. For those that didn’t know, SH stands for above quote. This thread details how I have done a fairly cheap approach to applying SH per-pixel (normally, it’s done per-vertex!)
Nice try guessing smoked ham though, lol!
Correct as well! On top of that, had no idea there was actually a wiki entry on SH lighting. (There is one on the math behind SH however)
If you’re using normal maps for lighting detail, yes, otherwise, this would be pointless.
EDIT: On top of that, if you have shiny objects in your scene, this could help too.
You are right there, but being that some devices staring at pendo pad on table can’t handle the standard shader without the framerate going to crap, this one I’ve written’s a good substitute. And plus, I can re-use the generated normal for a few other things too, like distorted reflection.
Plus, games that use ALL light probes to do lighting (Like one of my current projects) will look a lot better with this one.
I wish…
Yes, I meant for example, my Blender models I make normals with UV maps and such but my textures are always solid colors. So instead of wasting the effort of solid colored textures I can just use materials & choose coloring. Thanks for that, with Unity 5 and my new used laptop I now have a computer and the opportunity to try Unity’s lighting for the first time.
Now I am wondering when this SH lighting will come to Unity because really, I still can’t use shadows in Unity on the type HW I can afford.
@FuzzyQuills - Sounds good, just never really heard or seen of it before. I’ll keep an eye on it, I always love new shaders. I hate making them, but when they work I love it HAHA.
Yep, especially when they work on the intended device… It took a while to find a way to move the matrix calculation into the vertex shader because of a bug where using a matrix as input would cause GLES shaders to come up blank…
The solution in the end was to “cheat” a matrix multiply by multiplying the tangent space rows manually, of which is a lot faster than building a matrix for each fragment!
SM2.0 hardware with no native shadow support perhaps? I actually have a custom shadow mapper for that…
(Also works with this shader, although atm I’m having issues keeping the sample count down enough to be worth it)
EDIT: Also, all built-in shaders already have SH lighting, this shader of mine simply does it in the simplest amount of shader instructions possible. To use SH in any scenario, just use Not Important mode on your lights. (Note however; point lights don’t work unless you have an active light probe set in your scene!)
So does this basically extend the life of low-end tablets then? Seems like a very useful endeavour then