In This Article (19 sections)
Ocean Shader Unity Workflow for Realistic Water, Waves, Foam, and Shorelines
An Ocean Shader Unity workflow is the foundation for believable water in games, simulations, architectural visualizations, and cinematic real-time scenes. A strong ocean shader does more than tint a plane blue. It combines surface color, transparency, reflection, refraction, wave displacement, foam, depth fading, shoreline blending, caustics, and performance-aware rendering so the ocean reacts naturally to light, camera distance, objects, and terrain.
In Unity, an ocean shader can be built visually with Shader Graph, written manually in HLSL, adapted from HDRP’s water system, or purchased as a production-ready asset. The right approach depends on the render pipeline, target platform, art direction, and gameplay needs. A mobile stylized game may need cheap scrolling normals and simple foam, while a PC or console ocean scene may use Gerstner waves, planar reflection, depth-based shoreline foam, underwater rendering, and physically plausible absorption.
The goal of this research article is to explain how Ocean Shader unity techniques work in practical Unity production. It covers beginner Shader Graph setup, URP and HDRP differences, realistic water settings, Gerstner wave logic, foam, shoreline effects, transparency, refraction, reflection, caustics, stylized water, optimization, and asset alternatives. The core idea is that convincing water comes from combining multiple simple visual systems rather than relying on one effect alone.
Ocean Shader Fundamentals and Creation Options
An ocean shader in Unity is a GPU program that controls how ocean water is drawn, animated, lit, and blended with the rest of the scene. A basic shader decides the final color of each pixel. A more advanced Ocean Shader unity setup also modifies vertices for waves, samples scene depth for shorelines, reads scene color for refraction, blends foam textures, simulates surface roughness, distorts reflections, and changes opacity based on water depth.
Unity supports several ways to create ocean shaders. Shader Graph is the most accessible option because it lets artists and developers build shaders visually by connecting nodes instead of writing shader code directly. Unity’s documentation describes Shader Graph as a visual tool for building shaders in a graph framework, with instant feedback as changes are made. Unity also states that Shader Graph is supported by both the Universal Render Pipeline and the High Definition Render Pipeline.
An ocean shader is not the same thing as an ocean system. The shader is the material logic that renders water. An ocean system may include mesh generation, level of detail, buoyancy, wave queries, foam simulation, underwater rendering, and interaction with boats or characters. For example, HDRP includes a built-in water system with water surface types such as Pool, River, and Ocean, Sea, or Lake, and these surfaces include features like wind, current, foam, caustics, scattering, refraction, and Shader Graph customization.
Key Visual and Technical Ingredients
The most important visual ingredients in a realistic ocean shader are color absorption, smooth reflective highlights, moving normal maps, large wave displacement, transparency near shallow water, and foam where water collides with geometry or where waves crest. Real ocean water looks different at different depths because light is absorbed and scattered through the water volume. Shallow water often appears clear, turquoise, green, or sandy depending on the seabed, while deep water appears darker and less transparent.
The most important technical ingredients are surface type, depth texture, opaque texture, normal data, reflection source, and render queue. In URP, transparent water usually renders after opaque objects, which affects how it reads scene color and depth. Unity’s URP Lit shader documentation explains that transparent surfaces blend with the background and render in a separate pass after opaque surfaces. This is why depth and opaque texture setup matters for water refraction, shoreline foam, and underwater visibility.

