simplerr / UtopianEngine

A game engine in early development
MIT License
52 stars 5 forks source link

Large negative values when sampling _MainTex in SSR shader #95

Open simplerr opened 4 years ago

simplerr commented 4 years ago

In data\shaders\ssr\ssr.frag when sampling at the SSR hitPixel UV coordinate with

reflectionColor = vec4((texture(_MainTex, hitPixel)).rgb, alpha);

reflectionColor.rgb does at some pixels have large negative values < -50 which cases the SSR blur pass to create big artifacts:

image

The workaround is to clamp the reflection color to 0-1 but the root cause should be investigated. From investigating the UV coordinates used for the sampling seems to be in range and also the output texture from the water job does not contain these large negative values so where they are introduced into the texture is unknown.