Mobile transparency issues

Je06jmJe06jm Posts: 2Member

I'm trying to develop an mobile game, and I'm having trouble with transparency.
My shader looks like this

shader_type spatial;
render_mode depth_draw_alpha_prepass;

uniform sampler2D albedo;
uniform sampler2D specular;
uniform sampler2D roughness;

void fragment() {
    vec4 albedo_alpha = texture(albedo, UV);
    ALBEDO = albedo_alpha.rgb;
    ALPHA = albedo_alpha.a;

    SPECULAR = texture(specular, UV).r;
    ROUGHNESS = texture(roughness, UV).r;
}

This was tested on a Samsung Galaxy S10+. I'm new to mobile development

Answers

  • SIsilicon28SIsilicon28 Posts: 715Moderator

    Try using alpha scissors.

    ALPHA_SCISSOR = 0.9 // Or some other threshold.
    
  • Je06jmJe06jm Posts: 2Member
    edited May 18

    That results in him being cut off above the ground

  • SIsilicon28SIsilicon28 Posts: 715Moderator

    That's the trade-off. A nother thing you could do is separate the totally solid parts of the mesh from the transparent parts to reduce the first artifact. Get rid of alpha scissors when you do so.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file