Scaling model with vertex shader (for non uniform scale animation) and curved world by 1000h

santi490santi490 Posts: 2Member
edited June 2017 in Shaders

Hi everyone!!
I'm trying to scale a model via vertex shader, the reason is that non-uniform scaling doesn't work (at least the things I'v tried), and I really want to have non-uniform scaling animations (for squash and stretch of my character), and this is likely the only option I have for now.

The thing is, I've achieved it with shader graph, doing this:

... but ... I also want to use the curve world shader by user 1000h in [https://godotdevelopers.org/forum/discussion/18391/curved-world-shader-code-included] and that can only be achieved by shader code, or simply I'm unable to replicate it in the graph shader.

So I'm trying to use both effects at once for some of my models, but i can't use graph shader and normal coded shader in the same material, and I can't replicate neither of the two effects in the other form.

If someone have any idea of what can I do I would really appreciate it.

Thank you in advance! :smile:
and sorry for my english :blush:

[UPDATE] [SOLVED]

I'v been replied by user mollusca on the Godot Q&A forum, this is the link to the question and answer: https://godotengine.org/qa/15342/scaling-model-with-vertex-shader-uniform-scaling-animation

Answers

  • KioriKiori Posts: 246Member
    Answer ✓

    Answer from Q&A:
    Scaling in the vertex shader:

    uniform vec3 scale = vec3(1.0);
    VERTEX = MODELVIEW_MATRIX * (SRC_VERTEX * scale);
    
Sign In or Register to comment.