Tilemap with multiply blend mode, but without blending layers?

Hey guys!

So I need to have a tilemap’s Blend Mode set to Multiply.

image

But this causes the tilemap’s layers to also multiply with each other.

Alpha Multiply

The upper yellow-ish layer blends in with the underlying blue layer and becomes green.


Could you please give me some tips on how to prevent this from happening?
I need to have the blend mode as Multiply, but I don’t want the layers to blend like this.

I’m guessing I need to define a separate material for it, but I’m not really sure where to get started since I can’t find in the render scripts how the tilemap layers are rendered.

Thanks!

Each layer is rendered separately, as there may be sprites (e.g. the player) positioned between the layers.

If you look at the tilemap material, it has the render tag “tile”.
And if you look at the render script, you’ll see it renders the “tile” predicate at a certain point.
Create a new material, and set your own tag, and in the render script, draw the new predicate when you wish to.

1 Like

Hey thanks for the quick response!

Hmmm I will try this when I get home, but I don’t really understand what difference this will make. Won’t the two layers still get rendered separately as you said, but on the same predicate?
Or can I somehow force them on the predicate level to render with Alpha among themselves, and then with Multiply with the other predicates?

You can draw all of them to a render target in a separate pass. But you then lose the ability to interleave sprites. Or you draw everything (tilemaps, sprites etc) to a rendertarget with alpha and then draw that render target with multiply.

1 Like

Another way is to copy the layer to a different tilemap at runtime (e.g. when loading the scene). Then you can have two different blend modes on the two tilemaps.

How does this look like in render code approximately?