Skip to content

Mod for Crusader Kings 3 that adds snowfall effect on the map, ready for integration into larger mods

Notifications You must be signed in to change notification settings

terrapass/ck3-mod-snowfall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Steam Workshop subscribers

Snowfall Visual Effect

(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.

Animated GIF with rotating camera showing snow falling on a small part of CK3 terrain

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.

Table of Contents

  1. Mod Description
  2. Integrating into Your Mod
  3. Using Other Triggers for Snowfall

Mod Description

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!

Integrating into Your Mod

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:

  1. 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 in gfx/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.

  2. Copy every .shader and .fxh file from gfx/FX/, which you don't already have in your own mod, into your mod's gfx/FX/. This should include the two custom files provided by this mod - gh_snowfall.fxh and gh_atmospheric.fxh.

  3. 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() and ApplyFogOfWarMultiSampled() in the game's shader code with a call to GH_ApplyAtmosphericEffects() of a similar signature.

Using Other Triggers for Snowfall

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.

About

Mod for Crusader Kings 3 that adds snowfall effect on the map, ready for integration into larger mods

Topics

Resources

Stars

Watchers

Forks