Skip to content

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.

fix(ww3d2): make own cloaked units readable at play zoom

Olcay Seygan2d2abcaab468
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a2fcfda2d..0244e7b7b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1460,7 +1460,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- Blasts throw fragments that smoke. Every explosion flings hot sparks into the air, each drawing a white line of smoke that arcs over and curves down. Where a shell, rocket or missile lands the spray opens back up the line it came in on, towards the gun that fired it, low for a tank shell and steeper for a diving rocket, so you can read where the fire came from. The bigger the blast, the higher and longer the fan: a Stinger or a rocket pod throws three short ones, a tank shell or a rocket four, a bomb, a heavy shell, a Scud or a building eight that climb several times a tank's length, and a nuke, a MOAB, a Daisy Cutter or a large building fourteen that arc over its own fireball and hang for nearly five seconds. A vehicle that blows up throws burning pieces that drag near-black smoke and bounce where they land, and the turret, wheels and plates it throws off trail smoke and flame too, then smoulder a moment on the ground. In a fight of seventeen tanks the screen held about 1400 particles where it held 890, peaking at 2159 of the 2500 limit; the fragments and their smoke are the first effects that limit and a lower detail setting drop, so a bigger fight keeps its explosions and loses some lines. What a weapon does is unchanged. Rather have the explosions as they always were? Explosion Debris Trails in the launcher's Options turns all of it off, for you alone: the other players in your match keep whatever they picked, and nobody's game falls out of step over it.
- A China mine field tells you what kind it is. EA's field had no model at all, only a soft white glint swelling and fading on each of its eight spots, so your own minefield looked like a patch of fireflies. Each mine is now marked by a small arming light that snaps on for a quarter of a second every second and a half, red on standard and cluster mines and blue on EMP mines, with a white-hot point and a dark rim that keep it readable on grass, sand or snow. No mine body is drawn on the ground, only the light. The enemy still sees nothing until he detects the field. A mine going off under a tank now throws a column of dark earth twice the tank's height, scatters clods round it and leaves a low black smoke and a scorch, with a short jolt of the screen; it used to puff a pale spray of specks that looked like dust kicked up. An EMP mine throws no earth, so you can tell which kind went off: it lights a blue ring across the ground, a crackle of blue sparks and a short blue flash at the spot; EA's flash grew until it washed the whole screen white for a fifth of a second. What a mine does is unchanged.
- A base out of power looks out of power. A building that switches off when your power runs short, or one a hacker shut down, drains to a cold grey and sags darker, and its windows and lamps go out. Every few seconds it blinks dark for an instant or its lights catch again for a moment, and blue sparks jump on its walls where something shorts. A tank or building hit by an EMP crawls with thin blue arcs for as long as it stays dead, where it used to just turn dark grey.
-- Your own stealthed units look like glass, not like ice. In 3.0 a camouflaged Rebel, a Pathfinder or Colonel Burton came out under a blue skin with bands running up it, which players rightly called ugly. The blue is gone: the ground behind him shows through his body in its own colours and bends, a slow lens that ripples along him and pulls harder at his outline, with only a hint of his own paint left in it. The bend is what you find him by: each face of him tips the ground behind it its own way, so his shape shows even on plain sand, and the bend never drops below a few pixels, and a faint cool haze that thickens at his outline keeps a cloaked soldier or building findable at the zoom you play at, without turning him white. Up close a building's flat wall bends across its face. It moves slowly and never fizzes. He never turns solid, and the 2003 breathing of the fade is still there. His shadow fades with him, to between a quarter and a half of its strength as he breathes, where it used to lie on the ground at full strength and give him away before his body did; on Classic and the old renderer the shadow stays whole. When an enemy detector has found him, his whole body beats amber along with his edge, so a spotted building reads as spotted and does not just turn tan. On every renderer, a stealthed unit of yours no longer comes out solid whenever no building is on the screen: the game drew it a second time without its see-through. An enemy stealth unit your detector finds used to turn into a flat orange shape with no paint; now it shows as heat, its own shading run from dark red through orange to a warm yellow that stops short of white, so you can still tell a tank from a soldier and bright GLA paint keeps its detail, with a burning outline and a slow glow climbing it that flares on every sweep of the detector. The fine scan lines of 3.0 are gone, since zoomed out they broke into stripes. This is the default renderer; Classic and the old renderer keep the 2003 look for all of these.
+- Your own stealthed units look like glass, not like ice. In 3.0 a camouflaged Rebel, a Pathfinder or Colonel Burton came out under a blue skin with bands running up it, which players rightly called ugly. The blue is gone: the ground behind him shows through his body in its own colours and bends, a slow lens that ripples along him and pulls harder at his outline, with a muted share of his own paint left in it. The bend is what you find him by: each face of him tips the ground behind it its own way, so his shape shows even on plain sand, and the bend never drops below a few pixels, and a cool haze that thickens at his outline makes a cloaked squad or a camouflaged base read at a glance at the zoom you play at, still as glass and without turning white. Up close a building's flat wall bends across its face. It moves slowly and never fizzes. He never turns solid, and the 2003 breathing of the fade is still there. His shadow fades with him, to between a quarter and a half of its strength as he breathes, where it used to lie on the ground at full strength and give him away before his body did; on Classic and the old renderer the shadow stays whole. When an enemy detector has found him, his whole body beats amber along with his edge, so a spotted building reads as spotted and does not just turn tan. On every renderer, a stealthed unit of yours no longer comes out solid whenever no building is on the screen: the game drew it a second time without its see-through. An enemy stealth unit your detector finds used to turn into a flat orange shape with no paint; now it shows as heat, its own shading run from dark red through orange to a warm yellow that stops short of white, so you can still tell a tank from a soldier and bright GLA paint keeps its detail, with a burning outline and a slow glow climbing it that flares on every sweep of the detector. The fine scan lines of 3.0 are gone, since zoomed out they broke into stripes. This is the default renderer; Classic and the old renderer keep the 2003 look for all of these.
- A hidden base no longer burns in plain view. The fire and smoke on a stealthed building or unit, damage flames and chimney smoke alike, kept drawing for the enemy while the building itself was invisible, so a burning Stealth General base under Camo Netting stood out as a column of black smoke on an empty patch of ground. The enemy now sees none of it until a detector finds the building, and then all of it. On your own side the flames and smoke go faint with the building and breathe with it, the fire a little stronger than the smoke, so they no longer sit at full strength beside the glass. This holds on every renderer, and the smoke's shadow and the light its fire throws on nearby smoke go with it.
- Effects fade out instead of blinking off. The rings a nuke sends across the ground, and any spark, flash or puff whose own colours never reached nothing, used to vanish at full strength on their last frame. Each one now dims away over its last quarter of a second, or over a quarter of its life when it lives shorter than that. One that was already fading looks the way it always did.
- Toxin, anthrax and radiation pools lie on the ground. A pool is a carpet of puddle pictures spread up to 140 paces from where the shell or the spray came down, and every one of them was drawn dead flat at the height of that one spot: on a hillside the uphill half of the pool disappeared into the slope and the downhill half hung in the air above it. Each puddle now bends over the ground underneath it, on both renderers, and a pool on a bridge stays on the deck. The pool also holds still. It used to throb twice a second, because every half second the pool's poison fired a fresh batch of puddles that swelled out of black to full green and back to black in two seconds, each batch somewhere new. Now it comes up in half a second, stays one pool at full colour for as long as it does damage, and fades over its last three seconds, or over three seconds from the moment the fog of war closes over it. It is not frozen, though: each puddle fades down and back up on its own beat, so the surface shimmers like something liquid while the pool as a whole never pulses. Four Scud warheads landing on one spot used to stack into a white-hot blotch in the middle; overlapping pools now share their light and the middle stays toxin green. The ground under it takes on its colour, green for toxin and the anthrax colours for anthrax, so it looks spilled rather than shone onto the grass. China's radiation keeps its orange but glows instead of browning the grass, which made it look like a scorch mark, and small bubbles swell out of it and pop. A nuke's radiation lies on the hillside as a pool from three seconds after the blast, where its first ten seconds used to be flat squares cutting into the slope.
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h
index da6b47b8a..b965a1668 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ffshader.h
@@ -565,14 +565,15 @@ const unsigned NORMAL_MAPPED_LIGHTS = 4;
" Each face leans the scene behind it the way its normal leans on the screen, so faces turned\n" \
" different ways show the ground shifted by different amounts and the body's shape reads even\n" \
" over plain sand; a slow, broad ripple swims over that and bends a flat wall across its face.\n" \
- " The reach is two and a half world units in pixels at the pixel's depth, never under 4 pixels\n" \
- " at 1080 so a unit at play zoom still visibly distorts, never over 4% of the screen. The\n" \
- " ripple is low frequency in the world and slow, so nothing fizzes in motion. The bend alone\n" \
- " was lost at play zoom, so the glass also leans a little toward a cool mid grey, 7% face on\n" \
- " and about half at the outline, where a soldier's round body has most of its faces and a\n" \
- " building's flat walls have few: a haze rather than a white edge, darkening bright ground as much\n" \
- " as it lifts dark ground. A hint of the unit's own paint stays in it, breathing with the\n" \
- " game's own stealth opacity as it did in 2003. Detected (the strength is never below 0.6\n" \
+ " The reach is three world units in pixels at the pixel's depth, never under 5 pixels at 1080\n" \
+ " so a unit at play zoom still visibly distorts, never over 4% of the screen. The ripple is\n" \
+ " low frequency in the world and slow, so nothing fizzes in motion. In play the bend alone\n" \
+ " left a squad barely there, so the glass also leans toward a cool mid grey, 12% face on and\n" \
+ " about three quarters at the outline, where a soldier's round body has most of its faces and\n" \
+ " a building's flat walls have few: a haze rather than a white edge, darkening bright ground as\n" \
+ " much as it lifts dark ground. Three eighths to a half of the unit's own paint stays in it,\n" \
+ " breathing with the game's own stealth opacity as it did in 2003, which is what makes a group\n" \
+ " read at a glance while it still looks like glass. Detected (the strength is never below 0.6\n" \
" then), the whole body beats amber as well as its edge: a big flat building has almost no\n" \
" edge facing away from the eye, and with the beat on the rim alone it only turned tan. The\n" \
" alpha goes back up to the texel's own, because the shade already holds the mix. */\n" \
@@ -594,14 +595,14 @@ const unsigned NORMAL_MAPPED_LIGHTS = 4;
" float3 up = above.xyz / above.w - world;\n" \
" float world_per_pixel = max(length(up), 1e-4);\n" \
" float2 lean = float2(dot(surface, right), -dot(surface, up)) / world_per_pixel;\n" \
- " float reach = clamp(2.5 / world_per_pixel, 0.0037 * screen.y, 0.04 * screen.y);\n" \
+ " float reach = clamp(3.0 / world_per_pixel, 0.005 * screen.y, 0.04 * screen.y);\n" \
" float2 bend = (lean * 0.8 + float2(swim_x, swim_y) * 1.2) * reach;\n" \
" int2 at = int2(clamp(position.xy + bend, float2(0.0, 0.0), screen - 1.0));\n" \
" float3 behind = SceneColour.Load(int3(at, 0)).rgb;\n" \
" float grey = dot(current.rgb, float3(0.299, 0.587, 0.114));\n" \
" float3 own = lerp(grey.xxx, current.rgb, 0.7);\n" \
- " float3 glass = lerp(behind, own, 0.1 + 0.15 * opacity);\n" \
- " glass = lerp(glass, float3(0.52, 0.55, 0.59), 0.07 + 0.45 * rim);\n" \
+ " float3 glass = lerp(behind, own, 0.25 + 0.25 * opacity);\n" \
+ " glass = lerp(glass, float3(0.52, 0.55, 0.59), 0.12 + 0.65 * rim);\n" \
" float found = step(0.01, detected);\n" \
" float beat = 0.55 + 0.45 * sin(t * 6.0);\n" \
" float3 amber = float3(1.0, 0.55, 0.15);\n" \