+2
Under review

Lightmap Support not baking the correct brightness

William Lau 10 years ago updated by Robert Berrier 8 years ago 14
When baking lightmaps with SF shaders, the outcome is much brighter than it should be.

I am using v0.34
This is the shader I am using for this demonstration:

Image 222

This is my scene, it includes 1 plane and 1 directional light:

Image 223

This is what happens after I do lightmapping:

Image 224
I'm presuming this has something to do with the "Double Incoming Light" option? Should that option be ticked by default to match Unity's default shaders?
Under review
It should. How does it look if you place a Unity default shader side by side with this?
It could also be that you're missing a Color property named Color, multiplied by the diffuse texture. Although it does look a bit fishy. So the shader is set to forward rendering - what render path are you using on the project/camera?
Here's a bit more information and problems with using double incoming light:

Using double incoming light will reproduce Unity's diffuse shader.
However this doesn't work with Transparency.

This is the nodes for the transparent diffuse shader:

(Forgot to mention earlier, the scene has a red direction light)

Inorder to produce the same effect as the Unity shader, I need to double the color multiply by 2 as such:





But doing so will cause Lightmapping issue:

Looks like I'll have to set up an entire lab to test all of the cases for this, I'll look into it now
Thanks a bunch for the descriptive screenshots :)
Any word on this issue? I've run into the same thing.

From what I can tell Beast uses Unity's default shaders when it bakes and just pulls in the color or texture from the appropriately named value in the SF shader.

So if you are using, basic diffuse without double incoming light, Energy Conserving, or PBL, you will get very different results after the bake because the light values that your shader needs are blown out when applied to a standard shader.

The only solution I have come up with is having two sets of lights. One for baking and one for my shaders in real-time.


After some trial and error the dual light solution does not work either. 

The root of the problem appears to be when Double incoming light is checked, SF is doubling the lightmap contribution. 

Is there a way to set up a control for how much of the light map SF mults into the result.

We need "Double Incoming" to only effect the direct light not the Light map.
I'll look into this eventually, but right now I'm swamped in other work until after GDC I'm afraid :(
Of course, thanks for getting back to me.

It seems I am still getting this. I have spent hours trying to fix it, looking online, but not effect.
I am not sure if I am doing something wrong on my side or if it is a SF bug.

I tried things like:
Deferred vs forward rendering (unity and SF settings)
Gamma or linear space
Different Light map settings like Directional or non-directional.

I am clueless. Help is highly appreciated! Thanks!

ah, i found out that this is because the object/material is still being affected by light. where as the default shaders don't (once they are light bakked). Still not sure if it is a bug or me not understand it ;)