Hello, I am a new user of Godot.
I created a shader on the camera, but I found that when I changed its opacity, the opacity of the MeshInstance3D object in the 3D scene also changed accordingly.
How can I make it not affect MeshInstance3D objects in the 3D scene?
my shader code:
shader_type spatial;
render_mode unshaded,cull_back;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture;
void vertex() {
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
}
void fragment() {
vec4 original = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0);
ALBEDO = original.rgb;
ALPHA=0.5;
}
Add some additional information:
windows 11
godot 4.4.1
What are you hoping to accomplish by setting alpha on the camera shader?
I am currently working on a tower defense game and I want to display the attack range of the turret. I have already implemented this feature, but it will affect the opacity of the health bars of other monsters, which is why I came here to seek help.
You can set opacity on objects directly by setting an alpha value in their self_modulate
color. You could do that directly rather than via the camera…
Thank you for your help. I have resolved this issue by adjusting the rendering priority