I have a cube mesh and I would like for the top 1/4 of it to have a fading-to-transparency effect, I drew an example to help visualize it.

In the example, the blue portions represent what I would like to be opaque, and the orange represents what I would like to fade away, but they can be the same color in-game. Ideally the orange section gets more transparent towards the top. Lastly, its important that the "top" of the mesh is its local top, not the worldspace top. How can I do this?

    dizzy this is actually pretty easy but needs some tinkering.

    I made this in 1 minute:

    shader_type spatial;
    render_mode blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx;
    uniform vec4 albedo : source_color;
    uniform float zshift = 0.0;
    varying float zpos;
    
    void vertex()
    {
    	zpos = -VERTEX.y + zshift;
    }
    
    void fragment() {
    	ALBEDO = albedo.rgb;
    	ALPHA_SCISSOR_THRESHOLD = 0.5;
    	ALPHA = zpos;
    }

    it's one way to do it.
    another way would be with a texture, when you create uvs for the mesh, align them in the Y and then you can shift it and pass the texture to ALPHA.

    there's just a problem with the interior of the mesh being invisible.