A bit of (I hope) constructive criticism. The tutorial is about shaders, but you spend most of the time building a (very simple) interface to just use the shader.
20:34 => This problem seems to happen when the 'A' in the get_shader_param() is capital. My, explanation would be to use the exact spelling with the correct letter case to avoid this problem. Remember, Godot always capitalizes the first letter in the Editor so don't relay on it. Use what you wrote on the shader and script.
it's a topic for a different tutorial, that's general programming basics. If you put all your code in one place, it can have many reasons to change: it's harder to remember what each script or node does, and it's harder to fix bugs. In the case of the sprite and the UI element: if you have one script to control both the sprite and the UI, when you change something on the UI the sprite can break, and when you change something on the sprite the UI can break. And it will break! Sooner and more often than you would expect. That's why so many developers use programming paradigms, philosophies and sets of roles and constraints to organize and separate code. The most common paradigm we used to that end in game development is object-oriented design. I have a tutorial series planned on this, but it will take some time to finish preparing it: it's a big and an important topic. I want to get it right.
18:17 video skipped how you deal with changed label. As label gets changed, then saved, on re-open you will add another value to the label, like so: "X Amplitude: 20 20". How to make editor ignore the change?
I had the same Problem. Basically the label_start_text is added in front of your new value. And in the project files the Label already has a 20 at the end of it. So "X Amplitude : 20" and the code puts your "amplitude_value" at the end of that. If you do this in your code you will see what I mean. $Label.text = label_start_text + str("test") So go into your AmplitudeController and under the Inspector change the Text from "X Amplitude: 20" to "X Amplitude: " took me way to long to figure out
Is it possible to set texture proportionally to the figure? It is imperceptible, but the texture is "splitted" into two triangles. It becomes detectable, when you move just single verticle. For example: if (UV == vec2(0.0, 0.0)) { VERTEX+=vec2(100.0, 0.0); }
You start WAY later than people who are in expere4inced with this program like me, would like. When I open a new project, my UI doesn't look like yours.
Is it possible to somehow give the shader a dynamic set of values? (for example positions of certain objects so that the shader could create some kind of ripples etc)
Can somebody tell me how i can change the texture via shader( want to animate a sprite inside a tileset). there is a video on someone who does this with "uniform texture frame1"... but that doesnt work for me since i get a " Expected Datatype" error. Can someone help me pls?
Is explained in the beginning of this video.. It is closely resembling glsl, which uses a c-style-syntax. I didn't look that up, so don't take my word for it, but i guess the language in which you write shaders in godot internally gets compiled into glsl.
I really wonder if and when Godot will have shader nodes (like Blender nodes or Godot visual scripting) for those of us who don't want to code in GLSL. I could have sworn I saw a shader node editor long ago, but for the older version of Godot.
it's planned to come back in version 3.1. The team rewrote the UI system for graphs in version 3.0 so they had to redo the entire visual shader system. I think Juan planned to work on it after the animation blending graph, probably next week or in two weeks.
Very cool! My GLSL skills are a bit weak, but I can't figure out why this line: VERTEX.xy += vec2(cos(VERTEX.x + VERTEX.y + TIME)*20.0, sin(VERTEX.x + VERTEX.y + TIME)*20.0); should run so much slower than these 2 lines: VERTEX.x += cos(VERTEX.x + VERTEX.y + TIME)*20.0; VERTEX.y += sin(VERTEX.x + VERTEX.y + TIME)*20.0; I'm running in Godot 3.0.2, and the first line runs way slower than the second set of lines. Am I missing something?
Indeed - this was the discrepancy - silly coding logic on my part. When I assign to a temporary variable first, I get the same results as when I have the single line: temp_x = VERTEX.x + cos(VERTEX.x + VERTEX.y + TIME*speed)*20.0 ; VERTEX.y += sin(VERTEX.x + VERTEX.y + TIME*speed)*20.0; VERTEX.x = temp_x; Thanks for pointing this out!!
Seems so convoluted be to change timer and amplitude by drilling down into Materials. Is there a simple way to expose the shader uniforms vars in the properties of DancingGodot inspector
Use an exported variable and a setter to update the shader's uniform from code: docs.godotengine.org/en/3.0/getting_started/scripting/gdscript/gdscript_basics.html#setters-getters
When trying to save the shader, it fails and shows a warning: "This resource can't be saved because it does not belong to the edited scene. Make it unique first."
I solved it by saving the parent first, then switching back to shader (found exactly on top of the "Filter properties' " search bar), reset the Path property, and finally hit save.
Pixel shaders only process pixels that are in view normally, or at least within the viewport's bounds. It shouldn't make a difference if your water plane is the size of the screen or 5000 screens big. Depending on the visual style you're going for though, animated tilemaps can be a better fit
Not about the actual shader, but I really frowned when you explained the thing about properties and the self keyword. I don't think it's a good idea to have "self" change semantics so drastically. I mean, you literally call a function if you use "self", while you just write to the member without "self". It's also not obvious whatsoever and can lead to stupid and hard to find bugs. IMHO someone should rethink this.
It's just about using a setter through the same script. Self is implicit in GDscript but inside the class's code it needs to be explicit so you can bypass the setter at times. You can also use self all the time explicitly if you want, as in e.g. python
So the idea is the API let's you use properties since Godot 3, and the engine uses setters and getters on the back end. It applies the same default in GDscript when you use a custom node, but gives you the flexibility of mutating properties however you want in your own script. Instead of using self.property, you can instead call the setter and getter directly
I do get all of that, my point was that using "self" for that is imho a bad idea. Take C# for example, where you do have properties but a "raw" member variable is holding the actual value. So when you access the member, nothing special happens. The property which includes getters and setters is its own thing. There's no potential confusion about that. Here though, you have to be very careful to use self because it can have different semantics depending upon whether you're accessing a simple member or a property. Firstly, you have to just KNOW that (not obvious, as I said), secondly, even if you know it, you have to keep it in mind all the time. If you don't, bugs will happen that might be hard to find.
Hello But you know using " _ " (Underline) make problem in some cases, for some GPU for example cellphones, try to not use " _ " underline in your shader code, I already tried that :)
underscores should not cause issues. Dashes can because that's the minus sign, but underscores should really not. Have you had this issue with Godot 3's ShaderScript? The language is specific to Godot although it looks like GLSL
GDquest Actually once I wrote a shader it work fine for my pc and android phone but not for my friend android phone we delete the underline and it work fine other also have same issue look this link github.com/godotengine/godot/issues/12880
This is a complete and Free intro series to shaders. Watch the playlist: bit.ly/intro-to-shaders-godot (more videos to come) Be sure to go get the open source project and star the repository on GitHub! github.com/GDquest/Godot-engine-tutorial-demos/ (It is in the /2018/06-16-intro-to-shaders-2d-water subfolder and you can use minhaskamal.github.io/DownGit to download folders from github as ZIP files) This series is possible thanks to the people who support GDquest. It was funded by Kickstarter backers, who accepted that we make it free for everyone. Big thanks to them :). And big thanks to Baastian for the collab and for his insights on shader programming!