BakedLit Shader

Hello, any idea how could I create a BakedLit shader from PBRGraph? I am not exactly sure what to change in PBRGraph. I need this stype of shader because I don’t want the realtime lights to affect the baked lightmaps of the objects.

Original Post on Discord

by user 328144332622266369

Hi, this is unfortunately not possible at the moment since we don’t support exporting lit shaders from Unity to three.js right now

Just to clarify, is your goal to have objects that have lightmaps but then don’t react to lighting at runtime?

Yes, this is what I want to achieve.

by user 328144332622266369

Yeah, I know this, I was mentioning BakedLit just as a reference. I think unlit should work too.

by user 328144332622266369

hey guys. do you have any update on this?

by user 263677777536876546

Hey :wave: a rough workaround would be to have a model with material with the UnityGLTF/PBR Graph shader, bake the lightmaps.

Then in runtime, fetch the lightmap from that model, instantiate the model, delete the original and change the material to a custom one with a unlit shader from Shader Graph.

Then supply the lightmap as one of the textures for your custom shader/material.

You will have to sample the texture under correct UV channel and apply it to the Color input.

What effect are you trying to achieve?

we want to have some dynamic characters on the baked environment that react to the mixed/realtime lights, but when those lights are active, they also affect the environment with baked lightmaps

by user 263677777536876546

Do you need it to be a custom shader? Or are you only interested in mixed lighting?

in mixed lighting

by user 263677777536876546

Mixed lighting is supported :+1:

Quick test in the Lightmaps sample, the purple light is the realtime one, the rest of the lights are baked.

Caution: flashes

What is your setup? what shader do you use on the baked parts? And what parts don’t receive realtime lighting again?

i m using unitygltf/pbrgraph for the environment and characters


by user 263677777536876546

here is an example with a different mixed light setting

by user 263677777536876546

you can see how the baked environment is also illuminated differently

by user 263677777536876546

I’m sorry, i do not see the exact difference besides just the color hue.

Could you please create a new thread, so we don’t spam the OP with notificaitons and show me more of your setup? :slight_smile:

it’s cool with him, we work on the same project :slightly_smiling_face:

by user 263677777536876546

Ah, my bad x)

the thing is that we want the baked environment to only get the lighting data from the baked lightmap

by user 263677777536876546

I see, i see.

One workaround would be to light all the realtime objects using reflection probes instead of lights. This way you could manually assign a reflection probe to every Renderer that you wish to shade differently.