Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Fupicat |
I’m making a 2d platformer, and I would like the level to look like you are standing on a small planet. I’m thinking about using a shader to accomplish this. I had never used them before so, with help from this post, I managed to create something similar to what I was imagining:
This is the code I used. The shader is applied in a ColorRect node that is parented by a CanvasLayer node, in order to apply the effect to the entire viewport.
This is the result. It works as intended, but it’s not exactly what I wanted. The effect is too extreme. I want to have at least some control over how big the “planet” is. I don’t really want everything just come crashing down when it hits the border. This is especially noticeable when we resize the screen:
The ColorRect resizes along with it, making the effect even more extreme.
So I want to know either how I can improve this shader, or if there already exist resources that do something similar so I can implement them in my game. If neither, I can just ditch this idea altogether, no problem. I don’t know if I’m asking for too much…
Eu não sei nada sobre shaders mas só um comentário: tu sabe que tu pode usar PI
pra pegar o valor de pi né? Tu não precisa definir uma variável que nem tu ta usando float pi = 3.14
.
fpicoral | 2019-01-25 21:38
Eu sei, mas acho que só tem no GDscript, porque quando eu tento colocar no editor de shader ele dá um erro: Unknown identifier in expression: PI
Fupicat | 2019-01-25 21:48
@Fupicat English pls?
Kamil Lewan | 2019-01-28 00:39
They were just saying that I could have used PI instead of creating a variable for storing pi, but that only works in GDscript.
Anyway, you got any ideas on my issue?
Fupicat | 2019-01-28 00:41