I have started to explore shader materials. Added one shader material as next pass material to my object. When there is no other meshes with materials in the world the shader is shown but when i add for instance floor with its own material then the shader material gets hidden behind the other world material.

At first i thought that the shader is not working but then started to pan around and noticed that it gets hidden behind other materials.

What am i doing wrong? How do i add shader material to objects and make it so that it does not gets hidden behind other objects?

IIRC the SCREEN_TEXTURE includes depth pass in alpha, might have something to do with it perhaps. Consider that it doesn't just feature the object you apply the shader to in the screen tex alpha depth but the other objects too.

Is there a shader that would highlight an object ? like glowing outline that is not world environment light dependant

    kuligs2 Hi, it looks like you are trying to use a deferred way of highlighting, which is using the screen buffers.
    Godot uses the forward pipeline, the way to highlight an object is to create a copy of it. You should not use the godot buffers too much, as they tend to make the materials fight each other, so if you have a refraction material, it will not affect transparent materials or other refraction materials, and it will interfere or disappear when using custom post-process effects with a plane.

    1 - make sure your object has no normal seams, or bake your normals into one that does and use the normal texture. a normal seam is when there are two or more duplicated vertices, which is used to create what are sometimes known as "smooth groups". This is done to create hard edges.
    This step is not important, but these seams can cause the highlight to break a bit on the seams.
    2 - create a second material and apply it as a next pass over your material, like you did. but...
    3 - there's an option called grow in standard material, which will cause the vertices to expand by the normals. then set culling to front, which will cause the back faces of your material to show. finally, set the shading mode to unshaded, this will make the material a single color (or the albedo texture color), and will have better performance.

    "grow" is a vertex shader, which means it has better performance than what your are doing with the fragment, the code is also simpler.

      Jesusemora Thanks for explanation, but it seems its a bit over my head 😃. I grabbed the shader from the godotshader website, thinking i can do as the readme said and it will work. It kinda does but not exactly.

      The first two steps.. atm the model has no texture, and i use the godot material.

      Setting culling will reveal the insides of the model. In my case i have stuff inside so now it looks wierd 😃

      But i think i understand what youre saying. Are you saying using shaders to highlight (outline) objects is not a good way to do it?.

      This example is using two materials (not shader material)

      Ok, now i get it. Thanks!.

      In game development its all about illusions 😃. Make it believable, like magic. When in fact behinds the scenes there are smoke and mirrors 😃