Avoid div0 in shiny water shader

This commit is contained in:
Joshua Barretto 2020-12-30 22:18:19 +00:00
parent d2a7aa34b1
commit a404707f87

View File

@ -136,7 +136,7 @@ void main() {
// Possibility of div by zero when slope = 0,
// however this only results in no water surface appearing
// and is not likely to occur (could not find any occurrences)
float slope = abs(wave00 - wave10) * abs(wave00 - wave01);
float slope = abs((wave00 - wave10) * (wave00 - wave01)) + 0.001;
vec3 nmap = vec3(
-(wave10 - wave00) / 0.1,