Pixel looks like broken in Partial glow effect

Godot Version

GODOT 4.2.1 stable

Question

hi,
I’m currently creating game sprites using animation sprites.
Also, I’m trying to apply a glowing effect only to the weapon part of the character.
For this part, I’m going to use a shader to create a separate uv map for the shining part and increase the rpg value of this part to make it glow.

I made a shader code like this:


shader_type canvas_item;
uniform sampler2D emission_texture;
uniform vec4 glow_color : source_color = vec4(1.0);

void fragment() {
	vec4 emission_color = texture(emission_texture, UV);
	
	if(emission_color.r > 0.0f)
	{
		COLOR = (emission_color + glow_color);
	}	
}

However, the result is that although the mapped area shines, the pixels appear to be severely broken.

I need help with this part.

I think Godot has imported your texture as VRam Compressed since it was used in a shader, manually change the UV Map’s import mode to lossless mode

1 Like

While compression can be an issue, you’ll want to try a few things before setting these to uncompressed.

Most likely there is some value drift from 0.0f and you will want to up the value you are comparing to the emission_color.r, upping that until it clears up what you see can be an easy solve, try like .1f first.

Can you show what the .r channel looks like on the emission_texture source? There are ways of getting that texture setup to work better in the shader as a mask, using slight gradients or other channels can help a lot.

2 Likes

Yes, I checked my import setting. but it has automatically lossless mode. I checked a value of emission_color.r, it seems to almost solved.
Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.