libgarbage: clamp lighting to 0..1

This commit is contained in:
Crispy 2024-08-11 13:33:20 +02:00
parent fb2ee82f67
commit 6f07643431
2 changed files with 3 additions and 3 deletions

View file

@ -1007,7 +1007,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
type: 3
objectId: dfb56a47-2b0b-4814-a4b0-950b5054b182
randomNum: 27659988
randomNum: 95618923
unityVersion: 2021.3.41f1
cckVersion: 3.10:132
--- !u!114 &649783671

View file

@ -181,7 +181,7 @@ FragOut frag (V2F i) {
first_hit = ray.hit_pos;
inside_shape = ray.steps == 0;
}
float3 light = LIGHT_FN(ray);
float3 light = clamp(LIGHT_FN(ray), 0, 1);
col_acc *= ray.mat.col * lerp(light, 1, ray.mat.gloss);
ray_num++;
if (ray.missed || ray.mat.gloss < 0.01) {
@ -291,7 +291,7 @@ float3 default_lighting(Ray ray) {
return SKY_FN(ray.dir);
float3 light = lSun(ray.normal, sun_dir);
light *= lShadow(ray.hit_pos + ray.normal * SURF_DIST, sun_dir, 50);
light += lSky(ray.normal);
light += lSky(ray.normal);
return light;
}