Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(w3ddevice): reveal shallow scenery in modern water
Richard Louie Orilla5d8a58e7e527
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ab624bfe8..e7407199f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@ found and fixed, EA's own, not port damage.**## Modern water reflections and detail+- On Linux and macOS, shallow Modern water now shows submerged ruins and seabed more clearly, while deep water keeps its opacity.- On Linux and macOS, Modern water now offers Legacy, SSR and Hybrid reflections. Hybrid combines reflected scenery with visible screen detail, including coloured banks and ordinary models, while keeping cursors and order markers out of the water.- A Water tab adds scene reflections, wave detail, refraction and planar reflection detail controls. The quality slider adjusts these together, and saved choices survive switching back to Classic. Classic remains the default water style.diff --git a/GeneralsMD/Code/Data/INI/ModernWater.ini b/GeneralsMD/Code/Data/INI/ModernWater.iniindex 5b516d5f0..aaa1d875b 100644--- a/GeneralsMD/Code/Data/INI/ModernWater.ini+++ b/GeneralsMD/Code/Data/INI/ModernWater.ini@@ -2,9 +2,10 @@; A rule matches ANY listed color AND ANY listed texture (case-insensitive basename).; Add Color and Texture entries to extend the lists. First matching enabled rule wins.; Keep separate rules when only specific color/texture pairs should match.-; ReplacementColor is display RGB, Brightness is 0.1..1, Pollution is 0..1.+; ReplacementColor is display RGB, Brightness is 0.1..1, Pollution/UnderwaterClarity are 0..1.+; UnderwaterClarity defaults to 0 and reduces authored absorption on shallow shelves.; Optional fields default to Brightness=1, Pollution=0, Bubbles=No, Enabled=Yes.-; Missing/invalid file uses this built-in default; invalid files log the error line.+; Missing/invalid file uses these built-in defaults; invalid files log the error line.; An empty/comment-only file disables every rule. Enabled=No disables one rule.; This file is read only: the game never regenerates or overwrites custom edits.@@ -22,3 +23,17 @@ ModernWaterRule PollutedWaterPollution = 0.80Bubbles = YesEnd++; Clear water exposes shallow, raised seabed details while flat offshore floors retain depth fog.+ModernWaterRule ClearWater+ MatchColors+ Color = R:255 G:255 B:255+ End++ MatchTextures+ Texture = TWWater01.tga+ End++ ReplacementColor = R:255 G:255 B:255+ UnderwaterClarity = 0.90+Enddiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Water.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Water.hindex 0a83579f9..e5b1514b8 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Water.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Water.h@@ -128,7 +128,7 @@ extern OVERRIDE<WaterTransparencySetting> TheWaterTransparency;// Render-only material rules. The map's legacy settings remain owned by Classic water.void loadModernWaterSettings();-void getModernWaterMaterial(Real color[4], Real parameters[4]);+void getModernWaterMaterial(Real color[4], Real parameters[4], Real optics[4] = NULL);#endif // __WATER_H_diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cppindex 83593ff4c..9aa4a271e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Water.cpp@@ -81,7 +81,7 @@ void loadModernWaterSettings()}}-void getModernWaterMaterial(Real color[4], Real parameters[4])+void getModernWaterMaterial(Real color[4], Real parameters[4], Real optics[4]){ModernWaterSettings &settings = modernWaterSettings();const RGBColor &authored = TheWaterTransparency->m_standingWaterColor;@@ -107,6 +107,10 @@ void getModernWaterMaterial(Real color[4], Real parameters[4])parameters[1] = material.pollution;parameters[2] = material.bubbles ? 1.0f : 0.0f;parameters[3] = 0.0f;+ if (optics) {+ optics[0] = material.underwaterClarity;+ optics[1] = optics[2] = optics[3] = 0.0f;+ }}// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////diff --git a/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/PosixDevice9Draw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/PosixDevice9Draw.cppindex 9a6ef7ad8..47582f5b6 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/PosixDevice9Draw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/PosixDevice9Draw.cpp@@ -568,6 +568,7 @@ void PosixDevice9::Build_Water_Constants(const SdlPixelConstants &pixel_constantmemcpy(water.FoamFillLights, PixelShaderConstants[90], sizeof(water.FoamFillLights));memcpy(water.MaterialColor, PixelShaderConstants[ModernWaterMaterial::RegisterColor], sizeof(water.MaterialColor));memcpy(water.MaterialParameters, PixelShaderConstants[ModernWaterMaterial::RegisterParameters], sizeof(water.MaterialParameters));+ memcpy(water.MaterialOptics, PixelShaderConstants[ModernWaterMaterial::RegisterOptics], sizeof(water.MaterialOptics));if (Water_Foam_History_Available()) {memcpy(water.FoamHistoryArea, PixelShaderConstants[88], sizeof(water.FoamHistoryArea));memcpy(water.FoamHistoryParameters, PixelShaderConstants[89], sizeof(water.FoamHistoryParameters));diff --git a/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/SdlConstants.h b/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/SdlConstants.hindex 470758b4d..0f338ecce 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/SdlConstants.h+++ b/GeneralsMD/Code/GameEngineDevice/Source/PosixDevice/Render/SdlConstants.h@@ -100,9 +100,10 @@ struct SdlWaterPixelConstants#define MODERN_WATER_CPP_UNIFORM(name) float name[4];MODERN_WATER_MATERIAL_UNIFORMS(MODERN_WATER_CPP_UNIFORM)#undef MODERN_WATER_CPP_UNIFORM+ float MaterialOptics[4];float ClipFromWorld[16]; // inverse of depth-range-adjusted WorldFromClip for SSR};-static_assert(sizeof(SdlWaterPixelConstants) == (WaterHullVisualLayout::VertexCommonRegisters + 4) * 16, "water uniform packing");+static_assert(sizeof(SdlWaterPixelConstants) == (WaterHullVisualLayout::VertexCommonRegisters + 5) * 16, "water uniform packing");static_assert(offsetof(SdlWaterPixelConstants,MaterialColor)==184*16&& offsetof(SdlWaterPixelConstants,MaterialParameters)==185*16,"water material tail packing");@@ -112,7 +113,7 @@ struct SdlWaterVisualPixelConstantsSdlWaterPixelConstants Water;float VisualHullMeta[WaterHullVisualLayout::MaxHulls][4];};-static_assert(sizeof(SdlWaterVisualPixelConstants)==(WaterHullVisualLayout::FragmentCommonRegisters + 4)*16,+static_assert(sizeof(SdlWaterVisualPixelConstants)==(WaterHullVisualLayout::FragmentCommonRegisters + 5)*16,"fragment hull metadata packing");// A generator adding a block must have an explicit recording/binding path. The mesh packetdiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cppindex 8ed945ae3..7a2354861 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp@@ -1192,12 +1192,14 @@ void WaterRenderObjClass::setupModernWaterShader(Bool river, Bool heightCorrecticonst D3DXVECTOR4 optics(TheWaterTransparency->m_transparentWaterDepth,TheWaterTransparency->m_minWaterOpacity, optical ? 1.0f : 0.0f, heightCorrection && !river ? 1.0f : 0.0f);setModernWaterConstants(6, optics, 1);- D3DXVECTOR4 materialColor, materialParameters;- getModernWaterMaterial(&materialColor.x, &materialParameters.x);+ D3DXVECTOR4 materialColor, materialParameters, materialOptics;+ getModernWaterMaterial(&materialColor.x, &materialParameters.x, &materialOptics.x);if (WaterScreenReflection::Supported())materialParameters.w = WaterScreenReflection::Traces(m_waterReflectionMode) ? 1.0f : 0.0f;setModernWaterConstants(ModernWaterMaterial::RegisterColor, materialColor, 1);setModernWaterConstants(ModernWaterMaterial::RegisterParameters, materialParameters, 1);+ if (WaterScreenReflection::Supported())+ setModernWaterConstants(ModernWaterMaterial::RegisterOptics, materialOptics, 1);const RGBColor &ambient = TheGlobalData->m_terrainAmbient[0];const D3DXVECTOR4 hullParameters(river ? 0.0f : float(m_modernHulls.size()), ambient.red, ambient.green, ambient.blue);setModernWaterConstants(7, hullParameters, 1);diff --git a/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterConfig.h b/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterConfig.hindex 0a775276d..9a1982596 100644--- a/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterConfig.h+++ b/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterConfig.h@@ -20,6 +20,7 @@ struct Rule {Color replacement = {255, 255, 255};float brightness = 1.0f;float pollution = 0.0f;+ float underwaterClarity = 0.0f;bool bubbles = false;bool enabled = true;};@@ -34,7 +35,14 @@ inline Rules Defaults() {rule.brightness = 0.67f;rule.pollution = 0.80f;rule.bubbles = true;- return Rules(1, rule);+ Rules rules(1, rule);+ Rule clear;+ clear.name = "ClearWater";+ clear.colors.push_back(Color{255, 255, 255});+ clear.textures.push_back("TWWater01.tga");+ clear.underwaterClarity = 0.90f;+ rules.push_back(clear);+ return rules;}// Authored RGB values are stored by the engine as normalized floats. Round once@@ -121,6 +129,7 @@ struct Material {Color color = {255, 255, 255};float brightness = 1.0f;float pollution = 0.0f;+ float underwaterClarity = 0.0f;float tintAmount = 0.0f;bool bubbles = false;std::string ruleName;@@ -137,7 +146,9 @@ inline Material Resolve(const Rules &rules, Color mapColor, const std::string &mmaterial.color = rule->replacement;material.brightness = rule->brightness;material.pollution = rule->pollution;- material.tintAmount = 1.0f;+ material.underwaterClarity = rule->underwaterClarity;+ material.tintAmount = rule->underwaterClarity > 0.0f && rule->replacement == Color{255, 255, 255}+ && rule->brightness == 1.0f ? 0.0f : 1.0f;material.bubbles = rule->bubbles;material.ruleName = rule->name;}@@ -151,7 +162,7 @@ inline Material Resolve(const Rules &rules, Color mapColor, const std::string &minline bool Parse(const std::string &text, Rules &result, std::string &error) {enum Section { Outside, InRule, InColors, InTextures } section = Outside;enum Field { Colors = 1, Textures = 2, Replacement = 4, Brightness = 8,- Pollution = 16, Bubbles = 32, Enabled = 64 };+ Pollution = 16, Bubbles = 32, Enabled = 64, UnderwaterClarity = 128 };Rules parsed;Rule current;unsigned fields = 0;@@ -223,6 +234,7 @@ inline bool Parse(const std::string &text, Rules &result, std::string &error) {if (key == "replacementcolor") { field = Replacement; valid = Detail::ReadColor(value, current.replacement); }else if (key == "brightness") { field = Brightness; valid = Detail::ReadUnit(value, 0.1f, current.brightness); }else if (key == "pollution") { field = Pollution; valid = Detail::ReadUnit(value, 0.0f, current.pollution); }+ else if (key == "underwaterclarity") { field = UnderwaterClarity; valid = Detail::ReadUnit(value, 0.0f, current.underwaterClarity); }else if (key == "bubbles") { field = Bubbles; valid = Detail::ReadBool(value, current.bubbles); }else if (key == "enabled") { field = Enabled; valid = Detail::ReadBool(value, current.enabled); }else return Detail::Fail(error, lineNumber, "unknown field '" + key + "'");diff --git a/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterMaterial.h b/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterMaterial.hindex b297ab190..ddf3b9711 100644--- a/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterMaterial.h+++ b/GeneralsMD/Code/Libraries/Include/Platform/ModernWaterMaterial.h@@ -7,7 +7,7 @@#define MODERN_WATER_MATERIAL_UNIFORMS(X) X(MaterialColor) X(MaterialParameters)namespace ModernWaterMaterial {-enum : unsigned { RegisterColor=94, RegisterParameters=95, UniformRegisters=2 };+enum : unsigned { RegisterColor=94, RegisterParameters=95, RegisterOptics=190, UniformRegisters=2 };// c94: display-space RGB, brightness. c95: tint amount, pollution amount, bubbles, reserved.// A zero parameter vector preserves the existing clear-water material exactly.inline const char *OpticalSource() {diff --git a/GeneralsMD/Code/Libraries/Include/Platform/WaterFftSampling.h b/GeneralsMD/Code/Libraries/Include/Platform/WaterFftSampling.hindex fbafa7f62..cee320dfe 100644--- a/GeneralsMD/Code/Libraries/Include/Platform/WaterFftSampling.h+++ b/GeneralsMD/Code/Libraries/Include/Platform/WaterFftSampling.h@@ -44,7 +44,7 @@ inline std::string UniformSource(const char *name,unsigned slot,bool visual_hull#define MODERN_WATER_HLSL_UNIFORM(name) " float4 " #name ";\n"source+=MODERN_WATER_MATERIAL_UNIFORMS(MODERN_WATER_HLSL_UNIFORM);#undef MODERN_WATER_HLSL_UNIFORM- if(sdl) source+=" row_major float4x4 ClipFromWorld;\n";+ if(sdl) source+=" float4 MaterialOptics;\n row_major float4x4 ClipFromWorld;\n";if(visual_hull) source+=" float4 VisualHullMeta[8];\n";source+="};\n";if(visual_hull) source+=R"HLSL(diff --git a/GeneralsMD/Code/Libraries/Include/Platform/WaterOpticalModel.h b/GeneralsMD/Code/Libraries/Include/Platform/WaterOpticalModel.hindex 44c7ee368..3563fb9b5 100644--- a/GeneralsMD/Code/Libraries/Include/Platform/WaterOpticalModel.h+++ b/GeneralsMD/Code/Libraries/Include/Platform/WaterOpticalModel.h@@ -5,6 +5,7 @@// Keep the existing shallow-water spectrum and its standing-water path scale in one definition.#define WATER_OPTICAL_CONSTANTS(X) X(0.065f, 0.026f, 0.019f, 2.4f, 0.25f, 0.01f, 80.0f, 1.0e20f)+#define WATER_OPTICAL_CLARITY_CONSTANTS(X) X(2.5f, 5.5f, 0.5f, 1.5f)#define WATER_OPTICAL_RAY_CONSTANTS(X) X(0.2f, 0.08f, 2.0f)// Clear/coastal and river retain their current source; ocean retains the current FFT endpoint.@@ -24,6 +25,12 @@ WATER_OPTICAL_CONSTANTS(WATER_OPTICAL_CPP_CONSTANTS)WATER_OPTICAL_RAY_CONSTANTS(WATER_OPTICAL_RAY_CPP_CONSTANTS)#undef WATER_OPTICAL_RAY_CPP_CONSTANTS+#define WATER_OPTICAL_CLARITY_CPP_CONSTANTS(shallow,deep,reliefStart,reliefFull) \+ constexpr float ClarityShallowDepth=shallow,ClarityMaximumDepth=deep; \+ constexpr float ClarityReliefStart=reliefStart,ClarityReliefFull=reliefFull;+WATER_OPTICAL_CLARITY_CONSTANTS(WATER_OPTICAL_CLARITY_CPP_CONSTANTS)+#undef WATER_OPTICAL_CLARITY_CPP_CONSTANTS+// Comparisons also define a deterministic NaN/Infinity policy in both languages: NaN and negative// path/weights become zero, positive infinity saturates, and invalid reference depth uses 0.25.inline float Unit(float value) { return value>=0.0f?(std::min)(value,1.0f):0.0f; }@@ -31,6 +38,20 @@ inline float Path(float value) { return value>=0.0f?(std::min)(value,MaximumFiniinline float ReferenceDepth(float value) {return value>=MinimumReferenceDepth?(std::min)(value,MaximumFiniteInput):MinimumReferenceDepth;}+// Only terrain depths classify a shallow shelf. A ship hull or submerged object+// can shorten the optical ray without turning a broad offshore basin into clear water.+// The caller supplies the deepest nearby wet terrain at the same water level.+// Eligibility scales only authored-opacity relaxation; natural extinction stays intact.+inline float ClarityEligibility(float terrainDepth,float surroundingDepth,float offshore) {+ if (!(std::abs(terrainDepth)<=MaximumFiniteInput) || !(std::abs(surroundingDepth)<=MaximumFiniteInput)+ || !(std::abs(offshore)<=MaximumFiniteInput)) return 0.0f;+ const float depth=Unit(((std::max)(terrainDepth,0.0f)-ClarityShallowDepth)/(ClarityMaximumDepth-ClarityShallowDepth));+ const float relief=Unit(((std::max)(surroundingDepth-terrainDepth,0.0f)-ClarityReliefStart)+ /(ClarityReliefFull-ClarityReliefStart));+ const float depthWeight=1.0f-depth*depth*(3.0f-2.0f*depth);+ const float shelfWeight=relief*relief*(3.0f-2.0f*relief);+ return depthWeight*(1.0f+Unit(offshore)*(shelfWeight-1.0f));+}// Positive movement is toward the camera along its normalized view ray. A finer optical surface// may correct raster interpolation, but must never pass the actual scene hit or the camera. The// original raster surface is retained for clear water, below-surface views and invalid directions.@@ -49,12 +70,12 @@ inline float OffshoreExtinction(float transparentDepth,float minOpacity) {const float remaining=(std::max)(1.0f-Unit(minOpacity),MinimumReferenceTransmission);return -std::log(remaining)/ReferenceDepth(transparentDepth);}-inline Rgb Transmission(float path,float riverBlend,float offshoreFactor,float referenceDepth,float opacity) {+inline Rgb Transmission(float path,float riverBlend,float offshoreFactor,float referenceDepth,float opacity,float clarity=0.0f) {path=Path(path);const float materialPath=path*(StandingPathScale+(1.0f-StandingPathScale)*Unit(riverBlend));// Authored opacity describes extinction per physical world distance. Applying the legacy// standing-water multiplier to this term a second time would obscure shallow seas too much.- const float authored=path*Unit(offshoreFactor)*OffshoreExtinction(referenceDepth,opacity);+ const float authored=path*Unit(offshoreFactor)*(1.0f-Unit(clarity))*OffshoreExtinction(referenceDepth,opacity);return {std::exp(-(std::min)(materialPath*BaseExtinction.r+authored,MaximumExponent)),std::exp(-(std::min)(materialPath*BaseExtinction.g+authored,MaximumExponent)),std::exp(-(std::min)(materialPath*BaseExtinction.b+authored,MaximumExponent))};@@ -138,4 +159,24 @@ inline const char *GetHlslSource() {#undef WATER_OPTICAL_RAY_HLSL#undef WATER_OPTICAL_HLSL}+inline const char *GetClarityHlslSource() {+#define WATER_OPTICAL_CLARITY_HLSL(shallow,deep,reliefStart,reliefFull) \+ "static const float WaterOpticalClarityMaximumDepth=" #deep ";\n" \+ "float WaterOpticalClarityEligibility(float terrainDepth,float surroundingDepth,float offshore) {\n" \+ " if (!(abs(terrainDepth)<=WaterOpticalMaximumFiniteInput) || !(abs(surroundingDepth)<=WaterOpticalMaximumFiniteInput) || !(abs(offshore)<=WaterOpticalMaximumFiniteInput)) return 0.0;\n" \+ " float depth=WaterOpticalUnit((max(terrainDepth,0.0)-" #shallow ")/(" #deep "-" #shallow "));\n" \+ " float relief=WaterOpticalUnit((max(surroundingDepth-terrainDepth,0.0)-" #reliefStart ")/(" #reliefFull "-" #reliefStart "));\n" \+ " float depthWeight=1.0-depth*depth*(3.0-2.0*depth),shelfWeight=relief*relief*(3.0-2.0*relief);\n" \+ " return depthWeight*(1.0+WaterOpticalUnit(offshore)*(shelfWeight-1.0)); }\n"+#define WATER_OPTICAL_CLARITY_TRANSMISSION(red,green,blue,standing,minDepth,minTransmission,maxExponent,maxFinite) \+ "float3 WaterClarityTransmission(float path,float riverBlend,float offshoreFactor,float referenceDepth,float opacity,float clarity) {\n" \+ " path=WaterOpticalPath(path); float materialPath=path*(" #standing "+(1.0-" #standing ")*WaterOpticalUnit(riverBlend));\n" \+ " float authored=path*WaterOpticalUnit(offshoreFactor)*(1.0-WaterOpticalUnit(clarity))*WaterOpticalOffshoreExtinction(referenceDepth,opacity);\n" \+ " return exp(-min(materialPath*float3(" #red "," #green "," #blue ")+authored,float3(" #maxExponent "," #maxExponent "," #maxExponent "))); }\n"+ return WATER_OPTICAL_CLARITY_CONSTANTS(WATER_OPTICAL_CLARITY_HLSL)+ WATER_OPTICAL_CONSTANTS(WATER_OPTICAL_CLARITY_TRANSMISSION);+#undef WATER_OPTICAL_CLARITY_TRANSMISSION+#undef WATER_OPTICAL_CLARITY_HLSL+}+}diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/engineshader.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/engineshader.cppindex 177ee9d39..952a8f430 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/engineshader.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/engineshader.cpp@@ -912,6 +912,7 @@ float4 waterMirrorFiltered(float2 uv, int2 size)hlsl += WaterSurfaceModel::ShaderSource();hlsl += WaterSurfaceModel::OceanShaderSource();hlsl += WaterOpticalModel::GetHlslSource();+ if (sdl) hlsl += WaterOpticalModel::GetClarityHlslSource();hlsl += ModernWaterMaterial::OpticalSource();hlsl += ModernWaterMaterial::BubbleSource();hlsl += WaterHullModel::GetHlslSource();@@ -921,6 +922,35 @@ float4 waterMirrorFiltered(float2 uv, int2 size)snprintf(oceanBound, sizeof(oceanBound), "static const float oceanDisplacementBound = %.9g;\n",(double)WaterSurfaceModel::OceanMaxDisplacement);hlsl += oceanBound;+ if (sdl) hlsl += R"HLSL(+float waterTerrainClarity(float2 p,float baseLevel,float terrain,float offshore)+{+ float terrainDepth=max(baseLevel-terrain,0.0);+ // Campaign seas can use a flat, shallow floor even beneath full-size ships. Only+ // raised submerged shelves qualify offshore; hulls and scene hits cannot clear it.+ [branch] if(MaterialOptics.x<=0.0 || TerrainParameters.w<0.5+ || terrainDepth>=WaterOpticalClarityMaximumDepth) return 0.0;+ float surroundingDepth=terrainDepth;+ [branch] if(offshore>0.0) {+ static const float2 directions[8]={float2(1,0),float2(0.70710678,0.70710678),+ float2(0,1),float2(-0.70710678,0.70710678),float2(-1,0),+ float2(-0.70710678,-0.70710678),float2(0,-1),float2(0.70710678,-0.70710678)};+ [unroll] for(int i=0;i<8;++i) {+ float nearHeight=terrainHeight(p+directions[i]*80.0);+ // A dry bank interrupts the neighborhood; do not borrow lower terrain+ // from the far side of it. Fade across its edge to avoid a hard clarity+ // boundary. Both scales stay fixed in map coordinates.+ if(nearHeight<baseLevel) {+ surroundingDepth=max(surroundingDepth,baseLevel-nearHeight);+ float outerDepth=max(baseLevel-terrainHeight(p+directions[i]*160.0),terrainDepth);+ float wetSupport=smoothstep(0.0,0.75,baseLevel-nearHeight);+ surroundingDepth=max(surroundingDepth,lerp(terrainDepth,outerDepth,wetSupport));+ }+ }+ }+ return MaterialOptics.x*WaterOpticalClarityEligibility(terrainDepth,surroundingDepth,offshore);+}+)HLSL";hlsl += R"HLSL(float terrainWaveAttenuation(float depth, float offshore){@@ -1370,7 +1400,12 @@ float4 main(Input input) : SV_Target// Campaign seas can have deliberately flat, shallow terrain beneath full-size ships. Honour// their authored opacity offshore, while preserving the clear optical profile at coasts and// in enclosed pools. Actual scene ray length still governs submerged objects and refraction.- float3 transmission = WaterOpticalTransmission(length(bottom-opticalWorld), WaterParameters.y,+)HLSL";+ if (sdl) hlsl += R"HLSL( float terrainClarity=waterTerrainClarity(world.xy,baseLevel,surfaceTerrainHeight,offshore);+ float3 transmission = WaterClarityTransmission(length(bottom-opticalWorld), WaterParameters.y,+ offshore, OpticalParameters.x, OpticalParameters.y, terrainClarity);+)HLSL";+ else hlsl += R"HLSL( float3 transmission = WaterOpticalTransmission(length(bottom-opticalWorld), WaterParameters.y,offshore, OpticalParameters.x, OpticalParameters.y);)HLSL";if (sdl) hlsl += R"HLSL(#else@@ -1499,7 +1534,6 @@ float4 main(Input input) : SV_TargetfreshFoam/max(historyFoam.x,0.0001)));})HLSL";- hlsl += R"HLSL()HLSL";hlsl+=R"HLSL( // This is foam on the additional displaced bow shoulder, not mean-plane hull wash.// Its height already includes F-D; the unchanged opaque scene depth hides solid hulls.float liftedBowFoam=fftBowLiftFoam(bowLiftField.x,fftWeight);diff --git a/GeneralsMD/Code/Tests/test_map_ini_rollback.inc b/GeneralsMD/Code/Tests/test_map_ini_rollback.incindex d9e195200..22d7b986a 100644--- a/GeneralsMD/Code/Tests/test_map_ini_rollback.inc+++ b/GeneralsMD/Code/Tests/test_map_ini_rollback.inc@@ -389,10 +389,10 @@ struct WaterRuleFixture}};-void checkWaterMaterial(Real r, Real g, Real b, Real brightness, Real tint, Real pollution, Real bubbles)+void checkWaterMaterial(Real r, Real g, Real b, Real brightness, Real tint, Real pollution, Real bubbles, Real clarity = 0){- Real color[4], parameters[4];- getModernWaterMaterial(color, parameters);+ Real color[4], parameters[4], optics[4];+ getModernWaterMaterial(color, parameters, optics);CHECK_NEAR(color[0], r / 255.0f, .00001f);CHECK_NEAR(color[1], g / 255.0f, .00001f);CHECK_NEAR(color[2], b / 255.0f, .00001f);@@ -401,6 +401,10 @@ void checkWaterMaterial(Real r, Real g, Real b, Real brightness, Real tint, RealCHECK_NEAR(parameters[1], pollution, .00001f);CHECK_NEAR(parameters[2], bubbles, .00001f);CHECK_EQ(parameters[3], 0.0f);+ CHECK_NEAR(optics[0], clarity, .00001f);+ CHECK_EQ(optics[1], 0.0f);+ CHECK_EQ(optics[2], 0.0f);+ CHECK_EQ(optics[3], 0.0f);}}@@ -408,7 +412,7 @@ TEST(map_ini_modern_water_resolves_effective_override_without_changing_classic){CHECK(bootOnce());WaterRuleFixture fixture;- checkWaterMaterial(255, 255, 255, 1, 0, 0, 0);+ checkWaterMaterial(255, 255, 255, 1, 0, 0, 0, .90f);writeFile(TEST_INI,"WaterTransparency\n"" StandingWaterColor = R:50 G:75 B:50\n"@@ -440,7 +444,7 @@ TEST(map_ini_modern_water_resolves_effective_override_without_changing_classic)CHECK(loadMapIni(TEST_INI));checkWaterMaterial(50, 75, 50, 1, 1, 0, 0);fixture.resetMap();- checkWaterMaterial(255, 255, 255, 1, 0, 0, 0);+ checkWaterMaterial(255, 255, 255, 1, 0, 0, 0, .90f);writeFile(TEST_INI,"WaterTransparency\n"" StandingWaterColor = R:255 G:0 B:0\n"@@ -449,7 +453,7 @@ TEST(map_ini_modern_water_resolves_effective_override_without_changing_classic)CHECK(loadMapIni(TEST_INI));checkWaterMaterial(255, 0, 0, 1, 1, 0, 0);fixture.resetMap();- checkWaterMaterial(255, 255, 255, 1, 0, 0, 0);+ checkWaterMaterial(255, 255, 255, 1, 0, 0, 0, .90f);}TEST(map_ini_modern_water_config_reload_replaces_cache_and_falls_back_atomically)diff --git a/GeneralsMD/Code/Tests/test_modern_water_config.cpp b/GeneralsMD/Code/Tests/test_modern_water_config.cppindex 745868f3e..e64f98d0a 100644--- a/GeneralsMD/Code/Tests/test_modern_water_config.cpp+++ b/GeneralsMD/Code/Tests/test_modern_water_config.cpp@@ -33,8 +33,8 @@ std::string Changed(const std::string &before, const std::string &after) {}void CheckDefaults(const Rules &rules) {- CHECK_EQ(rules.size(), 1u);- if (rules.empty()) return;+ CHECK_EQ(rules.size(), 2u);+ if (rules.size() < 2) return;CHECK_STR(rules[0].name.c_str(), "PollutedWater");CHECK_EQ(rules[0].colors.size(), 1u);CHECK_EQ(rules[0].textures.size(), 1u);@@ -45,6 +45,11 @@ void CheckDefaults(const Rules &rules) {CHECK_NEAR(rules[0].pollution, .80f, 0.00001f);CHECK(rules[0].bubbles);CHECK(rules[0].enabled);+ CHECK_STR(rules[1].name.c_str(), "ClearWater");+ CHECK_NEAR(rules[1].underwaterClarity, .90f, .00001f);+ CHECK_EQ(rules[1].brightness, 1.0f);+ CHECK_EQ(rules[1].pollution, 0.0f);+ CHECK(!rules[1].bubbles);}}@@ -103,6 +108,10 @@ TEST(modern_water_bad_edits_preserve_previous_rules_and_report_line)Changed("G:75", "X:75"), Changed("B:50", "B:50 extra"),Changed("0.67", "nan"), Changed("0.67", "inf"), Changed("0.67", "0.09"),Changed("0.67", "1.01"), Changed("0.80", "-0.01"), Changed("0.80", "1.01"),+ Changed(" Bubbles = Yes", " UnderwaterClarity = -0.01"),+ Changed(" Bubbles = Yes", " UnderwaterClarity = 1.01"),+ Changed(" Bubbles = Yes", " UnderwaterClarity = nan"),+ Changed(" Bubbles = Yes", " UnderwaterClarity = 0.9\n UnderwaterClarity = 0.5"),Changed("0.80", "0.8junk"), Changed("Bubbles = Yes", "Bubbles = Maybe"),Changed("Bubbles = Yes", "Enabled = Maybe"), Changed("Bubbles = Yes", "Unknown = Yes"),Changed(" Bubbles = Yes", " Bubbles = Yes\n Bubbles = No"),@@ -185,6 +194,25 @@ TEST(modern_water_resolution_never_carries_pollution_to_next_map)}}+TEST(modern_water_clarity_defaults_match_and_reset)+{+ Rules rules = Defaults();+ Material clear = Resolve(rules, Color{255, 255, 255}, "TWWater01.tga");+ CHECK_NEAR(clear.underwaterClarity, .90f, .00001f);+ CHECK_EQ(clear.tintAmount, 0.0f);+ CHECK_EQ(clear.brightness, 1.0f);+ CHECK_EQ(clear.pollution, 0.0f);+ CHECK(!clear.bubbles);+ Material other = Resolve(rules, Color{255, 255, 255}, "Other.tga");+ CHECK_EQ(other.underwaterClarity, 0.0f);+ CHECK_EQ(other.tintAmount, 0.0f);+ std::string error;+ CHECK(Parse(Changed(" Bubbles = Yes", " UnderwaterClarity = 1"), rules, error));+ CHECK_EQ(rules[0].underwaterClarity, 1.0f);+ CHECK(Parse(Changed(" Bubbles = Yes", " UnderwaterClarity = 0"), rules, error));+ CHECK_EQ(rules[0].underwaterClarity, 0.0f);+}+TEST(modern_water_normalized_byte_colors_round_trip_exactly){for (int value = 0; value < 256; ++value) {diff --git a/GeneralsMD/Code/Tests/test_posix_draw_resolve.cpp b/GeneralsMD/Code/Tests/test_posix_draw_resolve.cppindex 7463f794a..c0a6fd589 100644--- a/GeneralsMD/Code/Tests/test_posix_draw_resolve.cpp+++ b/GeneralsMD/Code/Tests/test_posix_draw_resolve.cpp@@ -336,7 +336,7 @@ static void check_constants(PosixDevice9 *device)CHECK(memcmp(water.HullData,hull_registers[1],sizeof(water.HullData))==0);// The optional foam contour is a distinct tail, never a replacement for the mean hull used// by displacement. Exercise every register, including the twelfth vertex of hull eight.- CHECK(sizeof(water)==190*16 && offsetof(SdlWaterPixelConstants,ContactHullData)==100*16);+ CHECK(sizeof(water)==191*16 && offsetof(SdlWaterPixelConstants,ContactHullData)==100*16);float contact_registers[80][4]={};for(int r=0;r<80;++r)for(int c=0;c<4;++c)contact_registers[r][c]=-float(r*4+c)-0.75f;CHECK(device->SetPixelShaderConstantF(96,&contact_registers[0][0],80)==D3D_OK);@@ -359,7 +359,10 @@ static void check_constants(PosixDevice9 *device)// It must survive packing without borrowing light components, and clear on the next draw.const float material[2][4]={{45/255.0f,58/255.0f,11/255.0f,.67f},{1,.8f,1,0}};CHECK(device->SetPixelShaderConstantF(ModernWaterMaterial::RegisterColor,material[0],2)==D3D_OK);+ const float clarity[4]={.9f,0,0,0};+ CHECK(device->SetPixelShaderConstantF(ModernWaterMaterial::RegisterOptics,clarity,1)==D3D_OK);device->Build_Water_Constants(pixel,water);+ CHECK(memcmp(water.MaterialOptics,clarity,16)==0);CHECK(memcmp(water.MaterialColor,material[0],16)==0 && memcmp(water.MaterialParameters,material[1],16)==0);CHECK(memcmp(water.ContactHullData,contact_registers,sizeof(contact_registers))==0);CHECK(memcmp(water.FoamFillLights,fill_registers,sizeof(fill_registers))==0);@@ -375,7 +378,7 @@ static void check_constants(PosixDevice9 *device)// 186-register native vertex prefix or copying the reserved engine-register gap into metadata.using namespace WaterHullVisualLayout;CHECK(PosixDevice9::PIXEL_SHADER_CONSTANT_COUNT==896);- CHECK(sizeof(SdlWaterVisualPixelConstants)==198*16 && offsetof(SdlWaterVisualPixelConstants,VisualHullMeta)==190*16);+ CHECK(sizeof(SdlWaterVisualPixelConstants)==199*16 && offsetof(SdlWaterVisualPixelConstants,VisualHullMeta)==191*16);CHECK(VertexCommonRegisters==186 && FragmentCommonRegisters==194);CHECK(BlockOffset(0)==0 && BlockOffset(1)==256 && BlockOffset(2)==512);CHECK(BlockRegisters(0)==256 && BlockRegisters(1)==256 && BlockRegisters(2)==192);diff --git a/GeneralsMD/Code/Tests/test_sdl_gpu_frame.cpp b/GeneralsMD/Code/Tests/test_sdl_gpu_frame.cppindex 984fb0cab..d2f3afc5e 100644--- a/GeneralsMD/Code/Tests/test_sdl_gpu_frame.cpp+++ b/GeneralsMD/Code/Tests/test_sdl_gpu_frame.cpp@@ -914,7 +914,10 @@ static void check_gpu_water_optical_model(SdlGpuFrame *frame){-4, -1, -1, -1, -1, 0, 0, 0},{.5f, 2, 2, 0, 2, 0, 0, 0},{10, .5f, .5f, 2.7f, .75f, 0, 0, 0},- {1.0e20f, 0, 0, 1.0e20f, 0, 0, 0, 0}+ {1.0e20f, 0, 0, 1.0e20f, 0, 0, 0, 0},+ {3.2f, 0, 1, 3, 1, .9f, 0, 0},+ {3.2f, 0, 1, 3, 1, 1, 0, 0},+ {500, 0, 1, 3, 1, 1, 0, 0}};const unsigned int count = sizeof(fixtures) / sizeof(fixtures[0]);const char *vertex_source =@@ -923,9 +926,10 @@ static void check_gpu_water_optical_model(SdlGpuFrame *frame)std::string pixel_source = "cbuffer Samples : register(b0, space3) { float4 Fixtures[";pixel_source += std::to_string(count * 2) + "]; };\n";pixel_source += WaterOpticalModel::GetHlslSource();+ pixel_source += WaterOpticalModel::GetClarityHlslSource();pixel_source += "float main(float4 position : SV_Position) : SV_Target0 {\n""uint row=(uint)position.y; float4 f=Fixtures[row*2];\n"- "return WaterOpticalTransmission(f.x,f.y,f.z,f.w,Fixtures[row*2+1].x)[(uint)position.x]; }\n";+ "return WaterClarityTransmission(f.x,f.y,f.z,f.w,Fixtures[row*2+1].x,Fixtures[row*2+1].y)[(uint)position.x]; }\n";std::vector<unsigned char> spirv;std::string error;CHECK(SDL3_Compile_HLSL_To_SPIRV(vertex_source, true, spirv, error));@@ -971,7 +975,7 @@ static void check_gpu_water_optical_model(SdlGpuFrame *frame)float max_model_error = 0;for (unsigned int i=0; i<count; ++i) {const WaterOpticalModel::Rgb cpu=WaterOpticalModel::Transmission(- fixtures[i][0],fixtures[i][1],fixtures[i][2],fixtures[i][3],fixtures[i][4]);+ fixtures[i][0],fixtures[i][1],fixtures[i][2],fixtures[i][3],fixtures[i][4],fixtures[i][5]);const float expected[3]={cpu.r,cpu.g,cpu.b};for (unsigned int c=0; c<3; ++c) {const float gpu=depth_at(bytes,3,c,i),difference=fabsf(gpu-expected[c]);@@ -2227,7 +2231,7 @@ static void check_gpu_water_vertex_uniform_order(SdlGpuFrame *frame)const unsigned contactRegister=offsetof(SdlWaterPixelConstants,ContactHullData)/16;const unsigned lastContactRegister=contactRegister+79;const unsigned fillRegister=offsetof(SdlWaterPixelConstants,FoamFillLights)/16;- CHECK(contactRegister==100 && fillRegister==180 && sizeof(SdlWaterPixelConstants)==190*16);+ CHECK(contactRegister==100 && fillRegister==180 && sizeof(SdlWaterPixelConstants)==191*16);std::string block="cbuffer WaterBlock : register(b1,space1) { float4 Water[";block+=std::to_string(sizeof(SdlWaterPixelConstants)/16)+"]; };\n";const std::string output="struct Output { float4 Position:SV_Position; [[vk::location(0)]] float4 Value:TEXCOORD0; };\n";diff --git a/GeneralsMD/Code/Tests/test_shader_sdl.cpp b/GeneralsMD/Code/Tests/test_shader_sdl.cppindex 880cf09d5..7872d7f79 100644--- a/GeneralsMD/Code/Tests/test_shader_sdl.cpp+++ b/GeneralsMD/Code/Tests/test_shader_sdl.cpp@@ -405,6 +405,7 @@ const WaterUniformMember WaterUniformMembers[] = {WATER_UNIFORM_MEMBER(FoamFillLights),WATER_UNIFORM_MEMBER(MaterialColor),WATER_UNIFORM_MEMBER(MaterialParameters),+ WATER_UNIFORM_MEMBER(MaterialOptics),WATER_UNIFORM_MEMBER(ClipFromWorld)};#undef WATER_COMBINER_MEMBER@@ -985,6 +986,90 @@ TEST(water_optics_authored_offshore_examples_hide_bed_in_display_space)}}+TEST(water_material_clarity_restores_shallow_scenery_without_losing_depth_absorption)+{+ using namespace WaterOpticalModel;+ // SW's original floor is ~1.875 units below Z=5; the angled view has a longer ray.+ // Test material contrast, not just a coefficient: stonework must remain distinguishable.+ const Rgb opaque=Transmission(3.2f,0,1,3,1);+ const Rgb clear=Transmission(3.2f,0,1,3,1,.9f);+ const Rgb source=ScatteringSource(0,1,1,.5f);+ CHECK(displayedBedContrast(clear.g,source.g)>.45f);+ CHECK(displayedBedContrast(clear.g,source.g)>5*displayedBedContrast(opaque.g,source.g));+ for(float clarity:{0.f,.5f,.9f,1.f}) {+ Rgb previous=Transmission(0,0,1,3,1,clarity);+ for(float distance:{.25f,1.f,3.2f,10.f,50.f,500.f}) {+ const Rgb current=Transmission(distance,0,1,3,1,clarity);+ CHECK(current.r<=previous.r && current.g<=previous.g && current.b<=previous.b);+ previous=current;+ }+ CHECK(previous.b<1e-9f);+ }+ const Rgb natural=Transmission(12,0,0,3,1),maximum=Transmission(12,0,1,3,1,1);+ CHECK(memcmp(&natural,&maximum,sizeof(Rgb))==0);+ for(float invalid:{-1.f,std::numeric_limits<float>::quiet_NaN()}) {+ const Rgb unchanged=Transmission(3.2f,0,1,3,1,invalid);+ CHECK(memcmp(&opaque,&unchanged,sizeof(Rgb))==0);+ }+}++TEST(water_clarity_geography_preserves_shelves_but_rejects_flat_offshore_basins)+{+ using namespace WaterOpticalModel;+ // Terrain samples from the two ruins locations: a raised bed surrounded by+ // lower wet terrain. The central shelf is fully eligible; the southern ledge fades.+ CHECK_EQ(ClarityEligibility(1.875f,5.0f,1),1.0f);+ const float southern=ClarityEligibility(3.275f,5.0f,1);+ CHECK(southern>.8f && southern<.9f);+ CHECK_EQ(ClarityEligibility(1.875f,1.875f,1),0.0f); // uniformly shallow open sea+ CHECK_EQ(ClarityEligibility(1.875f,2.375f,1),0.0f); // tiny height noise is not a shelf+ CHECK_EQ(ClarityEligibility(1.875f,1.875f,0),1.0f); // enclosed/nearshore shallow pool+ CHECK_EQ(ClarityEligibility(1.875f,1.875f,.25f),.75f);+ for (float offshore:{0.f,.5f,1.f}) for (float terrainDepth:{ClarityMaximumDepth,6.f,7.f,50.f}) {+ CHECK_EQ(ClarityEligibility(terrainDepth,terrainDepth+.625f,offshore),0.0f);+ CHECK_EQ(ClarityEligibility(terrainDepth,terrainDepth+100.f,offshore),0.0f);+ }+ // A short ray may hit a hull in deep water. Classification still uses the+ // terrain underneath it, leaving authored opacity intact for every hit distance.+ const float basin=ClarityEligibility(6.375f,7.f,1);+ for (float sceneRay:{.1f,.5f,3.2f,10.f}) {+ const Rgb baseline=Transmission(sceneRay,0,1,3,1);+ const Rgb classified=Transmission(sceneRay,0,1,3,1,.9f*basin);+ CHECK(memcmp(&baseline,&classified,sizeof(Rgb))==0);+ }+ const float invalids[]={std::numeric_limits<float>::quiet_NaN(),std::numeric_limits<float>::infinity()};+ for (float invalid:invalids) {+ CHECK_EQ(ClarityEligibility(invalid,5,1),0.0f);+ CHECK_EQ(ClarityEligibility(2,invalid,1),0.0f);+ CHECK_EQ(ClarityEligibility(2,5,invalid),0.0f);+ }+}++TEST(water_clarity_geography_blends_continuously_across_depth_relief_and_offshore)+{+ using namespace WaterOpticalModel;+ float previousDepth=1,previousRelief=0,previousOffshore=1;+ for (int i=0;i<=400;++i) {+ const float t=i/400.f;+ const float depth=ClarityEligibility(2.5f+3*t,4.5f+3*t,1);+ const float relief=ClarityEligibility(2,2+.5f+t,1);+ const float offshore=ClarityEligibility(2,2,t);+ CHECK(depth>=0 && depth<=previousDepth && previousDepth-depth<.004f);+ CHECK(relief>=previousRelief && relief<=1 && relief-previousRelief<.004f);+ CHECK(offshore>=0 && offshore<=previousOffshore && previousOffshore-offshore<.004f);+ previousDepth=depth;previousRelief=relief;previousOffshore=offshore;+ }+ CHECK_EQ(previousDepth,0.0f);+ CHECK_EQ(previousRelief,1.0f);+ CHECK_EQ(previousOffshore,0.0f);+ // Moving either input through a threshold cannot introduce a visible step.+ const float epsilon=.0001f;+ for (float depth:{ClarityShallowDepth,ClarityMaximumDepth})+ CHECK_NEAR(ClarityEligibility(depth-epsilon,depth+2,1),ClarityEligibility(depth+epsilon,depth+2,1),.00001f);+ for (float relief:{ClarityReliefStart,ClarityReliefFull})+ CHECK_NEAR(ClarityEligibility(2,2+relief-epsilon,1),ClarityEligibility(2,2+relief+epsilon,1),.00001f);+}+TEST(water_optical_ray_correction_preserves_camera_rays_and_zero_offshore){using namespace WaterOpticalModel;@@ -1480,6 +1565,23 @@ TEST(screen_reflection_modes_are_bounded_and_selected_per_draw)CHECK(MirrorSize(Mirror, 0) == 256 && MirrorSize(Hybrid, 0) == 512);}+TEST(sdl_clarity_uses_only_terrain_and_skips_deep_samples)+{+ PixelPipelineDescription pipeline = {}; std::string source;+ CHECK(EngineShader_Pixel_Program(ENGINE_SHADER_WATER_TRAPEZOID, pipeline, source, COMBINER_SHADER_TARGET_SDL3_GPU));+ const size_t first=source.find("float waterTerrainClarity("), last=source.find("float terrainWaveAttenuation(", first);+ CHECK(first!=std::string::npos && last!=std::string::npos && last>first);+ if (first==std::string::npos || last==std::string::npos || last<=first) return;+ const std::string helper=source.substr(first,last-first);+ CHECK(helper.find("terrainDepth>=WaterOpticalClarityMaximumDepth) return 0.0")!=std::string::npos);+ CHECK(helper.find("directions[i]*80.0")!=std::string::npos);+ CHECK(helper.find("directions[i]*160.0")!=std::string::npos);+ CHECK(helper.find("if(nearHeight<baseLevel)")!=std::string::npos);+ CHECK(helper.find("vesselHullDamping(")==std::string::npos);+ CHECK(helper.find("scenePosition(")==std::string::npos);+ CHECK(source.find("waterTerrainClarity(world.xy,baseLevel,surfaceTerrainHeight,offshore)")!=std::string::npos);+}+TEST(direct3d11_modern_water_source_matches_the_upstream_baseline){// FNV-1a of the complete generated v3.8.0 source, captured independently from e3e1a898.