Sodium

Sodium

44M Downloads

Some vanilla shaders are not working

MrGazdag opened this issue ยท 2 comments

commented

Version information

mc1.17.1-0.3.2+build.7

Expected Behavior

Since 1.17, resource packs can override core shaders. The attached example shader code should make every block that is shaded by the rendertype_cutout_mipped shader (basically colored transparent blocks) a variant of red (the strength of the color depends on the distance to the blockface).

Expected result:
image

This works with fabric without sodium.

Actual Behavior

With sodium-fabric-mc1.17.1-0.3.2+build.7.jar, the latest version as of writing, the shader gets ignored:
image

Note that the shader is still being compiled by the game, since saving incorrect GLSL code in the file prevents the resourcepack from loading.

Reproduction Steps

1a. Create a resource pack, and create a new file at assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh with the following contents:

#version 150

#moj_import <fog.glsl>

uniform sampler2D Sampler0;

uniform vec4 ColorModulator;
uniform float FogStart;
uniform float FogEnd;
uniform vec4 FogColor;

in float vertexDistance;
in vec4 vertexColor;
in vec2 texCoord0;
in vec4 normal;

out vec4 fragColor;

void main() {
    vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
    color.r = vertexDistance/100;
    color.g = 0.0;
    color.b = 0.0;
    fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
}

1b. Download the example resource pack
2. Load the resource pack.
3. Observe, that leaves (and other tinted transparent blocks) are not colored red.

Java version

Java 16.0.1 64bit

CPU

Intel Core i5-4690

GPU

NVIDIA GeForce GTX 960

Additional information

No response

commented

Vanilla shader packs are not supported, because Sodium uses a completely different system for rendering. We have no intention to fix this, as it's just an unfortunate consequence of the situation. Fabulous shaders (also known as "post-processing shaders") should work fine.

At some point, I'd like to provide a system similar to vanilla for replacing shaders in Sodium, but that day hasn't come yet and I'm not making promises for it.

commented