Sodium Core Shader Support

Quick rating

Sodium Core Shader Support

No reviews yet

Enables resourcepacks to be able to replace sodium's shaders, similar to resourcepacks being able to replace vanilla's core shaders.

No Theme
No Genre
Aesthetic Improvements
QoL & Tweaks
Mod Addon
Mod Loaders
Forge
NeoForge
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Where It Runs
Client Only

Runs entirely on the client. Works on vanilla servers.

About

Project Details

Type
Mod
License
Apache License 2.0
Latest Version
1.5.0-sodium0.9.0-b.1-fabric-mc26.1.2

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID
Modrinth ID

Resources

External Links

About

Description

Sodium Core Shader Support

Modrinth Downloads CurseForge Downloads License Environment Client Discord

Enables resourcepacks to replace sodium's shaders, similar to resourcepacks being able to replace vanilla's core shaders. If you like my mods consider supporting the development by buying me a coffee:

ko-fi

Documentation for Users

Sodium Core Shader Support allows resourcepacks to replace sodiums core shaders with their own. That does not mean, that this mod makes every vanilla resourcepack work on sodium. The resourcepacks will only work if they specifically state, that they are compatible with sodium core shader support.

If you are using a supported resourcepack you can simply activate it like any other resourcepack.

Resourcepack incompatible

Sodium may display the message The following resource packs are incompatible with Sodium in the top right corner after reloading resources and listing your active core shaders. This message will always appear, even if the resourcepack supports sodium core shaders and can be ignored.

List of Resourcepacks

This is a small list of resourcepacks that work on sodium. If you have created a resourcepack yourself feel free to open an issue on my github to add it to this list!

Documentation for Shader Developers

It is important to understand that your vanilla shaders cannot just be copied to sodium shaders. Sodium has their own shaders for blocks and clouds:

- assets/sodium/shaders/
   | - clouds.fsh
   | - clouds.vsh
   | - blocks/
        | - block_layer_opaque.fsh
        | - block_layer_opaque.vsh
   | - include/
        | - fog.glsl 
        | - chunk_material.glsl
        | - chunk_matrices.glsl
        | - chunk_vertex.glsl

Unless you want to change sodium clouds the block_layer_opaque are usually the most important ones. You should not have to touch chunk_material.glsl, chunk_matrices.glsl and chunk_vertex.glsl unless you know what you are doing.

Retrieving sodium shaders source code

To retrieve the sodium shader source code for a specific sodium version, download the .jar file of that version and extract it like a .zip archive. Inside the extracted archive you will find a assets folder containing the directory structure mentioned above.

block_layer_opaque

The block_layer_opaque is used for all blocks and block entities. The vanilla minecraft equivalent is terrain.fsh and terrain.vsh (In older versions of minecraft the equivalent is rendertype_solid, rendertype_cutout, rendertype_cutout_mipped, …).

Additionally, sodium core shader support adds a few defines in the sodium shaders block_layer_opaque.fsh and block_layer_opaque.vsh for some terrain-types:

  • RENDER_PASS_SOLID: Solid Blocks
  • RENDER_PASS_CUTOUT: Blocks like leaves, grass, glass, …
  • RENDER_PASS_TRANSLUCENT: Blocks with actual transparency, e.g. water, honey, slime, …

Furthermore, the define SODIUM_CORE_SHADER_SUPPORT will be present in all shaders (mc >= 1.21.2 and version >= 1.3.8). These defines can be used like this:

#ifdef RENDER_PASS_SOLID
    // special shading for solid stuff
#endif

GameTime Uniform

As of Sodium Core Shader Support version 1.4.0 the u_GameTime uniform will be present in block_layer_opaque.fsh and block_layer_opaque.vsh. It can be used just like the vanilla GameTime uniform. Add it to your shaders using:

uniform float u_GameTime;

How to specify which sodium versions are supported

The sodium devs will change their internal shaders and shader related code without further notice. That's why it is important that you specify with which versions of sodium and minecraft your pack is compatible. This can be done in a special versions.json file. It should be located in your resourcepack in a new directory assets/sodiumcoreshadersupport with the file name versions.json inside. The contents of the file could look like this:

{
  "supported-versions": {
    "1.21": [ "0.5.11+mc1.21" ],
    "1.21.1": [ "0.5.11+mc1.21" ]
  }
}

In the above example the resourcepack states, that it is compatible with sodium 0.5.11 on minecraft 1.21 and 1.21.1. An abstract description is below:
More specifically, versions.json must contain a question object with the key supported-versions. The value of supported-versions must be a map, which maps different minecraft versions to an array of allowed sodium versions. The SodiumCoreShaderSupport mod will check if the installed sodium version is contained in the array of the installed minecraft version.

  • If the minecraft and/or sodium version is not inside supported-versions, the pack can be activated with a warning message.
  • If the user does not have sodium installed the pack can be activated.
  • If no versions.json is present, the pack can be activated with a warning message.
  • If the versions.json is malformed, the pack can be activated with a warning message.

Imports

Sodium Shaders must be in assets/sodium/shaders directory. But you can #import files from assets/minecraft/shaders using the #import directive. The following code will include the file assets/minecraft/shaders/include/test.glsl:

#import <minecraft:include/test.glsl>

With this trick you can create custom glsl files, which you can #import in your shaders (in both core shaders and sodium shaders). These files, should contain your main shader "logic". An example shaderpack, which works with this trick on both vanilla and sodium, can be found here.

Sodium Core Shader Support

Modrinth Downloads CurseForge Downloads License Environment Client Discord

