Apply shader to tilemap as a whole

Hey there,
as I am testing around with the new shader graph I tried to apply some shaders to tilemaps.
The problem is that the shader always gets applied to every single tile.

Is there a way to apply the shader to the tilemap as a whole?
This way we could add stuff like organic color variations on grass tiles.

Could you share your material and shader setup for your TilemapRenderers? The shader should be applied to all the Tiles in the Tilemap when set.

Sure, its just some test material I quickly did with the shader graph.

The weird thing is, if I try to apply the skybox material for instance it seems to work somehow.

I also attached a demo file.

Sorry to bump this. But I spent two whole days trying around without any success. Really hope someone can help.

Your OP looks like it’s missing a “not” in one sentence, which might be the source of the confusion.

I added a “not” - is that what you meant? You want per-tile properties?

Thank you for your answer, but actually no, this is not what I meant.

Maybe ChuanXin also understood me wrong, I think, maybe I did a poor job at at explaining my problem.
I tried to come up with a fictitious example that illustrates my problem better.

In the example it is a cutout-shader, but it could be any shader created with the shader graph.

I think you want to use the Position node with the World or Absolute World setting. Plug that into your UV for Simple Noise. Right now, it’s implicitly getting UVs from the tile’s sprite. If you make it relative to the world, then it should apply across tiles.

12 Likes

Oh god, that is the solution! I’d throw my money at you if I had any, haha. Thank you, you saved me so much headaches.

Oh shoot I was looking for the same answer and lo-renzo’s answer works! Thank you so much lol

I’ve got a quite similar problem but the solution does not seem to apply. I want to use a paper texture as an overlay for my tilemap.
The node setup is as follows.

Instead of stretching the texture across all tiles I get this weird result:

Including a Tiling and Offset node steers it into the right direction, but it doesn’t seem to be the right path to follow given the parameter values.

Result:

Does anybody have got an idea how to fix this properly?
Thanks a lot in advance!

Hi, it’s hard to understand your goal without seeing the inputs and the intended output.
What does the paper texture look like?
What does the tilemap look like with the normal sprite material?
What do you mean by “overlay”?

Try this first though: go to the texture in your project, change the Wrap Mode to Repeat.

Next, if still broken: from your shader graph it doesn’t look like you’re using the alpha of your MainTex. I suspect this is may not be what you want. SampleTexture2D the _MainTex (add a new texture field to your Blackboard, give it “_MainTex” w/o quotes in the Reference field). Plug in its alpha to the output alpha. This will result in the shapes of your tiles remaining the same, but the paper’s color overwrites the tiles’ color.

1 Like