Unity Ocean Shader Graph Setup, Realistic Water Settings, and URP Configuration
A beginner Unity Ocean Shader Graph should focus on clear structure before advanced features. Start with a URP Lit Shader Graph for the widest compatibility. Name it something descriptive, such as Ocean_Water_URP. Create material properties for shallow color, deep color, foam color, smoothness, alpha, normal strength, wave speed, wave scale, foam amount, and depth fade distance. The first graph section should handle base color by combining shallow and deep water colors through a depth mask created from Scene Depth and Screen Position.
Unity’s Scene Depth node samples the current camera depth texture and returns the depth of the closest object seen by the camera along the sampled direction. In URP, Unity states that the depth texture must be enabled in the URP asset or the Scene Depth node returns a default mid-grey value. Use that depth value to estimate how far the nearest opaque surface is behind the water. When the seabed or terrain is close to the water surface, the mask should lean toward shallow color. When the background surface is far below or absent, the mask should lean toward deep color. This one calculation drives water clarity, shoreline softness, and foam placement.
The second graph section should handle normals. Add two normal map properties or two procedural noise height fields, then scroll them using Time multiplied by direction vectors. One normal layer should move slowly with larger scale, while the second should move faster with smaller scale. Combine the normals and multiply their strength by a parameter before feeding the result into the fragment normal input. Avoid extreme normal strength because overly sharp normals create noisy highlights and unrealistic refraction. The third graph section should handle alpha by using a base alpha slider for global transparency, then multiplying it by a depth-based factor so shallow water can be more transparent and deep water can become more opaque.
Foam Refraction and Realistic Water Tuning
The fourth section should handle foam. Take the same depth difference used for shallow water and invert it so foam appears where geometry intersects the water. Add a noise texture so the foam edge breaks up naturally, multiply the foam mask by a foam intensity property, and blend foam color into the base color. Foam should also affect alpha and smoothness because real foam is rougher and less mirror-like than clear water.
The final section should handle refraction by sampling Scene Color with Screen Position, offsetting the screen UV by the combined normal map multiplied by a refraction strength value, and blending the distorted scene color with the water color. For beginners, subtle refraction is safest because strong distortion can reveal screen-space artifacts near object edges.
The best Unity ocean shader settings depend on the project, but realistic water usually follows a few reliable principles. Smoothness should be high because calm water produces sharp specular highlights and strong reflections. Metallic should stay at zero because water is not a metal. Base color should be dark enough to suggest depth, but not so saturated that it looks like paint. Alpha should be balanced against refraction and depth color rather than treated as simple glass transparency. Tropical scenes can use turquoise shallow water, northern seas often use grey-blue or green-blue water, and muddy rivers use brown-green absorption.
Normal strength should be separated by scale. Large waves should come from vertex displacement or a simulation, while small ripples should come from normal maps. A common mistake is trying to make the entire ocean dynamic with normal maps only. This can look acceptable from a distance, but the horizon and shoreline will remain flat. Another common mistake is using only vertex displacement, which creates waves but lacks fine surface detail. The best result combines displaced geometry for silhouette and normals for small lighting variation. Foam settings should also be conservative, appearing near shorelines, rocks, moving objects, and breaking wave crests rather than covering the whole ocean unless the scene is stormy.
URP Setup and Performance Optimization
For a Unity Ocean Shader URP setup, create or confirm a URP project first. Open Project Settings and check that the active Graphics pipeline asset is a Universal Render Pipeline asset. Then open the URP asset and enable Depth Texture and Opaque Texture. Depth Texture supports depth-based foam, depth fade, and shoreline detection. Opaque Texture supports refractive sampling through Scene Color. Unity’s URP asset documentation states that Opaque Texture creates a camera opaque texture before transparent meshes render and can be used for effects such as water refraction and heat waves.
Create a Lit Shader Graph targeting URP and set Surface Type to Transparent. Unity’s URP documentation explains that transparent surfaces blend with the background and render in a separate pass after opaque surfaces. This is useful for water, but it also means transparent sorting, depth writing, and overdraw need careful handling. Set Blend Mode to Alpha for general transparent water, use Premultiply only if you understand how it affects color and highlights, enable Preserve Specular Lighting when available if the water looks too dull at lower alpha values, and keep Render Face on Front unless the camera goes underwater or sees the underside of the ocean plane.
Use Scene Depth with Screen Position to build water depth, and use Scene Color for refraction. Unity’s Scene Color documentation notes that in URP this node samples the opaque texture, which is the color buffer copy before transparent objects render. This means other transparent objects are usually not included in the refraction sample unless you build a custom transparent scene color workflow. For URP performance, keep the shader modular. Make foam optional with a keyword if the project needs quality settings, make refraction optional for lower-end devices, and use lower-resolution opaque texture downsampling if the quality loss is acceptable. For best results, use a separate water layer and test from high angles, low angles, shoreline angles, and underwater-adjacent views.

