Scaling SpriteRenderers with custom shaders

Hi everyone. To give a bit of context, I am currently making a 2D game with hexagonal tiles in the middle of the sea, with a Horizon effect. To mimic the horizon, tiles start being compressed vertically beyond a certain point on screen and their positions are more stacked (they follow a arctan(y) function).
Here is my issue: My tiles have a custom shader attached to them, but apprently if I scale the transforms of the objects, it just displays as pitch black in game. Assuming that an object with a shader does not like being scaled, I tried another approach, where I use a tiling and offset node in my custom shader. However, I hit another issue where the sprite is correctly resized but as its only able to display it on top of the original shape, some parts are cropped out.

To show this, I have here a crashed plane on the island (not on the horizon) at its original size.


And now when the plane is at the horizon, it is scaled down but cropping because of the shape of the original plane sprite (I think)

And here is a picture of the shader for reference:

Am I approaching this the right way? And what could I be doing wrong? Thank you in advance!

You probably want to be offsetting the vertices, basic tutorial https://www.youtube.com/watch?v=VcUiksxYT88

Make sure you have a good pivot point near the base of the object. That’s where it will sort.

You need to constrain your art: the tent won’t work with this effect because it has a wide base. Use art with a narrow base, more like your tree than the tent.

You might also check out Songs of Conquest. They do something a bit similar in intent: https://www.youtube.com/watch?v=oPpnQzze2qs

1 Like