A lightweight ocean rendering project featuring procedural wave displacement and realistic water shading based on a sum-of-sines wave model.
This project uses a custom vertex/fragment shader to simulate animated ocean waves in Unity without relying on complex simulation techniques or external assets.
- Vertex displacement based on multiple sine waves
- Procedural normals from analytical wave gradients
- Physically-inspired shading with:
- Fresnel reflection
- Skybox reflection
- Diffuse and specular lighting
- Depth-based color blending (shallow and deep)
- Simple slope-based foam (doesn't work well at the moment)
- Fully GPU-driven: no textures, no baked data
- Custom mesh generation at runtime
_SunColor- directional light color_SpecularColor,_SpecularPower- controls highlight intensity_FresnelPower- sharpness of view-angle-based reflection_ShallowColor,_DeepColor- water base color by depth_DepthFadeDistance- controls transition range between deep and shallow water_SkyboxTex- cubemap used for reflection_FoamSharpness,_FoamIntensity- controls appearance of crest foam
numWaves- number of sine waves combinedrandomSeed- deterministic wave generationspeedFactor,baseWaveAmplitude,baseWaveLength- global wave propertiesedgeLength,edgeResolution- mesh density and extent