HDRP Ocean Water, Gerstner Waves, and Foam Systems in Unity
HDRP provides a more advanced foundation for realistic ocean rendering than URP because it includes a dedicated water system. For an HDRP ocean, open GameObject, Water Surface, and choose an appropriate water type such as Ocean, Sea, or Lake. Unity’s HDRP documentation states that users can add a water surface from GameObject, Water Surface and select a surface type, and can also use a Water Shader Graph to create a water material. HDRP’s water system is designed for physically richer scenes, with support for water body types including Pool, River, and Ocean, Sea, or Lake.
River and Ocean, Sea, or Lake support multi-band simulation properties, which help create larger and more complex wave patterns. HDRP also supports underwater rendering, wind and current, simulation foam, caustics, material properties such as smoothness, refraction, light scattering, and Water Shader Graph customization. To customize the look, create a Water Shader Graph rather than a generic Lit graph. HDRP documentation explains that a Water Shader Graph can be created from Assets, Create, Shader Graph, HDRP, Water Shader Graph, and that an existing graph can use the HDRP target with its material set to Water.
HDRP water settings should be adjusted at both the water surface and the HDRP asset level. On the water surface, tune wind speed, swell, ripples, foam, scattering, absorption, refraction, and caustics. In the HDRP asset and quality settings, enable water features needed by the project. If scripts need buoyancy or height queries, HDRP documentation says Script Interactions must be enabled in the Water section of the HDRP Asset and in the Inspector for the water surface. HDRP is best when the scene lighting is physically coherent because ocean water is very sensitive to sky color, exposure, reflection volumes, fog, and sun angle.
Gerstner Waves for Ocean Motion
Gerstner waves are a popular real-time method for creating believable ocean motion. A standard sine wave moves vertices up and down, but a Gerstner wave also moves points sideways, producing sharper crests and flatter troughs. This makes the surface feel closer to wind-driven ocean waves without requiring a full fluid simulation. NVIDIA’s GPU Gems chapter on effective water simulation describes a real-time water system that combines geometric undulations of a base mesh with dynamic normal map generation for convincing GPU-rendered water.
A Gerstner wave is usually controlled by direction, wavelength, amplitude or steepness, speed, and phase. Direction determines where the wave travels. Wavelength determines the distance between crests. Amplitude determines height. Steepness controls how sharp the crest becomes. Speed controls motion over time. In deep-water wave theory, phase speed relates to wavelength and gravity, and many real-time implementations use this relationship to make longer waves move faster than short ripples. Catlike Coding’s Unity wave tutorial explains this relationship as phase speed equal to the square root of gravity divided by wave number for deep water.
In Unity Shader Graph, Gerstner waves usually require Custom Function nodes because the calculation is easier and cleaner in HLSL than with many visual nodes. Unity’s Custom Function node allows Shader Graph users to inject HLSL code either directly as a string or by referencing an external HLSL file. A practical ocean does not use one Gerstner wave. It sums several waves with different directions, wavelengths, amplitudes, and speeds. Large waves create the main ocean shape, medium waves add secondary motion, and small waves are often better handled by normal maps instead of vertex displacement because very small geometry waves require too many vertices.
The main constraint is mesh density. Gerstner waves displace vertices, so the ocean mesh must have enough subdivisions. If the mesh is sparse, the wave silhouette becomes faceted. If the mesh is too dense everywhere, performance suffers. A better solution is a grid with more detail near the camera and less detail far away, or an ocean LOD system. Normals must match displacement. If the vertices move but the normals remain flat, lighting will look wrong. The most convincing Ocean Shader unity result uses wave displacement for geometry, derivative-based normals for lighting, and scrolling normal maps for micro-detail.
Foam Generation and Blending
Foam is one of the strongest realism cues in an ocean shader because it reveals motion, collision, and wave energy. Foam appears when waves break, water churns, or the surface intersects shorelines and objects. In Unity, foam can be generated through depth difference, wave height, slope, noise masks, flow maps, custom render textures, or simulation data. The simplest foam method uses scene depth by comparing the water surface depth with the depth of the opaque geometry behind it. When the difference is small, the water is intersecting or nearly touching land, rocks, piers, or other objects, producing an intersection foam mask.
Depth foam alone can look too clean, so add noise. Multiply the foam mask by a scrolling noise texture, use a larger slow-moving noise pattern for broad foam breakup, and add a smaller faster noise pattern for fine detail. Remap the result with contrast controls so the foam has broken edges rather than a smooth band. For wave crest foam, use wave height or slope. If using Gerstner waves, the shader can estimate crest regions from the combined wave displacement. Foam should appear near high, steep crests, especially when steepness passes a threshold.
Foam should affect more than color. It should reduce smoothness, increase opacity, and suppress refraction. Clear water is glossy and refractive, while foam is bubbly, rough, and mostly opaque. A good foam blend mixes foam color into base color, raises alpha, lowers smoothness, and reduces refraction intensity. HDRP provides built-in water foam support for River and Ocean, Sea, or Lake surfaces. Unity documents that these HDRP water surfaces support simulation foam, with controls for amount, smoothness, masking, and wind-speed dimming. Unity’s HDRP water blog also notes that Shader Graph can inject custom foam into the Water master node for effects such as river borders and waterfall swirl foam.

