Please forgive me for this really noobish question, why does multiplying the offset by UV.y and 2 flip the image? My math isn't really that good and I'm struggling to really understand that part.
No worries, the idea is the following: Basically as we move towards UV.y = 1.0 (the bottom of the sprite), we want to read the screen that's above in a "mirrored manner". So when rendering the line at UV.y = 1.0, we want to read the screen texture at SCREEN_UV + SIZE_OF_THE_SPRITE × 2 (where SIZE_OF_THE_SPRITE is the offset as explained in the video). On the other hand, at UV.y close to 0.0, we want to read the SCREEN_TEXTURE that is just a tiny bit above. And in between I want a linear progression, so that's why we multiply by UV.y If it's still not clear I can send you a diagram explaining it visually.
Sabes es de los pocos tutoriales, que sin escuchar tu voz, entiendo perfectamente lo que estas haciendo en todo momento. Es una perfecta forma de explicar, hasta para una persona sorda. Felicidades gran tutorial 😅 saludos
This does not work well in version 4, there is an illustrated bug: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-5DJKV5FyKNc.html If you can help me?
Hi, this is not related to the Godot version you're using, this is expected behavior. The shader cannot read what's above the screen (it is simply not rendered). To fix that you could render the game zoomed out (×0.5) and render it at twice the resolution. Then display the result zoomed "back" in (×2.0).
@@Nolkaloid ok I tried it didn't work, however you are right that this product when the reflected area is outside the camera, I tested with 0.5 scale and less and multiplied the effect by 2 it doesn't change anything, do you have another solution?
Of course it can, you need to use a full screen quad, see docs.godotengine.org/en/stable/tutorials/shaders/advanced_postprocessing.html#full-screen-quad
@@Nolkaloid I just set the texture of the sprite to repeated, but nothing changed. I'm assuming I have to set the noise texture to repeat. Not sure how to do that tho.
@@animebinger7974 You need to add the repeat_enable hint to the sampler2D declaration : uniform sampler2D noise : repeat_enabled; docs.godotengine.org/en/stable/tutorials/shaders/shader_reference/shading_language.html#uniforms
The code here doesn't work 1:1 anymore due to some stuff being changed from Godot 3 to 4; here's the GDscript that I've got working for my project that you can copy/paste. Replace $"../Player Character" with the node you want to look at your mouse. func _physics_process(delta): var space_state = get_world_3d().direct_space_state var mouse_position = get_viewport().get_mouse_position() rayOrigin = camera.project_ray_origin(mouse_position) # set the ray orign rayEnd = rayOrigin + camera.project_ray_normal(mouse_position) * 2000 # set the ray end point var player = $"../Player Character" var exclude = [player] var query = PhysicsRayQueryParameters3D.create(rayOrigin, rayEnd, 0xFFFFFFFF, exclude); var intersection = space_state.intersect_ray(query) if len(intersection) != 0: # if there is a proper ray hit get its position an rotate towards it var pos = intersection.position player.look_at(Vector3(pos.x, player.position.y, pos.z), Vector3(0, 1, 0))
Hi ! Thanks you so much, i copied your code but i still have the following error : Invalid call. Nonexistent function 'project_ray_origin' in base 'Node3D'. I'm a bit puzzled by it, i tried to remplace rayOrigin = camera.project_ray_origin(mouse_position) by rayOrigin = camera.global_position but then i get a similar error for another line : Invalid call. Nonexistent function 'project_ray_normal' in base 'Node3D'. my version is 4.2.1 Would be really cool if you could help ^^'
It doesn't work and it doesn't give me an error: ///VAR: onready var camara = $CameraPlayer var linea_origen = Vector3() var linea_final = Vector3() ///CODE: //FUNC _PHYSICS_PROCESS(DELTA): var space_state = get_world().direct_space_state var mouse_position = get_viewport().get_mouse_position() linea_origen = camara.project_ray_origin(mouse_position) linea_final = linea_origen + camara.project_local_ray_normal(mouse_position) * 2000 var interseccion = space_state.intersect_ray(linea_origen, linea_final) if not interseccion.empty(): var pos = interseccion.position $ModelPlayer/Look.look_at(Vector3(pos.x, translation.y, pos.z), Vector3(0,1,0)) -HELP ME
For some reason my dude keeps looking at the opposite direction even if I rotate every possible thing in the player scene 180 degrees. Edit: okay it seems to work if I make look_at from the video for the parent, and the child is turned around 180 degrees. Maybe this is wrong though, idk yet. Thank you anyways!
Couple more Godot 4 notes: `tool` needs to be `@tool` SCREEN_TEXTURE is deprecated, but the error in the editor explains how to fix it :) Thank you for this tutorial!
For anyone trying to do this on godot 4 there are a few things you have to do differently: First you need to create a new variable called 'query' "var query = PhysicsRayQueryParameters3D.create(rayOrigin, rayEnd)" then you have to replace the var intersection shown in the video with "var intersection = space_state.intersect_ray(query)" (thanks to @rhevoramirez7969 for this) if this doesn't work or if you're getting an error that goes like "Nonexistent Function '...' in '...' " then I have no clue why but removing the rayOrigin and rayEnd variables and add "var" at the start of the rayOrigin and rayEnd In the _physics_procress() function works, and finally you have to replace "interesection.empty()" with "intersection.is_empty()"
Thank you so much for these two great videos. Implemented it in Godot 4.1.1 and got most of it working. Only did not find out how to use your gradient material. So, if someone here knows, would be super happy if you could post an update here in the comments or somewhere. Many thanks ❤
Newbie question: I wanna create a collision for this, to make it I need to create a collision that changes it's shape (e.g: radius) over the time, or shaders also support smt like it? I believe that they only support "visual" stuffs
Hi, short answer : shaders are only for visual stuff. If you want to add a collision to the shockwave you'll need to use a collision shape and change it's size in sync with the shader.
First of all thank you. For (yet) unknown reasons the scale curve does not scale the particle at all. I'm using Godot 4.1.2 and up to the point where the scale curve is added, everything aligned well with your video. But the scale curve does not modify anything no matter what value I tweak. Any idea?
Hi, in Godot 4 you need to go to the material of the assigned mesh in the draw passes and set "keep scale" to true in the "Billboard" section. In the GPUParticles3D node : Draw Passes > Pass 1 > Material > Billboard > Keep Scale
Thnx so much this tutorial was exactly what i was trying to find for a long while but for some reason its not in the center and its elliptical idk why?
@@Nolkaloid yeah I got it. It seems that I just forgot to put scaleuv instead of screenuv. Thanks. Also is there a way to exclude an object from getting affected by this shader?
amazing video man, I'm using godot 4.0.3 and your tutorial works, didn't even run into a single problem! I'm curious though, the waves at the start of the video have like a white blanket on top of them, how did you do that? edit: nvm, got it myself, forgot that you mentioned it at the end of the video lol :D
Hi i'm super new to shaders. Is there a way to make this spawn on specific objects and have it be relative to that object instead of the screen? Or how woul dI have the shader follow an object?
great tutorial. would love more skill based shaders, think of diablo and poe! i have created some skills like frozen orb and whatnot, but warcry is pretty hard. not just in shaders, but for the effect. i use other nodes as well