I want the specular highlights to be the color of the light that's causing them. Is that possible in Unity? I just noticed that if I have a white texture with a white specular color then all the specular highlights on that texture are white and not the color of the actual lights. I have effects in a lot of different colors and it looks really odd when they all cause white highlights. Edit: Seems this is only a problem in deferred rendering.
Are you sure this isn't a problem of oversaturation? (I.e.: what happens if you reduce the intensity of the light sources?)
Yeah, seems like it. I've been working on the same project for so long now that I forgot how it was in other projects. Just tested in another project and it looked like I wanted it to. I'm using linear deferred lighting with an hdr camera and all my lights are almost maxed out intensity wise. I have achieved a look I really like, but apparently I'm doing something wrong because it's messing up my speculars? Guess I'll experiment some more. Thanks.
Uhm, no. I was looking at my test scene in isometric view, but I noticed this when I was investigating directional lightmaps just now. Here's a test scene rendered with an orthographic camera: Here's the same scene with a perspective camera: What's going on? In perspective mode all the speculars are white and really dim. The red one is barely visible at all. I'm looking for speculars like this: From Battlefield 3
I'm trying all the included ones. That was the bumped specular one. Specular color seems to come 100% from the "Specular color" slider in the shader in all the Unity shaders and ignore the color of the light completely in pespective mode. Why is it working so nicely in orthographic?
I cannot reproduce your problem. The built-in bumped specular shader appears to work fine (with perspective as well as orthographic projection).
Bah, it's deferred rendering that's the culprit. That's a pretty big con of using deferred rendering, isn't it? I didn't know of it at least. I don't see it mentioned anywhere, is it a bug? Here's forward rendering: Deferred: Edit: Is this it? http://gamedevcoder.wordpress.com/2011/04/11/light-pre-pass-vs-deferred-renderer-part-1/ http://www.m4x0r.com/blog/2010/05/specular-color-in-light-pre-pass-renderer/
Interesting, I wasn't aware of that limitation. I guess it is mentioned here: http://unity3d.com/support/documentation/Components/RenderTech-DeferredLighting.html The monochrome specular lighting in the deferred pipeline might be the reason for the difference between deferred and forward rendering that you see.
Yeah, I think that was what was said in that article I linked to as well. Thanks for enduring my whine. Guess I will evaluate if I actually need deferred rendering then. I tried switching back and forth and the only difference apart from the obvious lack of specular color was that my lens flare became a lot brighter for some reason.
You have found found one of the limitations with deferred rendering. When you get down to it deferred rendering is an optimisation that allows you to render more lights by using a screen space buffer. This unfortunately means that you are limited to a four color width output from the light pre-pass. Forward rendering is much more forgiving and flexible, but it's also slower
Perhaps I'm being stupid, but what's the root of this limitation? Don't you simply calculate the lighting values per light (one pass per light) and then multiply the end result by the light's colour, before moving on to the next light's pass? I'm not sure why spec is in a separate channel from the rest of the coloured lighting.
I don't quite understand how this doesn't contradict a claim from http://unity3d.com/support/documentation/Components/RenderTech-DeferredLighting.html : I guess one should say something like: The Deferred Lighting rendering path is usually the one with the highest lighting and shadow fidelity for a given render time budget.
Deffered rendering, phong lightings specular term is calculated based on lights alpha * surface glossiness except for 1st light. So, you might consider adjusting your materials glossiness according to desired specularity and/or use a custom lighting function to increase the power of speculars for a quick solution.
By adding the specular into the normal lighting channels this would force all surfaces to have the same specular characteristics. By separating the specular into it's own channel it allows different materials to use the specular intensity in different ways. You can rewite the lightprepass shader and your material shaders if you want the lighting to behave differently. That's one of the cool things with the Unity rendering pipeline you can tweak it quite extensively if you want to (within certain limitations).
I am not sure if 100 correct, but i guess in deferred lighting the lighting is rendered in one pass, so all lighting information has to be stored in one rgba buffer. Diffuse lighting will take rgb informations but then there is only one byte left for specular informations. So you could say in deferred lighting there is no possibility for correct colored specular lights. But there is a way to approximate the colors as described here: http://www.m4x0r.com/blog/2010/05/specular-color-in-light-pre-pass-renderer/ May be thats one cool feature for next Untity3D release?