This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi everyone!

I'm trying to achieve non-uniform scaling via vertex shader, I need this for squash and stretching for my characters, and currently, simply animating bones or the spatial itself gives errors or is not supported at all in the import process.

So I've been playing with ne graph shader and got this to work pretty much as I want it graph shader setup
http://www.mediafire.com/view/qqj10bkjcdhc8er/vertex-shader-scaling.png

The thing is that I want to use the curved world effect shader by user 1000h in the godot developers forum, this is the thread in question: this is the thread in question

... but I haven't been able to put those effects together, because I can't replicate the vertex shader scaling in code (that xform multiply with vector and matrix is the part I can't replicate in code), and I can't do the curved world effect in the graph shader, and I want to use both effects on some of my models.

Basically I want the game level and characters in it to have the curved effect, but for now I'm unable to do it.

So, if anyone have any idea on how can I do this I would really appreciate it.

Thank you in advance!!
And sorry for my english :D

in Engine by (40 points)

2 Answers

+1 vote
Best answer

Scaling in the vertex shader:

uniform vec3 scale = vec3(1.0);
VERTEX = MODELVIEW_MATRIX * (SRC_VERTEX * scale);
by (1,564 points)
selected by

OMG! Thank you very much!!!!
I'v never thought of that. I was looking through the docs to find something but completely oversaw that SRC_VERTEX.

Thank you again!!!! :D
You are a hero!!!

This answer is no longer working or valid for newer version of Godot. Posting with Version 3.4.4.

0 votes

Scale

uniform vec2 scale_vertex = vec2(2.0, 2.0); // x and y scale

void vertex() {
    VERTEX *= scale_vertex;
}

Scale over time

uniform vec2 play_grow_scale = vec2(2.0, 2.0);
uniform float play_grow_speed = 1.5;
void vertex() {
    VERTEX *= play_grow_scale * sin(TIME * play_grow_speed);
}
by (14 points)
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.