Enables resourcepacks to replace sodium's shaders, similar to resourcepacks being able to replace vanilla's core shaders. If you like my mods consider supporting the development by buying me a coffee:

ko-fi

Documentation for Users

Sodium Core Shader Support allows resourcepacks to replace sodiums core shaders with their own. That does not mean, that this mod makes every vanilla resourcepack work on sodium. The resourcepacks will only work if they specifically state, that they are compatible with sodium core shader support.

If you are using a supported resourcepack you can simply activate it like any other resourcepack.

Resourcepack incompatible

Sodium may display the message The following resource packs are incompatible with Sodium in the top right corner after reloading resources and listing your active core shaders. This message will always appear, even if the resourcepack supports sodium core shaders and can be ignored.

List of Resourcepacks

This is a small list of resourcepacks that work on sodium. If you have created a resourcepack yourself feel free to open an issue on my github to add it to this list!

Documentation for Shader Developers

It is important to understand that your vanilla shaders cannot just be copied to sodium shaders. Sodium has their own shaders for blocks and clouds:

- assets/sodium/shaders/
   | - clouds.fsh
   | - clouds.vsh
   | - blocks/
        | - block_layer_opaque.fsh
        | - block_layer_opaque.vsh
   | - include/
        | - fog.glsl 
        | - chunk_material.glsl
        | - chunk_matrices.glsl
        | - chunk_vertex.glsl

Unless you want to change sodium clouds the block_layer_opaque are usually the most important ones. You should not have to touch chunk_material.glsl, chunk_matrices.glsl and chunk_vertex.glsl unless you know what you are doing.

Retrieving sodium shaders source code

To retrieve the sodium shader source code for a specific sodium version, download the .jar file of that version and extract it like a .zip archive. Inside the extracted archive you will find a assets folder containing the directory structure mentioned above.

block_layer_opaque

The block_layer_opaque is used for all blocks and block entities. The vanilla minecraft equivalent is terrain.fsh and terrain.vsh (In older versions of minecraft the equivalent is rendertype_solid, rendertype_cutout, rendertype_cutout_mipped, ...).

Additionally, sodium core shader support adds a few defines in the sodium shaders block_layer_opaque.fsh and block_layer_opaque.vsh for some terrain-types:

  • RENDER_PASS_SOLID: Solid Blocks
  • RENDER_PASS_CUTOUT: Blocks like leaves, grass, glass, ...
  • RENDER_PASS_TRANSLUCENT: Blocks with actual transparency, e.g. water, honey, slime, ...

Furthermore, the define SODIUM_CORE_SHADER_SUPPORT will be present in all shaders (mc >= 1.21.2 and version >= 1.3.8). These defines can be used like this:

#ifdef RENDER_PASS_SOLID
    // special shading for solid stuff
#endif

GameTime Uniform

As of Sodium Core Shader Support version 1.4.0 the u_GameTime uniform will be present in block_layer_opaque.fsh and block_layer_opaque.vsh. It can be used just like the vanilla GameTime uniform. Add it to your shaders using:

uniform float u_GameTime;

SunAngle Uniform

As of Sodium Core Shader Support version 1.5.0 the u_SunAngle uniform will be present in block_layer_opaque.fsh and block_layer_opaque.vsh as well. It returns the sun angle from environmental attributes in radians. Add it to your shaders using:

uniform float u_SunAngle;

How to specify which sodium versions are supported

The sodium devs will change their internal shaders and shader related code without further notice. That's why it is important that you specify with which versions of sodium and minecraft your pack is compatible. This can be done in a special versions.json file. It should be located in your resourcepack in a new directory assets/sodiumcoreshadersupport with the file name versions.json inside. The contents of the file could look like this:

{
  "supported-versions": {
    "1.21": [ "0.5.11+mc1.21" ],
    "1.21.1": [ "0.5.11+mc1.21" ]
  }
}

In the above example the resourcepack states, that it is compatible with sodium 0.5.11 on minecraft 1.21 and 1.21.1. An abstract description is below:
More specifically, versions.json must contain a question object with the key supported-versions. The value of supported-versions must be a map, which maps different minecraft versions to an array of allowed sodium versions. The SodiumCoreShaderSupport mod will check if the installed sodium version is contained in the array of the installed minecraft version.

  • If the minecraft and/or sodium version is not inside supported-versions, the pack can be activated with a warning message.
  • If the user does not have sodium installed the pack can be activated.
  • If no versions.json is present, the pack can be activated with a warning message.
  • If the versions.json is malformed, the pack can be activated with a warning message.

Imports

Sodium Shaders must be in assets/sodium/shaders directory. But you can #import files from assets/minecraft/shaders using the #import directive. The following code will include the file assets/minecraft/shaders/include/test.glsl:

#import <minecraft:include/test.glsl>

With this trick you can create custom glsl files, which you can #import in your shaders (in both core shaders and sodium shaders). These files, should contain your main shader "logic". An example shaderpack, which works with this trick on both vanilla and sodium, can be found here.

Disable Culling

Since version 1.5.0, sodium's frustum and backface culling can be disabled via versions.json. This is useful for any core shader that requires offscreen geometry, or that aims to transform the view in block.vsh to show geometry not typically on screen (e.g. shadows, alternate player POVs, etc.)

{
  "supported-versions": { "1.21.11": ["0.8.7+mc1.21.11"] },
  "disable-frustum-culling": true,
  "disable-backface-culling": true
}

Credits

Thanks to MR-CHOO for adding the SunAngle Uniform and the option to disable frustum and backface culling!

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

1.3m
Total Downloads
CurseForge
~490,000
Modrinth
~890,000
Last Updated
CurseForge
Created
CurseForge
Modrinth
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works