nfsWaterSurface: Customization Guide and Parameters ExplainednfsWaterSurface is a shader/system used to simulate realistic water surfaces in real-time rendering engines. This guide explains common parameters, how they interact, and practical tips for customizing the look and performance of nfsWaterSurface. It’s written for graphics programmers, technical artists, and advanced hobbyists who need both conceptual understanding and actionable tuning advice.
Overview and rendering model
nfsWaterSurface typically combines several layers and techniques:
- Base reflection/refraction using environment probes or screen-space techniques.
- Normal-map-based wave detail for small-scale surface perturbation.
- Gerstner or FFT-based wave systems for larger waveforms and choppiness.
- Fresnel term and Schlick approximation for angle-dependent reflectivity.
- Foam and shoreline blending using depth or noise masks.
- Specular highlights driven by light direction and roughness.
Understanding how these elements blend is crucial: large waves provide silhouette and displacement, normals add microdetail and shading variation, and Fresnel + roughness control perceived wetness and reflectivity.
Common parameters and what they do
Below are typical parameters exposed by nfsWaterSurface, grouped by effect. Exact names may differ by implementation.
Surface shape and motion
- Wave Type: Choose between Gerstner, FFT, or texture-driven waves.
- Wave Amplitude: Controls vertical displacement magnitude; larger values produce taller waves.
- Wave Frequency / Wavelength: Determines wave density; lower frequency = longer waves.
- Wave Speed: Controls horizontal propagation speed; higher values make waves travel faster.
- Direction: Primary wave travel direction (vector or angle); can accept multiple layers with different directions for complexity.
- Choppiness: Sharpens wave crests by skewing displacement, producing steeper, more aggressive shapes.
Normals and microdetail
- Normal Map Strength: Scales contribution of normal maps to lighting; higher values increase apparent small-scale roughness.
- Tiling / Scale: Controls UV repetition of normal/detail textures; affects perceived scale of ripples.
- Detail Normal Map: Secondary normal for very fine surface detail (foam ripples, small wind ripples).
Reflection & refraction
- Reflection Mode: Options include Probe-based (cubemap), Screen-space reflection (SSR), or hybrid.
- Reflection Strength / Intensity: Controls how reflective the surface appears; tied to Fresnel and roughness.
- Refraction Strength: Controls distortion and clarity of objects seen through water.
- IOR (Index of Refraction): Affects Fresnel and bending of refracted rays; typical water IOR ≈ 1.333.
- Absorption / Attenuation: Controls how color and visibility fall off with depth; higher absorption makes water look murkier.
Shading & lighting
- Base Color / Albedo: Underwater tint or base color applied under refraction.
- Roughness / Glossiness: Controls specular spread; low roughness = sharp highlights, high roughness = matte water.
- Specular Intensity: Scales specular contribution from light sources.
- Fresnel Bias / Power: Tweaks the Fresnel falloff curve; useful to match artistic direction.
Foam and shoreline
- Foam Texture: Mask texture for foam patterns.
- Foam Threshold: Controls where foam appears based on depth/curvature.
- Foam Intensity / Opacity: How visible foam is.
- Shoreline Blend Distance: Gradient used to blend foam at shorelines or shallow areas.
Performance & blending
- LOD Distance: Distance at which simplified representations are used.
- Tessellation / Displacement Level: Controls geometry subdivision for true displacement (if supported).
- Update Frequency: How often wave simulation or FFT updates (per-frame or lower rate).
- Blend Mode: Opaque, Transparent, Additive — affects sorting and blending with other objects.
Post-process and extra effects
- Caustics Strength: Intensity of light patterns on seabed.
- Collision / Interaction Masks: For objects to leave wakes, ripples, or foam.
- Wind Influence: A parameter that ties global wind to wave amplitude/direction.
Practical tuning workflows
- Start from distance to camera:
- For large scenes, set strong LODs: distant water uses simple normals + cubemap reflection; close water uses detailed normals, SSR, and displacement.
- Block out silhouette with large waves:
- Increase amplitude and lower frequency to define the horizon. Use multiple Gerstner layers with different directions to avoid repetitive patterns.
- Add microdetail:
- Overlay a detail normal map with high-frequency tiling and moderate strength to catch highlights.
- Set Fresnel and roughness:
- Use IOR ≈ 1.333 as baseline. Lower roughness near calm water for sharper reflections, increase with wind/choppiness.
- Control foam and shorelines:
- Use depth maps and curvature to drive foam thresholds. Make foam subtle in open water and stronger near shallow, breaking areas.
- Balance performance:
- Disable SSR beyond a certain distance or use temporal accumulation. Reduce tessellation/displacement frequency for far objects.
Examples and presets
Calm lake (preset)
- Wave Type: Gerstner, 2 layers
- Amplitude: 0.02–0.05 units
- Wavelength: High (long waves)
- Normal Strength: 0.6
- Roughness: 0.12 (low)
- IOR: 1.333
- Foam: Minimal, opacity 0.1
Windy ocean (preset)
- Wave Type: Gerstner + FFT hybrid
- Amplitude: 0.3–1.2 units (layered)
- Wavelength: Mixed (long swell + short chop)
- Choppiness: 0.7–1.0
- Normal Strength: 1.0
- Roughness: 0.25–0.5
- Foam: Strong at crests and shore, threshold tuned by curvature
Shallow coastal (preset)
- Wave Type: Texture-driven for shoreline plus Gerstner far out
- Absorption: High (more colored)
- Foam Threshold: Low (foam appears earlier)
- Shoreline Blend Distance: 2–6 meters
Troubleshooting common issues
Reflections too weak
- Check Fresnel and IOR settings; increase reflection intensity or lower roughness. If using SSR, ensure depth buffer precision and thickness-aware normals.
Water looks flat
- Increase normal map strength, add a detail normal, or enable small-scale waves. Use multiple wave layers with varying wavelengths.
Popping or seams at LOD transitions
- Smooth LOD fade using blended normal and height transitions; avoid hard tessellation cutoffs.
Foam appears in wrong places
- Ensure foam uses correct world-space depth/curvature calculations; verify UVs if foam is texture-driven.
Performance problems
- Lower SSR quality or disable it for distant LODs, reduce tessellation, limit FFT resolution, or precompute wave data.
Implementation tips
- Use multiple wave layers (3–5) with different amplitudes, wavelengths, speeds, and directions for natural-looking water.
- Combine screen-space reflections with cubemaps: SSR for close detail, cubemap for distant skyline. Blend based on view distance and grazing angle.
- Drive foam and splashes with curvature and depth, not just normal maps — curvature captures breaking crests better.
- Use temporal reprojection for animated normal maps and FFT outputs to reduce visible aliasing and noise while saving performance.
- When possible, animate parameters (wind, choppiness, color) with weather systems to keep water believable across environments.
Quick reference table
Parameter Category | Key Parameters (examples) | Effect |
---|---|---|
Shape | Amplitude, Wavelength, Speed, Direction, Choppiness | Controls macro shape and movement |
Detail | Normal Strength, Detail Tiling | Micro-surface shading variation |
Optical | IOR, Roughness, Reflection/Refraction Strength | Defines reflectivity and clarity |
Foam/Coast | Foam Threshold, Shoreline Blend | Where and how foam appears |
Performance | LOD Distance, Tessellation Level, Update Frequency | Affects runtime cost |
Final notes
Tune parameters iteratively and evaluate at several distances and lighting conditions (sunny, overcast, night). Save presets for common water types and expose only artist-friendly sliders where possible. Well-balanced water is a mix of physically plausible defaults (IOR, Fresnel) and artistic controls (foam intensity, color tint).
If you want, I can produce a ready-to-use shader parameter panel layout, sample presets for a specific engine (Unity/Unreal/Custom GLSL), or a compact checklist for optimization.