You are viewing a potentially older version of this package. View all versions.
Wire-WiresShadows-0.1.2 icon

WiresShadows

Real shadows for every light you place and no light through walls, running about as fast as vanilla.

By Wire
Date uploaded a day ago
Version 0.1.2
Download link Wire-WiresShadows-0.1.2.zip
Downloads 42
Dependency string Wire-WiresShadows-0.1.2

README

Wire's Shadows

Real shadows for every light you place, without the performance cost.

In vanilla Valheim only the few lights nearest you get shadows, and the game redraws those every frame. Every other sconce and torch shines straight through walls, floors and roofs. Wire's Shadows gives every placed light cached shadows instead, so your base looks right and runs about as fast as vanilla.

Comparison

Wire's Shadows first, vanilla second.

Wire's Shadows Vanilla

Features

  • Cached shadows for every placed light: sconces, torches, braziers, hearths, campfires, lanterns, forges and the rest. Each light's shadow map is rendered once and only re-rendered when something near it changes (building, removing, a door opening or closing).
  • No light leaking through walls, floors or roofs.
  • Dynamic shadows for things that move: players, creatures, doors and gates, dropped items, and the moving parts of windmills, spinning wheels, the refinery and turrets. Only the part of a shadow map that changed is redrawn, and the further out in a light's range the moving things are, the less often (every frame close to the light, every 4th at the edge of its reach).
  • Items on stands and placed food and meads are part of the cached shadows, and their glows (a trophy's flame, a mead) are lights of their own.
  • The vanilla look: Valheim's own lighting shader, rebuilt with the shadows added. Same banding, same fades, same flicker.
  • Carried torches keep the game's own shadows.
  • Coloured ambient occlusion: the game's ambient occlusion takes on the colour of the surface it lands on (GTAO multi-bounce): bright surfaces are darkened less, coloured ones keep their colour instead of going grey.

Limitations

  • No fire wiggle. In vanilla a fire's light shakes around a little. A cached shadow is rendered from one spot, so here the light holds still. Its brightness still flickers.
  • No swaying shadows. Banners, hanging cloth and herbs cast their shadow at rest, not moving with the wind.

Settings

  • Enabled: off brings back the game's own lighting and shadows.
  • Debug log: off by default. Writes what the mod does to the log; turns itself on while a benchmark runs.
  • Benchmark: measures the mod against vanilla where you stand (the full mod, the mod with every moving shadow redrawn every frame, the cached shadows alone, the cached shadows with the game's own moving shadows, and vanilla) and shows the frame times.

Performance

The goal: run the same as vanilla with point lights maxed out, or slightly better, while looking much better.

On my PC (RTX 4090, i5-13600KF, 128 GB RAM), in my base of about 6,000 pieces, one benchmark gave 17.40 ms a frame (57 fps) with the mod and 17.73 ms (56 fps) in vanilla. Other runs were up to 2.5 ms faster than vanilla. It depends on what's happening: it's faster nearly every time, but I can't guarantee it always is.

Measure it yourself: turn on Benchmark in an in-game config menu (such as Shudnal's Configuration Manager).

Compatibility

  • Client side only.
  • Windows (DirectX 11). Where the shaders can't load, the game's own lighting stays.
  • Works with Valheim Performance Optimizations.
  • Mods that merge building pieces into bigger meshes: their meshes are left as they are.
  • Mods that replace the game's lighting shader can't be used together with this one.

The ambient occlusion shader is built from Amplify Occlusion by Amplify Creations (MIT license, included in the DLL).

Disclaimer: development is AI assisted. Not fully human or AI.

Donations: ko-fi.com/krosshair

CHANGELOG

0.1.8

  • Fixed: pieces round you could vanish and pop back in while the game streamed things in, when a light switched on as its piece appeared.
  • The chunks a broken piece falls apart into cast moving shadows while they fall, as they do with the game's own shadows.
  • Effect particles cast moving shadows too: the chips of a broken piece or tree, a stone's rock bits and the like. See-through dust doesn't.
  • Leaner: shadow updates no longer make garbage for every lower-detail model in a light's reach, and leftover code from older versions is gone.
  • Far less video memory: the shadow maps' storage grew to twice what it needed whenever it ran out (1.8 GB seen) and never got smaller. It now grows by what's needed and packs itself back down once lights are done updating.
  • Fixed: placing a spinning wheel, refinery, windmill or ballista lagged: their moving parts made every light round them search everything in its reach again. Now they're just left out of those lights' maps.
  • Maps are no longer kept for lights that unload (for coming back), which held a lot of video memory and popped in. After a portal or a world load the maps are built again over the first moments, as before, and now fade in instead of popping.

0.1.7

  • Fixed: breaking a piece near a light left shadows of chips (wood) or rocks (stone) on the ground until you looked away. The dust, chips and rocks that fly out were drawn into the light's shadow map while it updated. The game's effects are no longer drawn into shadow maps.
  • Less lag placing and breaking: each light round a change used to search everything in its reach again before updating its shadow. Now a placed piece is just added to what each light already knows, and a broken one needs nothing. The check of what's round a light is also worked out once per object instead of on every update. Lower-detail models are no longer switched off and on for every shadow update (the update always draws full detail, so they were never drawn anyway).
  • Shadows change with the piece: placing or breaking something in view updates the lights you can see in the next frame, instead of one side of one light per frame after each other (it was a few frames late).

0.1.6

  • Leaner: the mod keeps its shadow maps one way only (sized by the screen, kept as depth, both sides in one render). The two older ways it carried as fallbacks are gone (about 750 lines, a third of the lighting shader and three shaders), and so are their textures. A GPU that can't do this keeps the game's own point-light shadows.
  • Coming home is smooth: shadow maps are kept when their lights unload, and a light that loads back in with nothing changed around it gets its map back without rendering. Maps that do have to be built are spread out over time.
  • Less lag after a portal: the game keeps loading a base in for a few seconds after the loading screen, and every piece that appeared made the lights around it render again. A light now waits until everything around it has loaded (the same check the portal itself waits on), then renders once.
  • Shadow maps render in half the work: the surfaces facing a light and the ones facing away are drawn in one pass instead of two.
  • Food, meads and items on stands are no longer checked every frame.
  • Fixed: torches placed by the world (the green ground torches at swamp crypts) were shaded by their own model; like built ones, they no longer are.

0.1.5

  • Less stutter arriving at a base through a portal: shadow memory is set aside once instead of growing (and copying every shadow map) several times over while the base loads in.
  • Shadow maps get smaller again as you move away from a light (they only ever grew before), so the memory follows what's on your screen.
  • Fixed: shadows between you and a light further away could be low-res: a map's size was measured from the light, not from where its shadows come nearest the camera. One map texel is now no bigger than one screen pixel there.

0.1.4

  • Follows the game's Point light shadows setting. On the highest setting nothing changes. Off: no light shadows from the mod either. Low and the default: every light within the game's own shadow distance (20 m) gets its shadows, not just 1 or 3, and moving shadows get the same work per frame the game would spend on its 1 or 3 lights, nearest lights first. Better looking than vanilla at the same cost.
  • Recommended: set Point light shadows to the highest setting. That's what the mod is made for, and where it looks its best.

0.1.3

  • Uses far less video memory (about 2 GB down to well under 1 GB on a big card). Each shadow map is sized by how much of your screen its light covers, the way games size theirs: a light far away gets a small map, one you're standing in gets the full size. Maps are kept once, as 16-bit depth, instead of twice.
  • Fits your graphics card: the shadow maps take at most a fifth of its memory, and moving shadows give way first on smaller cards. A party of players near many lights could fill the memory and slow everything to a crawl.
  • Faster lighting on the GPU: pixels out of a light's reach and parts of a light with nothing moving skip their shadow work.
  • Moving shadows: the nearest lights get them first when there are more than fit, and their memory is freed again once things calm down.
  • Lights no longer switch from a low-res to a full-size shadow map while you look at them: the best lights get full-size maps before you get close.

0.1.2

  • Lights whose light covers more of your screen (close, or big and bright in view) get full-size shadow maps first.
  • Sharper shadow edges close to a light: fine details (herbs, strings, small pots) no longer smear into blobs.
  • Fixed: see-through parts of pieces (the spice rack's herbs, leaves) cast solid card-shaped shadows in cached shadows instead of their real shape.

0.1.1

  • Faster moving shadows: only the part of a shadow map that changed is redrawn, each object is drawn once for every side of a light's map it touches, and the further out in a light's range the moving things are, the less often their shadows are redrawn (every frame close to the light, every 4th at the edge). You now cast a moving shadow out to a light's whole range.
  • Placed food and meads are part of the cached shadows instead of the moving ones, and a placed mead's glow is a light of its own.
  • Lights on item stands and armour stands (a trophy's flame, a weapon's glow) get shadows like any placed light, and an item no longer blocks its own light.
  • Fixed: items on stands and placed items could lose parts of their cached shadow to their texture's alpha.
  • Fixed: lights on items (dropped, placed or on a stand, like Brenna's trophy) cast no shadows: they kept the game's near plane, which on some is almost their whole range.
  • Fixed: a mounted item's light could be treated as a rolling dropped item and keep losing its shadow map.
  • Lights you walk up to switch to their full-size shadow map sooner, up to three at once.
  • Benchmark: compares the full mod, every moving shadow redrawn every frame, the cached shadows alone, the cached shadows with the game's own moving shadows, and vanilla, in the same time as before.
  • Coloured ambient occlusion: the game's ambient occlusion takes on the colour of the surface it lands on (GTAO multi-bounce), so bright surfaces are darkened less and coloured ones don't go grey.
  • Removed: the sun shadow caster culling. Measured, it saved nothing.

0.1.0

  • First release.