1
0
Fork 0

implement lighmap shading

This commit is contained in:
Sen 2025-08-28 18:28:01 +02:00
parent cf0239c76e
commit 64396b28b9
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
6 changed files with 20 additions and 10 deletions

View file

@ -76,7 +76,7 @@ void main() {
vec3 norm = normalize(normal);
vec3 dir = normalize(cam_pos - vertex);
vec4 texel = texture(tex, tex_coord) * brightness;
vec3 light_v = texture(lightmap, vec2(0.03125 + lm_coord.x * 256, 0.03125 + lm_coord.y * 256)).rgb;
texel *= texture(lightmap, 0.03125 + lm_coord * 256.0);
vec3 rgb = texel.rgb;
vec3 result = calc_dir_light(norm, dir, rgb);
// int l = 0;
@ -87,5 +87,5 @@ void main() {
// l++;
// }
}
FragColor = texel * vec4(light_v, 1.0); // vec4(result, texel.a);
FragColor = texel; // vec4(result, texel.a);
}