Shoreline Foam, Transparent Water, Refraction, Reflection, and Caustics
A shoreline foam effect makes the water blend naturally with beaches, cliffs, rocks, and sea walls. Without shoreline foam, an ocean plane often looks like a transparent sheet cutting through the world. With shoreline foam, the contact area becomes visually active and believable. The most common shoreline foam method in Unity is depth-based intersection. The shader samples scene depth behind the water pixel, compares it with the water surface depth, and creates a mask where the difference is small. This produces foam exactly where the water intersects opaque terrain or objects.
A strong shoreline effect needs three layers. The first layer is a soft wet edge, which slightly brightens or tints the water near shore. The second layer is white foam, which appears at the strongest intersection zones. The third layer is moving breakup, which uses noise or flow to make the foam crawl, dissolve, and return. The shoreline foam should be scaled by wave activity. Calm water needs a narrow, subtle shoreline line, while stormy water needs a wider foam band. If the shader uses Gerstner waves, the foam can be modulated by wave height near the shore. If the project uses a beach mesh, vertex colors or painted masks can manually control where foam is allowed.
For beaches, use a wider fade distance and softer foam edges. Sand creates shallow gradients, so foam should spread and dissolve gradually. For rocks or piers, use a tighter mask and more contrast because waves hit hard edges. For stylized projects, shoreline foam can be a hand-painted band or procedural ring with simple scrolling noise. In URP, make sure Depth Texture is enabled. In HDRP, use the Water Shader Graph and water system features when available. Unity’s HDRP water capabilities include foam support and material customization through Shader Graph, which makes HDRP a strong choice for realistic shoreline work.
Creating Transparent Water and Refraction
Transparent water in Unity Shader Graph starts with the material surface type. In URP, use a Lit Shader Graph and set Surface Type to Transparent. Unity’s URP Lit shader documentation explains that transparent surfaces blend with the background and render after opaque surfaces. This render order is important because transparent water often needs to see opaque terrain, rocks, and seabed behind it. Transparency should not be controlled by a single alpha value only. Realistic water transparency should vary by depth, viewing angle, foam amount, and turbidity.
Shallow water can have higher transparency, deep water can become more opaque, foam should be mostly opaque, and grazing angles should often become more reflective and less transparent because water reflects more strongly at low viewing angles. In Shader Graph, create a global Alpha property and multiply it by a depth fade. Use shallow depth to increase transparency and deep depth to reduce it. Blend this with color absorption so deep water does not simply become invisible dark glass. The best result is often a colored transparent surface layered over a depth-based color gradient.
Use refraction carefully. Transparent water that does not distort the background can look like tinted glass. Add a Scene Color sample offset by the normal map to create the impression of light bending through waves. Unity’s Scene Color node samples the current camera color buffer from screen-space coordinates, and in URP it samples the opaque texture. Avoid sorting problems by keeping the ocean as one large surface where possible. Transparent objects behind or inside transparent water can render in unexpected order. Some projects solve this with separate rendering layers, depth prepass techniques, custom renderer features, or by avoiding overlapping transparent materials under water.
Reflection and Fresnel for Realistic Surfaces
Reflection and refraction are what make ocean water feel connected to the environment. Reflection shows the sky, sun, clouds, cliffs, boats, and scene lighting on the surface. Refraction distorts what lies beneath or behind the water. A realistic ocean shader needs both, but the implementation differs between URP and HDRP. In URP, reflection often starts with reflection probes or a cubemap. A sky reflection is cheap and convincing for large ocean surfaces because most of the visible reflection is sky. For higher quality, use planar reflection, where a secondary camera renders the mirrored scene into a texture. Planar reflection is more accurate for flat water but expensive because it can require rendering the scene again.
URP refraction usually uses the opaque texture. Unity states that the URP Opaque Texture captures the scene before transparent meshes render and can be used for effects such as water refraction. In Shader Graph, sample Scene Color using Screen Position, offset the UV by the water normal multiplied by a small refraction strength, and use depth to reduce refraction in deep water or foam areas. HDRP handles water refraction and reflection more deeply when using the built-in water system. Unity’s HDRP water capabilities documentation states that HDRP treats water surfaces as refractive transparent objects. HDRP water also integrates with lighting, reflection, scattering, and material systems, which is why HDRP is often preferable for realistic oceans in high-end projects.
The Fresnel effect is essential. At direct viewing angles, water tends to show more refraction and depth color. At grazing angles, water becomes more reflective. In Shader Graph, use a Fresnel node or a dot product between view direction and surface normal, then use that mask to increase reflection and reduce transparency at glancing angles. Keep distortion physically plausible. If refraction strength is too high, underwater objects wobble like heat haze. Subtle distortion reads better in realistic scenes, while stronger refraction can work for stylized games if it matches the art direction.
Caustics and Shallow Water Light
Caustics are the bright, moving light patterns projected onto the seabed, pool floor, rocks, and underwater surfaces when light is focused by waves. They are visually important in shallow water because they suggest clarity, sunlight, and wave motion. True physical caustics are expensive, so most Unity ocean shaders use approximations. The simplest caustic method is a projected animated texture. Create or import a tileable caustic texture, project it in world space onto underwater surfaces or blend it into the water shader based on depth, and animate it by scrolling two caustic textures in different directions.
Caustics should be multiplied by sunlight intensity and shallow-water masks, then faded with depth because light patterns become less distinct in deeper or murkier water. In URP, caustics can be implemented as part of the water shader, a decal-like projector, a custom render feature, or a material function on underwater surfaces. Shader-only caustics are easy but may appear only on the water surface unless you apply them to the seabed material. Projected caustics are more convincing because they appear on objects below the water.
In HDRP, the built-in water system includes caustic controls. Unity’s HDRP water capabilities documentation states that caustic resolution can be adjusted for all water surface types, and that River and Ocean, Sea, or Lake surfaces can specify which simulation band is used to generate the caustic texture. This is a major advantage of HDRP for high-end water scenes. Caustics should be tied to water clarity. Clear tropical water should show strong caustics in shallow areas. Deep ocean water should show little or none. Muddy or stormy water should suppress them. For realism, caustics should also depend on sun angle because a high midday sun produces stronger downward caustics than a low sunset angle.

