This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

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: 693Moderator

    Try using alpha scissors.

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

    That results in him being cut off above the ground

  • SIsilicon28SIsilicon28 Posts: 693Moderator

    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.