• Shaders
  • How do I create a "Vanish Point" style shader?

Hi. First of all, an image to ilustrate the "problem"

Well, I need to create a score with this "kinda vanish point". The top left score is a bogus image... The real score for test purposes is the bigger one... with this shader I reach the result in image:

shader_type canvas_item;

uniform float VchangeX = 0;
uniform float VchangeY =0.5;

void vertex()
{
	float vertPosX = (-VERTEX.y * VchangeX) + VERTEX.x;
	float vertPosY = (-VERTEX.x * VchangeY) + VERTEX.y;
	VERTEX.x = vertPosX;
	VERTEX.y = vertPosY;
);

}

I tried do this with GDscript Transform2D too, but I'm stuck basically with the same results How can I write this shader?

My bad, I did not see this topic here before commenting on this topic. I'll just quote myself to place my comment here:

@TwistedTwigleg said: I have no idea if it would help or not, but you may be able to see how to perform a similar projection by looking at the code in this Godot Skew Streching Tool on Itch.IO.

@TwistedTwigleg said:skew-stretching-godot-engine-editor-tool).

Very nice tool... It is what I want :smile: , But I tried this before and forgot to mention:

My object is a Label(needs to be), and this tool seems to not work with this kind of object, am I right?

What am I doing wrong?

Other considerations: I can't change the positions visually, as the video shows...

However I was able to modify manually: yey! Works like a charm in sprites, butons, etc... but not in a Label :anguished:

I'm working without a shader now Using a custom font, breaking the string into characters and individually changing the position and scale

Far from the best solution, but it's a good workaround till I can use shaders properly for this case

thanks(But if someone know a way, please :D )

@StormWFP said:

(But if someone know a way, please :D )

As I said in the other topic, you could render your label into a viewport and apply it to a 2D node such as texturerect perhaps and skew that 2D node.

Write a Reply...