(a Crusader Kings III mod)
This repository contains CK3 mod files which implement shader-based seasonal snowfall effect on the map, originally made for Godherja: The Dying World, tied to the winter severity system provided by vanilla CK3.
The code is up-to-date as of CK3 v1.12 (Scythe).
The contents of mod/
directory in this repo are at the same time a small working mod in their own right, as well as a set of files ready for integration into any larger mods or total conversions, interested in having more atmospheric (pun intended) visual effects on the map. See Integrating into Your Mod for details.
This mod adds falling snow particles on the map, visible when zoomed in close to terrain. It's tied to the game's winter severity system, meaning the effect will appear during cold months over spots on the map where there's seasonal snow.
The effect was originally developed for Godherja: The Dying World - a popular fantasy total conversion - check it out on Steam Workshop.
This upload is intended for vanilla CK3 and other mods. Don't use it together with Godherja in the same playset.
Mod files are up-to-date as of CK3 v1.8.1 (Robe).
Does not require starting a new game. Can be safely added or removed without affecting your savegame.
Compatible with any mods that don't modify shaders. In practice this means most GUI, localization and gameplay mods - basically, most things aside from terrain shader mods and total conversions.
Special thanks to my fellow Godherja team members and to the community of CK3 Mod Co-op.
Happy Holidays!
This effect is very easy to integrate into a larger mod. Its implementation consists of a couple of custom shader files, several minor changes to vanilla shaders, and a single custom snowfall layer texture.
If your mod doesn't modify any shaders (doesn't have its own gfx/FX
), you can simply copy the contents of mod/
directory (except for descriptor.mod
and the thumbnail) into your mod's file structure, and you're done.
If your mod does have its own shaders, follow these steps:
-
Copy
gfx/map/environment/gh_snow_layer_1.dds
into your mod's directory. Feel free to rename it as you see fit, or place it into a different folder - just don't forget to also change the path ingfx/FX/gh_snowfall.fxh
later if you do. In case you decide to edit the texture itself, keep in mind that only its alpha channel is currently used by the snowfall shader. -
Copy every
.shader
and.fxh
file fromgfx/FX/
, which you don't already have in your own mod, into your mod'sgfx/FX/
. This should include the two custom files provided by this mod -gh_snowfall.fxh
andgh_atmospheric.fxh
. -
Manually merge in changes to shader files that already exist in your mod from this mod's versions of these files.
For convenience, all the changes in shader code, compared to vanilla, are marked with MOD(godherja-snowfall)
comments -
you can just search for this string and copy/replace every piece of code surrounded by this comment.
In essence, the only changes this mod needs to make to vanilla shaders are:
- To replace every inclusion of
"jomini/jomini_fog_of_war.fxh"
in the game's shader files with"gh_atmospheric.fxh"
. - To replace every call to
ApplyFogOfWar()
andApplyFogOfWarMultiSampled()
in the game's shader code with a call toGH_ApplyAtmosphericEffects()
of a similar signature.
In theory it's possible for your mod to use a different condition for snowfall visibility either in addition to or completely instead of the vanilla winter system.
To do that, you can replace the call to GetWinterSeverity()
in GH_ApplySnowfallEffect()
with any custom call returning a number between 0.0f
and 1.0f
for any given pixel.
In particular, using a literal value of 1.0f
there will make the snowfall always visible, given appropriate camera angles.
If for your mod you decide to work on a more complex condition for triggering snowfall, it might be a good idea to modify vanilla's GetWinterSeverity()
(see dynamic_masks.fxh
in vanilla) instead, as it'll also give you the nice terrain and object snowiness effect, in addition to triggering the snowfall.
A practical example of the snowfall (as well as vanilla winter snow) triggering based on a custom condition might be available in a future version of Godherja, at which point it will be briefly described in this section, so keep an eye out for that.