Godot Version
4.6.3
Question
so i am making a psx styled game and i found a video on yt that shows how you can make some shaders for it. I made the screen resolution 320x240 and if you look at the image you can see that the cube has light being projected on it but the floor does not.
PS1 Models Shader
shader_type spatial;
render_mode blend_mix,
cull_back,
depth_prepass_alpha,
shadows_disabled,
specular_disabled;
uniform sampler2D albedo_texture: source_color, filter_nearest;
uniform vec2 texture_tile = vec2(1,1);
uniform bool snap_enabled = true;
uniform float snap_resolution : hint_range(60.0, 480.0, 1.0) = 148.0;
uniform float affine_weight : hint_range(0.0, 1.0) = 0.1;
varying vec2 uv_affine;
varying vec2 uv_persp;
varying float clip_w;
void vertex() {
vec4 view_space_pos = MODELVIEW_MATRIX \* vec4(VERTEX, 1.0);
vec4 clip_space_pos = PROJECTION_MATRIX \* view_space_pos;
if (snap_enabled) {
vec2 ndc = clip_space_pos.xy / clip_space_pos.w;
ndc = round(ndc * snap_resolution) / snap_resolution;
clip_space_pos.xy = ndc * clip_space_pos.w;
}
clip_w = clip_space_pos.w;
uv_affine = UV * clip_w;
uv_persp = UV;
POSITION = clip_space_pos;
}
void fragment() {
vec2 uv_aff = uv_affine / clip_w;
vec2 uv_final = mix(uv_persp, uv_aff, affine_weight);
vec4 albedo = texture(albedo_texture, uv_final * texture_tile);
ALBEDO = albedo.rgb;
ALPHA = albedo.a;
}
Are your floor normals backwards?
my apologies i’ve just started learning how to make 3d games how do i see if my floor normals are backwards?
How did you make the floor? And the material for the floor too?
i made the floor with a csgbox cube and then used the tool to bake it into a meshinstance3d and the material is a shadermaterial like the one i showed
I’m not sure there’s a great way to check model normals in-editor, if you didn’t union/subtract from the CSG then you could use a basic mesh resource such as a new PlaneMesh
i made a new PlaneMesh and theres still no lighting on the floor
Is your light underneath the floor? it seems like the bottom of this capsule is illuminated
so the floor doesnt have the light reflected off of it but the capsule and cube do have light reflecting off of it.
it seems like the light stops reflecting once i’ve scaled a mesh too long
Is a shader material being used for the floor? It has specular disabled, which might be something to consider alongside the light mask layers.
yes the shader material is being used for the floor and i tried removing the specular disabled line yet it still isnt showing light on the floor
Have you tried a reload? Try posting more pictures of the floor node and light transform properties.
i’ve reloaded my editor multiple times to no change
i just recently tho decreased the attenuation and increased the range and now there seems to actually be a light on the floor
I would recommend checking global illumination, since it’s disabled on your ground mesh. Hopefully, this helps you better understand how it works.