Godot Version
4.3
You can see the backboard and rim is rendering in front of the basketball, even though the basketball is in front of them. I don’t know what I changed to cause this, it seems like it came out of nowhere. All the objects are unshaded, which is how I want it. The only other thing I changed with the shaders is the albedo. I don’t really think its a problem with the shader.
The first image shows the problem well and the second image is more what it should look like. The ball is sitting on the front of the rim (the rim should also be appearing in front of the backboard but only a part of it is). The reason it looks good in the second picture is because i changed the shader from unshaded to per pixel and it makes it look good in the editor, but when i run a test it still appears behind the backboard. I’ve restarted the engine and the the per pixel is also appearing behind the backboard even in the editor so I have no idea whats going on.
Can you share the shader and the setup? Do you have any transparency?
The first one is for the ball the second is for the backboard. The only changes i made were to the shading mode and albedo. Even if I reset the shading mode I still have the problem. Everything’s render priority is 0. Transparency is disabled and all the alpha values are 1.
Are you using any transparency or fade mode in the MeshInstance’s geometry properties?
Transparency is set to 0 and fade mode is disabled
@qbieshay
I figured out the problem but I don’t know how to fix it. I was changing all the materials to ORM to see if it made a difference, and it doesn’t, but I figured out the engine is rendering the newest made material on top of the others.
Certainly doesn’t sound like what an engine should do; any other settings overriden? Does it do this out of order with the default material? What rendering mode are you using?
If nothing else has changed as you stated then I’m at a loss, maybe you need to update your graphics card driver? I notice the grey background is somewhat strange, usually the preview environment does not look like that unless the GPU is severly out dated or has missing drivers.
On basematerial, there’s a dropdown menu that does “convert to shader”
Do you mind doing that? and paste the generated code
Compatibility, all rendering settings are default. Now that you mention it, the background wasn’t always gray, I remember it changing but didn’t think anything of it. Maybe it has something to do with this whenever I start the engine:
It’s not, I got all the errors to go away and nothing changed. Also, when I open a different game, everything looks good.
// NOTE: Shader automatically converted from Godot Engine 4.3.stable's StandardMaterial3D.
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded;
uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
uniform float point_size : hint_range(0.1, 128.0, 0.1);
uniform float roughness : hint_range(0.0, 1.0);
uniform sampler2D texture_metallic : hint_default_white, filter_linear_mipmap, repeat_enable;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_roughness_r, filter_linear_mipmap, repeat_enable;
uniform float specular : hint_range(0.0, 1.0, 0.01);
uniform float metallic : hint_range(0.0, 1.0, 0.01);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
UV = UV * uv1_scale.xy + uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo, base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic, base_uv), metallic_texture_channel);
METALLIC = metallic_tex * metallic;
SPECULAR = specular;
vec4 roughness_texture_channel = vec4(1.0, 0.0, 0.0, 0.0);
float roughness_tex = dot(texture(texture_roughness, base_uv), roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
}
@gertkeno @qbieshay
Thanks for the help. Pointing out the gray background made me realize what it was. I added a WorldEnvironment under a 2d node to make a text glow effect. I didn’t realize it would affect the 3d environment as well. Deleting the WorldEnvironment fixes everything.