Lightmap Blending Mode - Overlay?

Is it possible to change the blending mode of the lightmap texture to Overlay? (similar to photoshop)

So basically I have a diffuse texture and a lightmap texture.
By default, the lightmap texture is “Screen/Add” over the diffuse, or if I enable Lightmap as Shadowmap, it blends in a “Multiply” fashion. But I want to Overlay it like this:

PG: https://www.babylonjs-playground.com/#FSX5JX#1
What Overlay looks like:


As you can see, the grid fades out in the white, unlike normal Multiply.

And here is with color:

Definition:
Overlay uses a combination of the Screen blend mode on the lighter pixels, and the Multiply blend mode on the darker pixels. It uses a half-strength application of these modes, and the mid-tones (50% gray) becomes transparent.

Hi a_bolog,

Can you provide a Playground we can look at? The Playground I came across while looking up “lightmap” in our documentation was this, but I’m not sure exactly how it maps onto your question or what effect you’re trying to achieve.

Sorry, I’ve updated the post.

1 Like

Okay, I think I understand. I’m pretty sure that’s not a feature built into either the StandardMaterial or the PBRMaterial. However, I don’t think it’s a particularly difficult effect to create in NME.

Babylon.js Node Material Editor (babylonjs.com)

That’s an example I threw together fairly quickly to show a similar effect to what I think you were going for. To get this, I didn’t follow exactly the definition for “overlay” that you provided, but that’s very possible to do. I think this is probably your best bet to get exactly the effect you’re looking for; since you have complete control over the shader, you can tweak it however you like until it works for you. Hope this helps, and best of luck!

3 Likes

Super thanks for helping, I guess I’ll have to accept it’s not built in, your example doesn’t really work if I bring color, also the white is not 255 anymore, and the grid lines are gray instead of black, no matter how much I play with the alpha values.

But yea, I thought is more of a quick switch to choose this blending mode, as I’d have to apply it to many materials.

Thanks again for helping out.