blob: d2fd2e2fe47ae212d5e1432def535bcc48e19fc0 (
plain)
1
2
3
4
5
6
|
fn calculate_lighting(color: vec3<f32>, normal: vec3<f32>, pos: vec3<f32>, shadow: f32) -> vec3<f32> {
let light_dir = normalize(vec3<f32>(1.0, 1.0, 1.0));
let diffuse = max(dot(normal, light_dir), 0.0);
let lighting = diffuse * (0.1 + 0.9 * shadow) + 0.1; // Ambient + Shadowed Diffuse
return color * lighting;
}
|