Skip to content

Commit

Permalink
clamp envmap radiance when too high
Browse files Browse the repository at this point in the history
  • Loading branch information
fbxiang committed Nov 5, 2023
1 parent f30ab31 commit dc3f3d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vulkan_shader/rt/camera.rmiss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ void main() {
vec3 dir = ray.direction;
dir = vec3(-dir.y, dir.z, -dir.x);
if (envmap != 0) {
ray.radiance = texture(samplerEnvironment, dir).xyz;
// FIXME: super high values seem to cause nan
ray.radiance = clamp(texture(samplerEnvironment, dir).xyz, vec3(0,0,0), vec3(100, 100, 100));
} else {
ray.radiance = ambientLight;
}
Expand Down

0 comments on commit dc3f3d5

Please sign in to comment.