#version 430 core // Sky mesh fragment shader — sample the object's diffuse texture with // the scrolled UVs from the vertex stage. Unlit: sky meshes ARE the // gradient (r12 §2.2), not a surface lit by the sun. // // The per-keyframe replace override can dim the mesh (Transparent) or // brighten it (Luminosity); those two floats arrive as uTransparency / // uLuminosity uniforms. in vec2 vTex; out vec4 fragColor; uniform sampler2D uDiffuse; uniform float uTransparency; // 0 = fully visible, 1 = invisible uniform float uLuminosity; // 1 = normal, >1 makes the mesh glow uniform vec4 uTint; // per-object color tint (default white) // Shared SceneLighting UBO — we only need the fog parameters to let the // horizon band of the sky blend smoothly into the scene's fog color at // the far edge, and the lightning flash to give storms their signature // strobe. struct Light { vec4 posAndKind; vec4 dirAndRange; vec4 colorAndIntensity; vec4 coneAngleEtc; }; layout(std140, binding = 1) uniform SceneLighting { Light uLights[8]; vec4 uCellAmbient; vec4 uFogParams; vec4 uFogColor; vec4 uCameraAndTime; }; void main() { vec4 sampled = texture(uDiffuse, vTex); // Apply tint + luminosity. Retail's SkyObjReplace.Luminosity can push // above 1 to make the sun mesh brighter than its texture; r12 §2.3. vec3 rgb = sampled.rgb * uTint.rgb * uLuminosity; // Lightning additive bump — makes the sky itself flash during storms. rgb += uFogParams.z * vec3(0.5, 0.5, 0.55); rgb = min(rgb, vec3(1.2)); // soft clamp to let luminosity over-bright mildly float a = sampled.a * (1.0 - uTransparency) * uTint.a; if (a < 0.01) discard; fragColor = vec4(rgb, a); }