Stylized Ocean Shaders and Realistic Water Performance Optimization in Unity
A stylized Ocean Shader Unity tutorial follows the same structure as realistic water but makes different artistic choices. Stylized water usually uses cleaner colors, stronger outlines, simplified foam, exaggerated wave shapes, and less physically strict lighting. The goal is readability and charm rather than physical accuracy. Start with a flat or lightly displaced ocean mesh. Use two or three color bands instead of a continuous realistic depth gradient. Shallow water can be bright cyan, mid-depth water blue, and deep water dark indigo. Blend these bands using depth, distance from shore, or world-space position.
For waves, use sine waves or simplified Gerstner waves. A stylized ocean can exaggerate crest height and move slower than realistic water. Keep wave frequency readable because too many overlapping waves can create noise that conflicts with the stylized art direction. Foam should be graphic rather than photographic. Instead of realistic frothy detail, use clean white shapes with soft edges or painterly breakup. Shoreline foam can look like animated rings, ribbons, or hand-drawn scallops. Crest foam can appear only at the top of waves.
Refraction can be stronger in stylized water, but it should be smooth. A stylized shader may use fake refraction, scrolling highlights, and a rim-like Fresnel color instead of physically based reflection. Caustics can be painted as bright animated patterns on the seabed. The biggest advantage of stylized water is performance. You can often skip expensive planar reflections, complex transparency, high sample counts, and multi-layer foam. Use simple color ramps, two normal maps, lightweight vertex waves, and optional depth foam. The result can look polished while staying friendly to mobile and handheld platforms.
Realistic Water Performance Optimization
Realistic water can become expensive because it combines transparent rendering, large screen coverage, multiple texture samples, vertex displacement, scene depth, scene color, reflection, foam, and sometimes extra cameras. Optimization should begin before the shader is finished, not after performance collapses. The first optimization is controlling transparency. Transparent ocean pixels can be costly because they render after opaque objects and blend over the scene. Large water surfaces can cover most of the screen, especially from high camera angles. Keep the transparent shader as simple as possible for far water. Use LODs or shader keywords to disable foam, refraction, and high-frequency detail at distance.
The second optimization is controlling texture samples. A water shader can easily sample multiple normal maps, foam maps, noise maps, caustic maps, depth, scene color, and reflection textures. Each sample has a cost. Pack masks together where possible, reuse noise textures, and avoid high-resolution textures for effects that are heavily distorted or distant.
The third optimization is wave LOD. Do not use dense vertex displacement across an enormous plane if only the near camera area needs geometry waves. Use a mesh that has more vertices near the camera and fewer far away. Use normal maps for distant wave detail. Advanced ocean systems use level of detail strategies for this reason. Crest’s documentation describes it as an advanced ocean system for Unity that uses LOD strategies and GPU acceleration for fast update and rendering.
The fourth optimization is reflection quality. Planar reflections are expensive because they render the scene again. Use them only when the visual payoff matters. Reflection probes or sky cubemaps may be enough for large ocean scenes. Screen-space reflections can be good in HDRP, but test artifacts and performance. The fifth optimization is feature scaling. Create quality tiers. Low quality can use color, alpha, and scrolling normals. Medium quality can add depth foam and simple refraction. High quality can add Gerstner displacement, foam layers, caustics, and stronger reflection. This makes the same Ocean Shader unity framework usable across different hardware.
The sixth optimization is avoiding unnecessary precision and branches. Use half precision where acceptable on platforms that benefit from it. Keep Custom Function HLSL clean. Avoid dynamic branches inside fragment shading unless they save significant work. If a feature is disabled, a shader keyword or separate variant may be better than a runtime branch. A practical Ocean Shader Unity setup should be designed as a scalable framework rather than a single fixed material, especially when the same project needs to support different devices or quality presets.

