Specular on metarial after light mapping bake?!

It seems that after doing a Beast lightmapping bake, the specular component of shaders are ignored i.e not rendered. This is pretty bad, and I have posted before but never got a real solution.

I can’t be the only one wanting specular on baked objects???

Any help very appreciated.
Thanks

You can’t get specular on baked objects unless the shader supports specular, which is why you should use the correct shader after baking it. For example you’ll bake with diffuse or whatever looks best, then swap the material for something that is supporting specular, and in the material specify the baked lightmap.

There is no such thing as baked specular because specular is calculated off realtime lights and a baked lightmap is not realtime. If you want to bake specular you need to do it in a modelling package like 3DSMax which can bake a “completemap” which generally still makes a mess of specular or reflections.

The above procedure of swapping materials should work fine for you though.

I had diffuse and specular materials on the objects before and still after baking, making a new specular material afterwards doesn’t add the specular back though.

the solution for your problem are radiosity normal map, that is, lightmaps with built-in information for normal and specular lighting.
it’s awful that RNM aren’t possible within Unity’s Beast implementation (which makes Beast useless as a modern game always needs lightmaps AND normal + specular mapping).
However, you can bake these RNM using different 3D Applications and then use a Shader-Family called GzRNM made by some forum member.

regards

Create a realtime light rig in your scene to contribute to specular shading.

Wow, I’m stunned that this isn’t possible. The material side of Unity is leagues behind the rest of it’s features. Thanks for the tips Lunio. Given that I am forced to bake lighting with Beast, I may be stuck with this problem. It still boggles my mind that the engine can’t just lookup the light map for diffuse and then add specular over it. Seems like about the simplest thing a material could do.

Also, Lunio, I’m not sure if it would work, but couldn’t I just delete the baked object, re-import, create a specular material, apply the matching EXR as diffuse and specular colour I want, and whala? Or is it the floating point EXR that will create the problem?

i3D, could you explain the basic setup of using ‘realtime’ lights in combination with beast baked diffuse?

you can use dual lightmapping

Dual light mapping only blends the effects of realtime shadows into baked shadows. It doesn’t deal with specular at all, and to be honest it shouldn’t either.

My problem is that after baking, there is no point in having lights in the scene at all, because they can’t contribute to specular. I don’t have a need to change shadowing in realtime, so single lightmap’s are fine.

The current state of Beast in Unity means that baking any materials such as metal, plastic and glass and having it look right isn’t possible, unless a workaround can be found.

I’m a little astounded that there aren’t hundreds of posts about this.

Surely 75%+ of users bake and surely 90% of them want to use specular in their materials?

I just tried to duplicate a baked object so a copy was in the same space, thinking I could add a transparent material with just specular to the second object and that would render over the top, producing a specular effect.

It doesn’t work though as it seems Unity can’t render a transparent object with specular… A surface has to have main colour (Diffuse) to have spec… WTF!

So my choices are
A) have no spec/shiny surfaces in scene at all
B) create lighting solution in Maya and bake out hundreds of maps individually, which drastically reduces flexibility, increases time taken to produce, and makes iterations impossible

Looks like option A!

The lightmap does all it can, which is bake the details that are not dependent on view direction. Specular can’t be baked, unless you have a static camera. So in your shader, you should be calculating things like solid-color specular, or cubemap reflections, and adding that onto the already baked ambient and diffuse, which include shadows. Only afterwards, multiply by the texture. I don’t have experience with specular + Beäst in Unity, but it seems to me that it ought to work that way. Why would it not?

I don’t understand why you keep blaming unity - it is a shader issue not a unity issue…

If the built-in shaders don’t work properly (I just tested with “Specular” and it does seem broken), I think it’s a bug, unless UT can explain a technical reason for not allowing Beäst to work with specular surfaces. And in that case, the bug is that the Editor doesn’t tell you about it, and do something to stop you from baking what can’t be baked.

Hey Hippo, I’m not raging against Unity Dev’s. Overall i think Unity is excellent, especially compared to the other software I use, Maya, Mental ray etc…

The dev’s have done a superb job, which makes the omission of baked diffuse having any spec even more surprising. It’s a massive hole in the ability of materials, comparable to having spotlights without shadows.

Another member said I can use deferred rendering with baked diffuse and realtime lights to solve it, so that’s my next step in trying to solve it.

Dual Lightmapping actually does its job cause in near range, the lightmap is disabled and the realtime light effects (shadows, specular, normalmap) are being used, while at distance the baked informations only are being used.

if you want you can not use surface shaders at all, which enables you to do and not do whatever you want :slight_smile: and when you do that you will realize why unity limits it with inbuilt lightmapping once you hit the maximum interpolator count brutally :wink:

Hey yeah Dual light-maps works for the spec. Of course now I have 90’s style jaggie’s everywhere which effectively counter the benefits. I sure can whine can’t I!

I’m curious, using Dual Lightmaps/ Deferred rendering, is there a way of disabling the blend between realtime lights and baked ambient?

I really don’t want/need any realtime shadows, just the baked diffuse and spec.

You can reduce the realtime shadow range to 0. this disables realtime shadows and all other realtime effects like normalmap etc

thanks Dreamora, but it also disables the spec along with shadows/normals

You can decide to have the realtime effects or to not have them.
There is no “I want A, B but not C and D”, at least not without you writing your own shader.

Yeah. That’s a shame. I’ll probly stick to Forward rendering then.

I realize this topic is several years old but the basic workings of lightmapping still seems to be the same, so in case anyone else is having similar issues, here’s my workaround. It’s not perfect but could be helpful in certain situations.

I use a simple lighting setup with a main light that has the strongest intensity, a weak bounce light, and a weak backlight. The main light casts shadows, the other two don’t. Bake all the lights. Then select all the lights, and in the Inspector, set Lightmapping to BakedOnly. Then duplicate the main light, and on the duplicated light, in the Inspector, turn off shadows and set Lightmapping to RealtimeOnly. Turn down the intensity of this new real-time main light if necessary.

That way you’re real-time calculating normal and specular but not real-time calculating shadows. Uses more memory than having all the lights baked, but less memory than real-time shadows.