ALSO, to make the outline pop out of the mesh instead of going inside it, multiply by (-1) the result of the DepthVS function before returning it. :)
@juanestban3 ай бұрын
thank man! you are amaizing, i was having troubles with the thickness 'cause I had "0" on the thickness_outline
@Infinte_log3 ай бұрын
Good video 🎉.
@iDigvijaysinhG3 ай бұрын
Thanks
@gallo1233 ай бұрын
This is for version 4.3+ of Godot btw, I had to update to see the effect (I was using 4.2)
@iDigvijaysinhG3 ай бұрын
Hey, Yup I did use 4.3 in the tutorial, but I don't see why we can't use in 4.2. Maybe you need to tweak the line on vertex processor. Something like "POSITION = vec4(VERTEX.xy, 0, 1);" should work.
@flynsarmy3 ай бұрын
Thanks for the tutorial! A common usecase in third person games is to outline the object your char is looking at. How would you adapt this to only highlight specified objects in your scene?
@iDigvijaysinhG3 ай бұрын
Hey, thanks! And I believe that this approach is not well suited for the said requirement. To highlight specific objects, I would still use my earlier simple outline approach. I have a video about that in Unity but it can easily be converted to use in Godot.
@flynsarmy3 ай бұрын
@@iDigvijaysinhG A Godot version would be wonderful!
@iDigvijaysinhG3 ай бұрын
@@flynsarmy It is easy enough. Basically in vertex processor you just do VERTEX * outline_scale. In fragment processor you can apply color. Also make sure you are only rendering the back faces. And apply the outline material onto the "next pass" of the original material.
@jafarrolo3 ай бұрын
Thank you, but would it be possible to have a video or an explanation on how to translate this in a compositor effect at the level of WorldEnvironment for example? I'm trying to understand those better but I still can't get the grasp of them.
@iDigvijaysinhG3 ай бұрын
Hey, coincidentally I just uploaded the video yesterday covering the Compositor Effects.
@jafarrolo3 ай бұрын
@@iDigvijaysinhG I watched it but they're still a little bit obscure to me, maybe because I lack the knowledge about compute shaders. I also tried this one since I'm in need of it for a project and it's weeks that I'm trying to implement a good outline shader, and while it is wonderful and really thank you for your work (I'm currently starting to watch little by little all of your videos to understand shaders better, I've seen the compositor and the outline one for now) in the current project I'm working on some of the outlines appears only from a distance. For example I have a lamp that is slightly squared, with round corners, if I look at it from 2-3 meters it looks properly with an outline on the lamp and nothing else, but if I look at it from a distance it starts to draw an outline where there is the rounded corner, do you have any idea what the reason could be? It happens also that the outlines are draw above Sprite3D nodes but only if I look at the Sprite3D from a little bit far away, no idea why this happens and I think the two things are related. EDIT: I just resolved the issue with the Sprite3D by setting the "Alpha Cut" to "Discard" but I'm not entirely sure why it worked 😅
@ConsularAtolАй бұрын
I'm unfortunately having issues with this shader when used with orthogonal cameras, it just simply doesn't work with them specifically. Any fix for this?
@iDigvijaysinhGАй бұрын
In orthographic projection, depth is usually stored linearly so after reading the depth from depth texture, you don't have to make it linear. At 4:55 you can directly return depth.
@ConsularAtolАй бұрын
@@iDigvijaysinhG That works splendidly, thank you so much!
@OhDangTheJam2 ай бұрын
Hey thank you very much for making this video. I have tried every shader I can find for a simple outline like this, and all of them seem to have some kind of issue. This one is perfect, but I've run into trouble. This shader works perfectly, but only for the first view in the editor. If I add more views, preview the camera view it's parented to, or launch the game, the shader is not working. Any idea why that would be?
@OhDangTheJam2 ай бұрын
Oh, I figured it out. It's not compatible with orthogonal cameras. Is it possible to modify it so that it works with orthogonal cameras/all the open views in the editor?
@iDigvijaysinhG2 ай бұрын
You could try this as a Compositor effect. I do have an introductory video about that topic.