#ifndef SOUNDINGS_OCEAN_WAVES #define SOUNDINGS_OCEAN_WAVES float3 OceanWave(float2 position, float time, float storm) { float amplitude = lerp(.35, 1.46, storm * storm); float2 windWave = float2(.052, .115); float2 swellWave = float2(-.073, .170); float2 crossWave = float2(.217, -.136); float s1, c1, s2, c2, s3, c3; sincos(dot(position, windWave) - time * .93, s1, c1); sincos(dot(position, swellWave) - time * 1.22 + 1.3, s2, c2); sincos(dot(position, crossWave) - time * 1.64 + 2.9, s3, c3); float2 gradient = .65 * windWave * c1 + .25 * swellWave * c2 + .10 * crossWave * c3; return amplitude * float3(.65 * s1 + .25 * s2 + .10 * s3, gradient); } #endif