0 votes

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.
enter image description here

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.
enter image description here

Can someone more experienced with shaders / masks help me?

in Engine by (127 points)

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 ?

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.