Applying a shader to an entire tilemap.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheoTheTorch

Hello, I want to make some spikes out of a tilemap and make them have a cool gradient.

An example scene would loom something like this.

however, when I try to apply a shader, it does so for every single tile seperately.
plus it makes all the transparent parts dissapear as well. Both of these are the opposite of what I want.

Can someone more experienced with shaders / masks help me?

You just need to use global coordinates and SCREEN_UV instead of normal UV. However if You have transparent tiles all over the screen, than it is not worth to work it with shader. Don’t You want to create a separate tilemap for collisions/background ?
Do You realize shaders will only grant You visual effect ? As this tilemap design looks as if You wanted these spikes to be collidable ?

Inces | 2022-04-10 20:14

Collisions are handled easily as the tilemap uses it’s parent’s collision.

Spikes are Area2Ds and walls are StaticBody2Ds as you’d expect.

I’ll try the SCREEN_UV, however that looks like the thing I need. Thanks.

TheoTheTorch | 2022-04-17 16:09