Vignette Low-End Shader

光影

· 作者 FORCedout

一款轻量级的电影感 Minecraft 光影,具有宝石矿石发光效果、平滑的水面以及基于时间的氛围光照。

0 本站下载 0 关注 更新于 4 个月前

需要前置:Iris/Oculus & GeckoLib Compat

最新 1.0.0 · 26.1.2 · Iris / OptiFine

一键开服(送7天)

请阅读。

这是一款专为极低配置电脑设计的轻量级光影包,它包含摇曳的树叶、流动的水面、平滑的光照以及平滑的水面效果。下界和末地的光照效果良好,宝石矿石(红石、钻石、青金石、金)会像红石一样发光。其他物品不会发光,因为我是通过颜色而非方块 ID 来实现的,所以任何带有类似宝石颜色的物体都会发光……你还会看到周围有一圈白色的墙壁状物体,这也是一个问题,我尝试过修复但效果不佳……水下视野清晰可见,但距离不远,同时也包含阴影效果……你可能会发现末影人和蜘蛛没有眼睛,纹理出现了一些故障,我也尝试修复过,但情况变得更糟了,不过请始终记住不要直视末影人。草地也是波浪形的,因此问题在于其边缘漏光,当草摆动时会被撕裂,导致在角落处可以看到内部……没有复杂的云层或阳光效果……你可以透过岩浆看到下方……我不是模组开发者或程序员,但我希望你能够喜欢它……如果你恰好是程序员,修复这些问题并不难……我会尽量留下代码……我制作它是出于我自己的电脑配置考虑,因为那真的是一台毫无前途的“土豆”电脑……而且它完全由 Gemini 生成……所以如果你能帮我一把的话……谢谢查看……

composite.fsh:

#version 120 uniform sampler2D colortex0; varying vec2 texcoord;

void main() { vec4 color = texture2D(colortex0, texcoord); float lum = dot(color.rgb, vec3(0.299, 0.587, 0.114));

// 1. 消除白色地平线墙
if (color.r > 0.90 && color.g > 0.90 && color.b > 0.90 && texcoord.y > 0.35) {
    color.rgb = mix(color.rgb, vec3(0.55, 0.70, 0.90), 0.45);
}

// 2. 附魔魔法闪光黑客(检测紫色/蓝色魔法并使其闪耀)
if (color.b > 0.55 && color.r > 0.40 && color.g < 0.35) {
    color.rgb *= 1.8; 
    color.b += 0.2;
}

// 3. 白天与夜晚的色彩分级
if (lum < 0.22) {
    color.rgb *= vec3(0.55, 0.68, 1.05); // 黑暗的大气夜晚
} else {
    color.r *= 1.10;
    color.g *= 1.04;
    color.b *= 0.90; // 温暖的电影感白天
}

// 4. 柔和对比度曲线
color.rgb = pow(color.rgb, vec3(1.04));

// 5. 平滑的电影感暗角
float dist = distance(texcoord, vec2(0.5, 0.5));
float vignette = smoothstep(0.88, 0.35, dist);
color.rgb *= mix(0.78, 1.0, vignette);

gl_FragColor = clamp(color, 0.0, 1.0);

}

composite.vsh:

#version 120 varying vec2 texcoord;

void main() { gl_Position = ftransform(); texcoord = gl_MultiTexCoord0.st; }

gbuffers_terrain.fsh:

#version 120 uniform sampler2D texture; uniform sampler2D lightmap; varying vec2 texcoord; varying vec2 lmcoord; varying vec4 glcolor;

void main() { vec4 texColor = texture2D(texture, texcoord); vec4 color = texColor * glcolor; vec4 light = texture2D(lightmap, lmcoord);

vec3 finalColor = color.rgb * light.rgb;

// 严格检测宝石
// 我们移除了铁、石英、煤和深层矿石,以防止末地石、流纹岩和树木发光。

bool isDiamond = (texColor.b > 0.65 && texColor.g > 0.50 && texColor.r < 0.20);
bool isEmerald = (texColor.g > 0.65 && texColor.r < 0.15 && texColor.b < 0.20);
bool isRedstne = (texColor.r > 0.65 && texColor.g < 0.15 && texColor.b < 0.15);
bool isLapis   = (texColor.b > 0.60 && texColor.r < 0.20 && texColor.g < 0.35);

// "texColor.b < 0.15" 严格保护末地石不发出如闪光弹般的光芒
bool isGold    = (texColor.r > 0.70 && texColor.g > 0.60 && texColor.b < 0.15); 

// 仅在完美匹配饱和宝石时应用发光
if (isDiamond || isEmerald || isRedstne || isGold || isLapis) {
    // max() 确保它在洞穴中明亮发光,但在表面上不会亮到刺眼的白色
    finalColor = max(finalColor, texColor.rgb * 1.15); 
}

gl_FragColor = vec4(finalColor, color.a);

}

gbuffers_terrain.vsh:

#version 120 varying vec2 texcoord; varying vec2 lmcoord; varying vec4 glcolor; uniform float frameTimeCounter;

void main() { vec4 position = gl_Vertex;

// 严格的绿色检查,以确保只有树叶和草地摆动
bool isTrueLeaf = (gl_Color.g > gl_Color.r * 1.30) && (gl_Color.g > gl_Color.b * 1.20) && (gl_Color.g > 0.30);

if (isTrueLeaf) {
    float wave = sin(frameTimeCounter * 1.8 + position.x * 1.2 + position.z * 1.2) * 0.025;
    position.x += wave;
    position.z += wave * 0.5;
}

gl_Position = gl_ModelViewProjectionMatrix * position;
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
lmcoord  = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
glcolor  = gl_Color;

}

gbuffers_water.fsh:

#version 120 uniform sampler2D texture; uniform sampler2D lightmap; varying vec2 texcoord; varying vec2 lmcoord; varying vec4 glcolor;

void main() { vec4 texColor = texture2D(texture, texcoord); vec4 light = texture2D(lightmap, lmcoord); vec4 color = texColor * glcolor;

// 检测水:原版水的生物群系着色(glcolor),玻璃和冰则没有。
bool isWater = (glcolor.r < 0.99 || glcolor.g < 0.99 || glcolor.b < 0.99);

if (isWater) {
    // 100% 擦除像素化的原版纹理,使用纯粹、平滑的电影感色彩
    color.rgb = vec3(0.05, 0.40, 0.70);
    
    // 赋予其平滑且均匀一致的透明度
    color.a = 0.85; 
}

// 应用阴影和光照(这样水在洞穴中仍然会变暗)
color.rgb *= light.rgb;

gl_FragColor = color;

}

gbuffers_water.vsh:

#version 120 varying vec2 texcoord; varying vec2 lmcoord; varying vec4 glcolor; uniform float frameTimeCounter;

void main() { vec4 position = gl_Vertex;

// 细微的物理水波效果
float wave = sin(frameTimeCounter * 2.2 + position.x * 1.8 + position.z * 1.8) * 0.03;
position.y += wave;

gl_Position = gl_ModelViewProjectionMatrix * position;
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
lmcoord  = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
glcolor  = gl_Color;

}

如果你愿意帮忙,你可以... 谢谢

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源