Frequently Asked Questions (FAQs)
- What is the best way to create an Ocean Shader Unity project for beginners?
The best beginner approach is to use URP Shader Graph with a transparent Lit Shader Graph, two scrolling normal maps, depth-based color, simple alpha, and depth-based foam. This teaches the core water concepts without requiring complex HLSL or a full ocean simulation. Once the basic shader works, you can add refraction, Fresnel reflection, caustics, or Gerstner waves as separate upgrades. - Is Shader Graph enough for realistic ocean water in Unity?
Shader Graph is enough for many realistic water scenes, especially lakes, beaches, pools, and stylized oceans. It can handle depth color, transparency, scrolling normals, foam, Fresnel reflection, and simple refraction. For large open oceans with advanced wave displacement, buoyancy, shore interaction, and LOD, Shader Graph often needs help from Custom Function nodes, scripts, render textures, or a dedicated ocean system. - Should I use URP or HDRP for a Unity ocean shader?
Use URP when performance, platform reach, mobile support, VR, or stylized rendering matters. URP is flexible and works well for custom Shader Graph water, but many advanced water features require custom setup. Use HDRP when the goal is high-end realism, cinematic lighting, advanced reflections, water system features, caustics, underwater rendering, and physically richer material controls. - Why does my Unity water shader look flat?
A water shader often looks flat when it lacks normal variation, reflection, depth color, and foam. Add two scrolling normal maps, a Fresnel reflection boost, depth-based shallow and deep color, and intersection foam. If the horizon silhouette is flat, add vertex displacement or Gerstner waves so the surface shape changes, not just the lighting. - Why is Scene Depth not working in my URP water shader?
In URP, the depth texture must be enabled in the URP asset for the Scene Depth node to work correctly. Unity’s Shader Graph documentation states that if the URP depth texture is not enabled, the Scene Depth node returns a default value instead of useful scene depth. Also make sure the objects you want to detect are opaque and rendered into the depth texture. - How do I make shoreline foam in Unity Shader Graph?
Use Screen Position and Scene Depth to calculate the distance between the water surface and the opaque geometry behind it. Create a mask where that distance is small, distort it with noise, animate the noise slowly, and blend foam color into the water while reducing smoothness and increasing opacity. This creates a foam band where the ocean intersects beaches, rocks, piers, or terrain. - How do I make ocean waves move in Unity?
For simple motion, scroll normal maps and vertex sine waves over time. For more realistic motion, use Gerstner waves with direction, wavelength, amplitude, steepness, and speed. Combine several waves with different parameters, then add smaller normal-map ripples for surface detail. The displaced mesh creates the larger ocean shape, while the normals create smaller lighting movement. - How do I add refraction to a Unity ocean shader?
In URP Shader Graph, enable Opaque Texture, sample Scene Color with screen-space UVs, and offset those UVs using the water normal. Keep the distortion subtle and reduce it in foam or deep water. In HDRP, use the water system or transparent refraction features built into the pipeline. Refraction works best when it is paired with depth color and not used as a strong distortion effect everywhere. - Why does my transparent water render incorrectly with other transparent objects?
Transparent objects render after opaque objects and can have sorting limitations. Water is especially likely to show this because it covers a large screen area. Use fewer overlapping transparent materials, adjust render queues, use separate layers, or implement a custom render feature if the project needs complex transparent refraction. Testing early is important because transparent sorting issues can be difficult to solve late in production. - What is the fastest realistic water setup for games?
The fastest convincing setup uses a transparent shader with depth-based color, one or two scrolling normal maps, simple Fresnel reflection, optional depth foam, and no planar reflection. Add Gerstner waves, caustics, and high-quality refraction only for higher quality settings or stronger hardware. This gives the water readable movement and depth while keeping the shader affordable for real-time gameplay.

