This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

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

Best Answer

  • KioriKiori Posts: 246
    Accepted Answer

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

    uniform vec3 scale = vec3(1.0);
    VERTEX = MODELVIEW_MATRIX * (SRC_VERTEX * scale);
    

Answers

  • KioriKiori Posts: 246Member
    Accepted Answer

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

    uniform vec3 scale = vec3(1.0);
    VERTEX = MODELVIEW_MATRIX * (SRC_VERTEX * scale);
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.