Conclusion
A strong Ocean Shader Unity workflow is built from layered visual signals. Color communicates depth. Transparency reveals shallow water. Reflection connects the ocean to the sky. Refraction bends the world beneath the surface. Normals create small ripples. Gerstner waves create large motion. Foam explains collision, shorelines, and breaking waves. Caustics sell shallow sunlight. Optimization keeps the result usable in a real game.
URP and HDRP both support excellent ocean results, but they serve different production goals. URP is flexible, scalable, and ideal for custom Shader Graph water across many platforms. HDRP provides a more complete high-end water foundation through its built-in water system, Water Shader Graph, foam, caustics, refraction, scattering, and underwater features. For teams that need production-ready ocean behavior, assets such as Crest or KWS can reduce development time. For teams that need a unique style, a custom Shader Graph remains the most controllable solution.
The most reliable path is to build the shader in stages. Start with water color and transparency. Add depth fade. Add scrolling normals. Add refraction and Fresnel reflection. Add foam. Add waves. Add caustics. Then optimize. This staged approach prevents the ocean shader from becoming an unmanageable graph and makes every feature easier to test, profile, and improve.
Sources and Citations
- Unity Shader Graph Documentation
https://docs.unity3d.com/Packages/com.unity.shadergraph@latest - Unity Shader Graph Scene Color Node Documentation
https://docs.unity.cn/Packages/com.unity.shadergraph@17.0/manual/Scene-Color-Node.html - Unity Shader Graph Scene Depth Node Documentation
https://docs.unity.cn/Packages/com.unity.shadergraph@8.3/manual/Scene-Depth-Node.html - Unity Universal Render Pipeline Documentation
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest - Unity HDRP Water System Documentation
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/manual/WaterSystem.html - Unity HDRP Water System Blog
https://unity.com/blog/engine-platform/new-hdrp-water-system-in-2022-lts-and-2023-1 - NVIDIA GPU Gems – Effective Water Simulation from Physical Models
https://developer.nvidia.com/gpugems/gpugems/part-i-natural-effects/chapter-1-effective-water-simulation-physical-models - Catlike Coding – Waves (Flow) Tutorial
https://catlikecoding.com/unity/tutorials/flow/waves/ - Crest Ocean System Documentation
https://docs.crest.waveharmonic.com/About/Introduction.html - Unity Asset Store – Crest Water
https://assetstore.unity.com/packages/tools/particles-effects/crest-water-5-oceans-rivers-lakes-268614
Recommendations
- Coffee Talk Tokyo Everything We Know so Far
- Beast of Reincarnation Release Date Announced: Community Reaction & Everything We Know from Sony’s State of Play
- Assassin’s Creed TV Show: Here’s Who Will Star In And Direct (Netflix Cast & Director Update)
- Electronic Arts Was Fined 2 Million Rubles in Russia: What the Moscow Court Decision Means
- How Capcom Brought Mega Man Star Force to Modern Platforms With Mega Man Star Force Legacy Collection
- My Adventures with Superman Season 3 Review: Reign of the Supermen, Supergirl’s Rise, and DC’s Most Ambitious Animated Chapter Yet
- Lego Batman: Legacy of the Dark Knight, Complete Batsuit and Outfit Guide (All Suits & Unlock Methods Explained)
- The Best Way to Render Hair Without Excessive Noise
- All Active Pokémon Champions Mystery Gift Codes and Rewards
- A Lego PlayStation Is Coming This Year, Report Claims: PS1 Set Leak, Price, Piece Count, and Release Date













































































































