Archive eagler-shaders (other, 1.8.8, clean)

This commit is contained in:
2026-11-28 00:50:11 -06:00
parent d823d48d14
commit dc03934360
49 changed files with 5821 additions and 0 deletions
@@ -0,0 +1,248 @@
package com.eaglercraft.shaders;
import com.mojang.blaze3d.platform.GlStateManager;
import net.lax1dude.eaglercraft.opengl.EaglercraftGPU;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Eaglercraft-specific integration adapter for the Shader Collection.
* This class hooks into Eaglercraft's GameRenderer and provides
* the minimal integration layer required.
*
* Usage:
* <pre>
* // In your client mod initialization:
* EaglercraftShaderIntegration.install(renderer);
*
* // Then use the ShaderCollection API:
* ShaderCollection.enable("nightfall");
* ShaderCollection.setQuality(ShaderQuality.LOW);
* </pre>
*/
@OnlyIn(Dist.CLIENT)
public class EaglercraftShaderIntegration {
private static final Logger LOGGER = LogManager.getLogger();
private static GameRenderer gameRenderer;
private static ShaderCollection shaderCollection;
private static boolean installed = false;
private static ShaderGroup vanillaShaderGroup = null;
private static boolean wasShaderActive = false;
/**
* Install the shader collection into Eaglercraft's rendering pipeline.
* This should be called once during client initialization.
*
* @param renderer The GameRenderer instance
* @return true if installation succeeded
*/
public static boolean install(GameRenderer renderer) {
if (installed) {
LOGGER.warn("EaglercraftShaderIntegration already installed");
return true;
}
if (renderer == null) {
LOGGER.error("Cannot install: GameRenderer is null");
return false;
}
gameRenderer = renderer;
try {
// Initialize the shader collection
shaderCollection = ShaderCollection.init(renderer);
// Enable default preset (Vanilla Enhanced LOW)
shaderCollection.enable(ShaderPreset.VANILLA_ENHANCED);
shaderCollection.setQuality(ShaderQuality.LOW);
installed = true;
LOGGER.info("Eaglercraft Shader Collection integration installed successfully");
return true;
} catch (Exception e) {
LOGGER.error("Failed to install Eaglercraft Shader Collection integration", e);
return false;
}
}
/**
* Check if the integration is installed.
*/
public static boolean isInstalled() {
return installed && shaderCollection != null;
}
/**
* Get the shader collection instance (initialises if needed).
*/
public static ShaderCollection getShaderCollection() {
if (shaderCollection == null && gameRenderer != null) {
install(gameRenderer);
}
return shaderCollection;
}
/**
* Called from GameRenderer.updateCameraAndRender to render shaders.
* This should be called in place of the vanilla shader rendering.
*
* @param partialTicks Partial tick time
* @param useShader Whether vanilla shaders are enabled
*/
public static void renderShaders(float partialTicks, boolean useShader) {
if (!installed || shaderCollection == null) {
// Fall back to vanilla behavior
if (useShader && gameRenderer != null) {
ShaderGroup sg = gameRenderer.getShaderGroup();
if (sg != null) {
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
sg.render(partialTicks);
GlStateManager.popMatrix();
}
}
return;
}
// If our shaders are enabled, render them
if (shaderCollection.isEnabled()) {
shaderCollection.render(partialTicks);
} else if (useShader) {
// Fall back to vanilla shader if our shaders are disabled but vanilla wants shaders
ShaderGroup sg = gameRenderer.getShaderGroup();
if (sg != null) {
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
sg.render(partialTicks);
GlStateManager.popMatrix();
}
}
}
/**
* Called when the framebuffer size changes.
*/
public static void onFramebufferResize(int width, int height) {
if (shaderCollection != null) {
shaderCollection.updateFramebufferSize(width, height);
}
}
/**
* Called when resources are reloaded (resource pack change).
*/
public static void onResourceReload(IResourceManager resourceManager) {
if (shaderCollection != null) {
shaderCollection.reload();
}
}
/**
* Called when the game is shutting down.
*/
public static void onShutdown() {
if (shaderCollection != null) {
shaderCollection.disable();
}
installed = false;
gameRenderer = null;
shaderCollection = null;
}
/**
* Enable a specific shader preset by ID.
* Convenience method that gets the collection and enables the preset.
*/
public static boolean enablePreset(String presetId) {
ShaderCollection sc = getShaderCollection();
if (sc != null) {
return sc.enable(presetId);
}
return false;
}
/**
* Set the shader quality level.
*/
public static void setQuality(ShaderQuality quality) {
ShaderCollection sc = getShaderCollection();
if (sc != null) {
sc.setQuality(quality);
}
}
/**
* Disable all shaders and return to vanilla rendering.
*/
public static void disableShaders() {
ShaderCollection sc = getShaderCollection();
if (sc != null) {
sc.disable();
}
}
/**
* Toggle shaders on/off.
*/
public static void toggleShaders() {
ShaderCollection sc = getShaderCollection();
if (sc != null) {
sc.toggle();
}
}
/**
* Get the current preset.
*/
public static ShaderPreset getCurrentPreset() {
ShaderCollection sc = getShaderCollection();
return sc != null ? sc.getCurrentPreset() : ShaderPreset.VANILLA_ENHANCED;
}
/**
* Get the current quality level.
*/
public static ShaderQuality getCurrentQuality() {
ShaderCollection sc = getShaderCollection();
return sc != null ? sc.getQuality() : ShaderQuality.LOW;
}
/**
* Check if shaders are currently active.
*/
public static boolean areShadersActive() {
ShaderCollection sc = getShaderCollection();
return sc != null && sc.isEnabled();
}
/**
* Get the detected capabilities.
*/
public static ShaderCollection.ShaderCapabilities getCapabilities() {
ShaderCollection sc = getShaderCollection();
return sc != null ? sc.getCapabilities() : new ShaderCollection.ShaderCapabilities();
}
/**
* One-step initialisation for client developers.
* This is the main entry point - call this once during mod init.
*
* @param renderer The GameRenderer instance from Eaglercraft
* @return The ShaderCollection instance for further configuration
*/
public static ShaderCollection init(GameRenderer renderer) {
return ShaderCollection.init(renderer);
}
}
@@ -0,0 +1,301 @@
package com.eaglercraft.shaders;
import net.lax1dude.eaglercraft.opengl.EaglercraftGPU;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
/**
* Main entry point for the Eaglercraft Shader Collection.
* Provides a simple one-step integration API:
* <pre>
* ShaderCollection.init(renderer);
* ShaderCollection.enable("nightfall");
* ShaderCollection.setQuality(ShaderQuality.LOW);
* ShaderCollection.disable();
* </pre>
*/
@OnlyIn(Dist.CLIENT)
public class ShaderCollection {
private static final Logger LOGGER = LogManager.getLogger();
private static ShaderCollection instance;
private final GameRenderer gameRenderer;
private final IResourceManager resourceManager;
private final Map<String, ShaderProgram> programCache = new HashMap<>();
private final ShaderCapabilities capabilities;
private ShaderPreset currentPreset = ShaderPreset.VANILLA_ENHANCED;
private ShaderQuality currentQuality = ShaderQuality.LOW;
private boolean enabled = false;
private ShaderGroup currentShaderGroup = null;
private boolean initialised = false;
private boolean capabilitiesDetected = false;
private ShaderCollection(GameRenderer renderer) {
this.gameRenderer = renderer;
this.resourceManager = Minecraft.getInstance().getResourceManager();
this.capabilities = new ShaderCapabilities();
}
/**
* Initialise the shader collection with the game renderer.
* This should be called once during client startup.
*
* @param renderer The GameRenderer instance
* @return The ShaderCollection instance for chaining
*/
public static ShaderCollection init(GameRenderer renderer) {
if (instance == null) {
instance = new ShaderCollection(renderer);
instance.detectCapabilities();
instance.initialised = true;
LOGGER.info("Eaglercraft Shader Collection initialised");
}
return instance;
}
/**
* Get the singleton instance.
* @return The ShaderCollection instance, or null if not initialised
*/
public static ShaderCollection getInstance() {
return instance;
}
/**
* Check if the shader collection has been initialised.
*/
public static boolean isInitialised() {
return instance != null && instance.initialised;
}
/**
* Enable a shader preset by ID.
* @param presetId The preset ID (e.g., "vanilla_enhanced", "nightfall", "bright")
* @return true if the preset was successfully enabled
*/
public boolean enable(String presetId) {
ShaderPreset preset = ShaderPreset.fromId(presetId);
return enable(preset);
}
/**
* Enable a shader preset.
* @param preset The preset to enable
* @return true if the preset was successfully enabled
*/
public boolean enable(ShaderPreset preset) {
if (!initialised) {
LOGGER.warn("ShaderCollection not initialised, call init() first");
return false;
}
if (!capabilities.supportsShaders()) {
LOGGER.warn("Shaders not supported on this platform");
return false;
}
try {
// Close existing shader group
if (currentShaderGroup != null) {
currentShaderGroup.close();
currentShaderGroup = null;
}
// Load the new shader program
String programName = getProgramName(preset, currentQuality);
ShaderGroup shaderGroup = new ShaderGroup(
Minecraft.getInstance().getTextureManager(),
resourceManager,
Minecraft.getInstance().getFramebuffer(),
new ResourceLocation(programName)
);
// Create framebuffers
shaderGroup.createBindFramebuffers(
Minecraft.getInstance().mainWindow.getFramebufferWidth(),
Minecraft.getInstance().mainWindow.getFramebufferHeight()
);
currentShaderGroup = shaderGroup;
currentPreset = preset;
enabled = true;
LOGGER.info("Enabled shader preset: {} at quality: {}", preset.getDisplayName(), currentQuality.getDisplayName());
return true;
} catch (Exception e) {
LOGGER.error("Failed to enable shader preset: " + preset.getId(), e);
fallbackToVanilla();
return false;
}
}
/**
* Set the quality level for the current preset.
* Requires re-enabling the preset to take effect.
* @param quality The quality level
*/
public void setQuality(ShaderQuality quality) {
if (currentQuality != quality) {
currentQuality = quality;
if (enabled) {
enable(currentPreset);
}
}
}
/**
* Get the current quality level.
*/
public ShaderQuality getQuality() {
return currentQuality;
}
/**
* Get the currently active preset.
*/
public ShaderPreset getCurrentPreset() {
return currentPreset;
}
/**
* Check if shaders are currently enabled.
*/
public boolean isEnabled() {
return enabled && currentShaderGroup != null;
}
/**
* Disable shaders and return to vanilla rendering.
*/
public void disable() {
if (currentShaderGroup != null) {
currentShaderGroup.close();
currentShaderGroup = null;
}
enabled = false;
LOGGER.info("Shaders disabled, returned to vanilla rendering");
}
/**
* Toggle shaders on/off with the current preset.
*/
public void toggle() {
if (enabled) {
disable();
} else {
enable(currentPreset);
}
}
/**
* Render the current shader (called from GameRenderer).
* @param partialTicks Partial tick time for animation
*/
public void render(float partialTicks) {
if (enabled && currentShaderGroup != null && capabilities.supportsShaders()) {
try {
currentShaderGroup.render(partialTicks);
} catch (Exception e) {
LOGGER.error("Shader render error, falling back to vanilla", e);
fallbackToVanilla();
}
}
}
/**
* Update shader framebuffer size (call on window resize).
* @param width New framebuffer width
* @param height New framebuffer height
*/
public void updateFramebufferSize(int width, int height) {
if (currentShaderGroup != null) {
currentShaderGroup.createBindFramebuffers(width, height);
}
}
/**
* Reload shaders (call after resource pack changes).
*/
public void reload() {
if (enabled) {
enable(currentPreset);
}
}
/**
* Get the detected shader capabilities.
*/
public ShaderCapabilities getCapabilities() {
return capabilities;
}
private String getProgramName(ShaderPreset preset, ShaderQuality quality) {
return preset.getShaderProgramName() + "_" + quality.getId();
}
private void detectCapabilities() {
if (capabilitiesDetected) return;
capabilitiesDetected = true;
// Detect WebGL/OpenGL capabilities
capabilities.webgl2 = EaglercraftGPU.glIsWebGL2();
capabilities.maxTextureSize = EaglercraftGPU.glGetInteger(0x0D33); // GL_MAX_TEXTURE_SIZE
capabilities.maxVertexUniforms = EaglercraftGPU.glGetInteger(0x8B4A); // GL_MAX_VERTEX_UNIFORM_VECTORS
capabilities.maxFragmentUniforms = EaglercraftGPU.glGetInteger(0x8DFD); // GL_MAX_FRAGMENT_UNIFORM_VECTORS
capabilities.maxVaryingVectors = EaglercraftGPU.glGetInteger(0x8DFC); // GL_MAX_VARYING_VECTORS
capabilities.supportsDerivatives = EaglercraftGPU.glGetExtension("OES_standard_derivatives") != null;
capabilities.supportsFragDepth = EaglercraftGPU.glGetExtension("EXT_frag_depth") != null;
capabilities.supportsDrawBuffers = EaglercraftGPU.glGetExtension("WEBGL_draw_buffers") != null;
LOGGER.info("Shader capabilities detected: WebGL2={}, MaxTex={}, MaxVertUni={}, MaxFragUni={}",
capabilities.webgl2, capabilities.maxTextureSize,
capabilities.maxVertexUniforms, capabilities.maxFragmentUniforms);
}
private void fallbackToVanilla() {
if (currentShaderGroup != null) {
try {
currentShaderGroup.close();
} catch (Exception ignored) {}
currentShaderGroup = null;
}
enabled = false;
}
/**
* Shader capability detection results.
*/
@OnlyIn(Dist.CLIENT)
public static class ShaderCapabilities {
public boolean webgl2 = false;
public int maxTextureSize = 2048;
public int maxVertexUniforms = 256;
public int maxFragmentUniforms = 256;
public int maxVaryingVectors = 16;
public boolean supportsDerivatives = false;
public boolean supportsFragDepth = false;
public boolean supportsDrawBuffers = false;
public boolean supportsShaders() {
return maxFragmentUniforms >= 64 && maxVertexUniforms >= 64;
}
public boolean isLowEnd() {
return !webgl2 || maxFragmentUniforms < 256 || maxTextureSize < 4096;
}
}
}
@@ -0,0 +1,78 @@
package com.eaglercraft.shaders;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Example Forge mod entry point demonstrating one-step integration.
*
* To use this shader collection in your Eaglercraft client:
*
* 1. Add this mod to your project dependencies
* 2. In your client initialization code, call:
* <pre>
* EaglercraftShaderIntegration.install(gameRenderer);
* </pre>
*
* Or if using Forge mod loading, this mod will auto-initialize.
*/
@Mod("eagler_shaders")
@OnlyIn(Dist.CLIENT)
public class ShaderCollectionMod {
private static final Logger LOGGER = LogManager.getLogger();
private static boolean initialised = false;
public ShaderCollectionMod() {
// Register for client setup event
}
@SubscribeEvent
public void onClientSetup(FMLClientSetupEvent event) {
// This runs on the client thread after Minecraft is initialised
event.enqueueWork(() -> {
initShaders();
});
}
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
// Ensure shaders are initialised after resource reload
if (!initialised) {
initShaders();
}
}
private void initShaders() {
try {
Minecraft mc = Minecraft.getInstance();
GameRenderer gameRenderer = mc.gameRenderer;
if (gameRenderer != null) {
EaglercraftShaderIntegration.install(gameRenderer);
initialised = true;
LOGGER.info("Eaglercraft Shader Collection auto-initialised");
}
} catch (Exception e) {
LOGGER.error("Failed to auto-initialise Eaglercraft Shader Collection", e);
}
}
/**
* Manual initialisation for non-Forge environments.
* Call this from your client code after GameRenderer is created.
*/
public static void manualInit(GameRenderer gameRenderer) {
if (!initialised && gameRenderer != null) {
EaglercraftShaderIntegration.install(gameRenderer);
initialised = true;
}
}
}
@@ -0,0 +1,87 @@
package com.eaglercraft.shaders;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/**
* Shader presets available in the collection.
* LIGHT presets: Vanilla Enhanced, Bright, Soft
* DARK presets: Nightfall, Noir, Abyss
*/
@OnlyIn(Dist.CLIENT)
public enum ShaderPreset {
// LIGHT PRESETS
VANILLA_ENHANCED("vanilla_enhanced", "Vanilla Enhanced", ShaderCategory.LIGHT,
"Improved colour balance, better sunlight, lightweight fog, improved sky"),
BRIGHT("bright", "Bright", ShaderCategory.LIGHT,
"Brighter lighting, clearer atmosphere, more vibrant colours"),
SOFT("soft", "Soft", ShaderCategory.LIGHT,
"Gentle colour transitions, reduced harsh lighting, subtle atmosphere"),
// DARK PRESETS
NIGHTFALL("nightfall", "Nightfall", ShaderCategory.DARK,
"Darker ambient, increased contrast, atmospheric fog, nighttime mood"),
NOIR("noir", "Noir", ShaderCategory.DARK,
"High contrast, dark appearance, reduced saturation, strong visual identity"),
ABYSS("abyss", "Abyss", ShaderCategory.DARK,
"Deep shadows, cool/dark colour grading, atmospheric darkness");
private final String id;
private final String displayName;
private final ShaderCategory category;
private final String description;
ShaderPreset(String id, String displayName, ShaderCategory category, String description) {
this.id = id;
this.displayName = displayName;
this.category = category;
this.description = description;
}
public String getId() {
return id;
}
public String getDisplayName() {
return displayName;
}
public ShaderCategory getCategory() {
return category;
}
public String getDescription() {
return description;
}
public String getShaderProgramName() {
return "eagler_shaders/" + id;
}
public static ShaderPreset fromId(String id) {
for (ShaderPreset preset : values()) {
if (preset.id.equalsIgnoreCase(id)) {
return preset;
}
}
return VANILLA_ENHANCED;
}
public static ShaderPreset[] getLightPresets() {
return new ShaderPreset[]{VANILLA_ENHANCED, BRIGHT, SOFT};
}
public static ShaderPreset[] getDarkPresets() {
return new ShaderPreset[]{NIGHTFALL, NOIR, ABYSS};
}
public static ShaderPreset[] getAllPresets() {
return values();
}
}
@OnlyIn(Dist.CLIENT)
enum ShaderCategory {
LIGHT,
DARK
}
@@ -0,0 +1,55 @@
package com.eaglercraft.shaders;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/**
* Quality levels for shader presets.
* LOW: Aggressively optimised for weak integrated GPUs and older devices.
* MEDIUM: Balanced visuals and FPS.
* HIGH: Additional optional visual improvements if stable.
*/
@OnlyIn(Dist.CLIENT)
public enum ShaderQuality {
LOW("low", "Low", "Optimised for weak integrated GPUs"),
MEDIUM("medium", "Medium", "Balanced visuals and performance"),
HIGH("high", "High", "Best visuals on capable hardware");
private final String id;
private final String displayName;
private final String description;
ShaderQuality(String id, String displayName, String description) {
this.id = id;
this.displayName = displayName;
this.description = description;
}
public String getId() {
return id;
}
public String getDisplayName() {
return displayName;
}
public String getDescription() {
return description;
}
public static ShaderQuality fromId(String id) {
for (ShaderQuality quality : values()) {
if (quality.id.equalsIgnoreCase(id)) {
return quality;
}
}
return LOW;
}
public static ShaderQuality fromOrdinal(int ordinal) {
if (ordinal >= 0 && ordinal < values().length) {
return values()[ordinal];
}
return LOW;
}
}
@@ -0,0 +1,27 @@
modLoader="javafml"
loaderVersion="[36,)"
license="Apache-2.0"
issueTrackerURL="https://github.com/eaglercraft/eagler-shaders/issues"
[[mods]]
modId="eagler_shaders"
version="1.0.0"
displayName="Eaglercraft Shader Collection"
description="A lightweight shader collection for Eaglercraft with light and dark presets optimised for low-end devices."
authors="Eaglercraft Shaders Team"
credits="Based on Eaglercraft's shader architecture"
displayURL="https://github.com/eaglercraft/eagler-shaders"
[[dependencies.eagler_shaders]]
modId="forge"
mandatory=true
versionRange="[36,)"
ordering="NONE"
side="CLIENT"
[[dependencies.eagler_shaders]]
modId="minecraft"
mandatory=true
versionRange="[1.16.5,1.17)"
ordering="NONE"
side="CLIENT"
@@ -0,0 +1,122 @@
// Eaglercraft Shader Collection - Abyss LOW
// Deep shadows, cool/dark color grading, atmospheric darkness, lightweight distance fog
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
vec3 srgbToLinear(vec3 c) { return c * c; }
vec3 linearToSrgb(vec3 c) { return sqrt(max(c, vec3(0.0))); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Deep shadows - crush blacks
color = adjustBrightness(color, -0.25);
// Increased contrast for depth
color = adjustContrast(color, 1.3);
// Cool color grading
color = adjustSaturation(color, 0.6);
color = adjustTemperature(color, -0.4);
// Blue/green tint for abyssal feel
color *= vec3(0.85, 0.95, 1.05);
// Preserve some shadow detail
color = max(color, vec3(0.01));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Heavy distance fog
float fogFactor = fogFactorExp2(texCoord.y * 1.5, FogDensity);
result = applyFog(result, FogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapReinhard(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/abyss_low",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.75 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.02, 0.05, 0.08 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.025 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.01, 0.01, 0.01 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.6 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.3 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.25 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.4 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.35 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.4 ] }
]
}
@@ -0,0 +1,135 @@
// Eaglercraft Shader Collection - Abyss MEDIUM
// Deep shadows with cool color grading and distance fog
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
float sunHeight = sin(DayTime * TAU);
float nightIntensity = smoothstep(-0.2, 0.2, -sunHeight);
// Deep shadows
float dynBrightness = mix(-0.15, -0.3, nightIntensity);
color = adjustBrightness(color, dynBrightness);
// Increased contrast for depth
float dynContrast = mix(1.2, 1.4, nightIntensity);
color = adjustContrast(color, dynContrast);
// Cool color grading
float dynSat = mix(0.55, 0.7, nightIntensity);
color = adjustSaturation(color, dynSat);
color = adjustTemperature(color, Temperature);
// Blue/green tint for abyssal feel
color *= vec3(0.88, 0.95, 1.05);
// Preserve some shadow detail
color = max(color, vec3(0.01));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float nightIntensity = smoothstep(-0.2, 0.2, -sin(DayTime * TAU));
float fogFactor = fogFactorExp2(texCoord.y * 1.5, FogDensity * 0.7 * (0.7 + 0.3 * nightIntensity));
result = applyFog(result, FogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/abyss_medium",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.75 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.02, 0.05, 0.08 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.025 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.01, 0.01, 0.01 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.6 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.3 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.2 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.4 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.35 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.4 ] }
]
}
@@ -0,0 +1,190 @@
// Eaglercraft Shader Collection - Base Fragment Shader Template
// This is the base template. Specific presets extend this with their own color grading.
#version 120
// ============================================================
// UNIFORMS (Set by ShaderInstance from JSON)
// ============================================================
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
// Quality and feature flags (set per quality level)
uniform int QUALITY_LEVEL; // 0=LOW, 1=MEDIUM, 2=HIGH
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
// Fog uniforms
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
// Color grading uniforms
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
// Vignette
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
// Time-based animation
uniform float DayTime; // 0-1 day cycle
varying vec2 texCoord;
varying vec2 screenUV;
// ============================================================
// SHARED FUNCTIONS (inlined for GLSL ES compatibility)
// ============================================================
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) {
return pow(max(c, vec3(0.0)), vec3(2.2));
}
vec3 linearToSrgb(vec3 c) {
return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2));
}
vec3 srgbToLinearFast(vec3 c) {
return c * c;
}
vec3 linearToSrgbFast(vec3 c) {
return sqrt(max(c, vec3(0.0)));
}
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) {
return (color - 0.5) * contrast + 0.5;
}
vec3 adjustBrightness(vec3 color, float brightness) {
return color + brightness;
}
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) {
return 1.0 - exp(-density * depth);
}
float fogFactorExp2(float depth, float density) {
float f = density * depth;
return 1.0 - exp(-f * f);
}
float fogFactorLinear(float depth, float start, float end) {
return smoothstep(start, end, depth);
}
vec3 applyFog(vec3 color, vec3 fogColor, float factor) {
return mix(color, fogColor, factor);
}
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) {
return color / (color + 1.0);
}
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) {
return pow(max(color, vec3(0.0)), vec3(1.0 / gamma));
}
// ============================================================
// PRESET-SPECIFIC COLOR GRADING (OVERRIDE IN PRESET SHADERS)
// ============================================================
// This function is overridden by each preset
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
return color;
}
// ============================================================
// MAIN FRAGMENT SHADER
// ============================================================
void main() {
// Sample the input color
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
// Convert to linear space for processing
result = srgbToLinear(result);
// Apply preset-specific color grading
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
// Apply fog if enabled
if (ENABLE_FOG) {
// For post-process shaders, we don't have depth, so use screen-space approximation
// This is a simplified fog - real fog needs depth buffer
float fogFactor = 0.0;
// Use screen Y as depth approximation for sky fog
fogFactor = smoothstep(0.3, 0.8, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity);
}
// Apply vignette
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
// Tonemapping
if (ENABLE_TONEMAP) {
// Use filmic for quality >= MEDIUM, Reinhard for LOW
if (QUALITY_LEVEL >= 1) {
result = tonemapFilmic(result);
} else {
result = tonemapReinhard(result);
}
}
// Convert back to sRGB
result = linearToSrgb(result);
// Apply gamma correction
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,20 @@
// Eaglercraft Shader Collection - Base Vertex Shader
// Used by all shader presets
#version 120
attribute vec4 Position;
uniform mat4 ProjMat;
uniform vec2 OutSize;
varying vec2 texCoord;
varying vec2 screenUV;
void main() {
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
gl_Position = vec4(outPos.xy, 0.2, 1.0);
texCoord = Position.xy / OutSize;
screenUV = texCoord;
}
@@ -0,0 +1,166 @@
// Eaglercraft Shader Collection - Bright HIGH
// Best bright visuals with dithering and dynamic effects
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform bool ENABLE_DITHER;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
float blueNoise(vec2 uv) {
return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
}
vec3 applyDither(vec3 color) {
float noise = blueNoise(screenUV * ScreenSize + Time * 100.0) - 0.5;
return color + noise / 255.0;
}
vec3 getSkyColor(float dayTime) {
float sunAngle = dayTime * TAU;
float sunHeight = sin(sunAngle);
vec3 dawnColor = vec3(1.0, 0.55, 0.25);
vec3 dayColor = vec3(0.55, 0.78, 0.98);
vec3 nightColor = vec3(0.08, 0.08, 0.18);
if (sunHeight > 0.2) {
float t = smoothstep(0.2, 1.0, sunHeight);
return mix(dawnColor, dayColor, t);
} else if (sunHeight > -0.2) {
float t = smoothstep(-0.2, 0.2, sunHeight);
return mix(nightColor, dawnColor, t);
} else {
return nightColor;
}
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
float sunHeight = sin(DayTime * TAU);
float dynBrightness = mix(0.03, 0.18, smoothstep(-0.2, 0.5, sunHeight));
color = adjustBrightness(color, dynBrightness);
float dynSat = mix(1.1, 1.25, smoothstep(-0.2, 0.5, sunHeight));
color = adjustSaturation(color, dynSat);
float dynTemp = mix(0.05, 0.35, smoothstep(-0.2, 0.5, sunHeight));
color = adjustTemperature(color, dynTemp);
color = adjustContrast(color, Contrast);
vec3 skyColor = getSkyColor(DayTime);
color = mix(color, color * skyColor, 0.1);
// Lift/Gamma/Gain
color = (color - Lift) / (Gain - Lift);
color = pow(max(color, vec3(0.0)), 1.0 / Gamma);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float fogFactor = fogFactorExp2(texCoord.y * 2.5, FogDensity * 0.5);
float sunHeight = sin(DayTime * TAU);
vec3 dynamicFogColor = mix(FogColor, vec3(0.95, 0.85, 0.6), smoothstep(-0.2, 0.4, sunHeight));
result = applyFog(result, dynamicFogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
if (ENABLE_DITHER) {
result = applyDither(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,35 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/bright_high",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 2 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_DITHER", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.75, 0.8, 0.9 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.01 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.2 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.08 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.12 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.25 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.12 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.45 ] }
]
}
@@ -0,0 +1,112 @@
// Eaglercraft Shader Collection - Bright LOW
// Brighter lighting, clearer atmosphere, more vibrant colors
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
vec3 srgbToLinear(vec3 c) { return c * c; }
vec3 linearToSrgb(vec3 c) { return sqrt(max(c, vec3(0.0))); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Brighter overall
color = adjustBrightness(color, 0.1);
// More vibrant
color = adjustSaturation(color, 1.2);
// Slight contrast boost
color = adjustContrast(color, 1.05);
// Warmer temperature
color = adjustTemperature(color, 0.2);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Lighter fog
float fogFactor = smoothstep(0.5, 0.95, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity * 0.2);
}
if (ENABLE_TONEMAP) {
result = tonemapReinhard(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/bright_low",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.8, 0.85, 0.95 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.005 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.2 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.05 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.2 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.5 ] }
]
}
@@ -0,0 +1,151 @@
// Eaglercraft Shader Collection - Bright MEDIUM
// Balanced bright visuals with dynamic sky colors
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 getSkyColor(float dayTime) {
float sunAngle = dayTime * TAU;
float sunHeight = sin(sunAngle);
vec3 dawnColor = vec3(1.0, 0.6, 0.3);
vec3 dayColor = vec3(0.6, 0.8, 1.0);
vec3 nightColor = vec3(0.1, 0.1, 0.2);
if (sunHeight > 0.2) {
float t = smoothstep(0.2, 1.0, sunHeight);
return mix(dawnColor, dayColor, t);
} else if (sunHeight > -0.2) {
float t = smoothstep(-0.2, 0.2, sunHeight);
return mix(nightColor, dawnColor, t);
} else {
return nightColor;
}
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Dynamic brightness based on time of day
float sunHeight = sin(DayTime * TAU);
float dynBrightness = mix(0.05, 0.15, smoothstep(-0.2, 0.5, sunHeight));
color = adjustBrightness(color, dynBrightness);
// Vibrant colors
color = adjustSaturation(color, Saturation);
// Warm temperature, cooler at night
float dynTemp = mix(0.1, 0.3, smoothstep(-0.2, 0.5, sunHeight));
color = adjustTemperature(color, dynTemp);
// Subtle contrast
color = adjustContrast(color, Contrast);
// Sky color influence
vec3 skyColor = getSkyColor(DayTime);
color = mix(color, color * skyColor, 0.08);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float fogFactor = fogFactorExp2(texCoord.y * 2.0, FogDensity * 0.4);
vec3 dynamicFogColor = mix(FogColor, vec3(0.9, 0.8, 0.6), smoothstep(-0.2, 0.4, sin(DayTime * TAU)));
result = applyFog(result, dynamicFogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/bright_medium",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.8, 0.85, 0.95 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.008 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.15 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.05 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.2 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.5 ] }
]
}
@@ -0,0 +1,198 @@
// Eaglercraft Shader Collection - Nightfall HIGH
// Deep atmospheric darkness with subtle colored lighting
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform bool ENABLE_DITHER;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
float blueNoise(vec2 uv) {
return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
}
vec3 applyDither(vec3 color) {
float noise = blueNoise(screenUV * ScreenSize + Time * 100.0) - 0.5;
return color + noise / 255.0;
}
// Night sky with subtle moon
vec3 getNightSkyColor(float dayTime) {
float sunHeight = sin(dayTime * TAU);
vec3 deepNight = vec3(0.015, 0.015, 0.04);
vec3 twilight = vec3(0.12, 0.08, 0.18);
vec3 moonlit = vec3(0.06, 0.06, 0.12);
if (sunHeight < -0.3) {
return deepNight;
} else if (sunHeight < -0.1) {
float t = smoothstep(-0.3, -0.1, sunHeight);
return mix(deepNight, twilight, t);
} else if (sunHeight < 0.1) {
float t = smoothstep(-0.1, 0.1, sunHeight);
return mix(twilight, moonlit, t);
} else {
return moonlit;
}
}
// Subtle moon glow
float moonGlow(vec2 uv, float dayTime) {
float sunHeight = sin(dayTime * TAU);
if (sunHeight < -0.1) {
vec2 moonPos = vec2(0.8, 0.2);
float dist = distance(uv, moonPos);
float glow = smoothstep(0.3, 0.0, dist) * 0.15;
return glow * smoothstep(-0.3, -0.1, sunHeight);
}
return 0.0;
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
float sunHeight = sin(DayTime * TAU);
float nightIntensity = smoothstep(-0.2, 0.2, -sunHeight);
// Base darkness with smooth transition
float baseDarkness = mix(-0.03, -0.3, nightIntensity);
color = adjustBrightness(color, baseDarkness);
// Contrast
float dynContrast = mix(1.08, 1.4, nightIntensity);
color = adjustContrast(color, dynContrast);
// Desaturation
float dynSat = mix(0.95, 0.4, nightIntensity);
color = adjustSaturation(color, dynSat);
// Temperature - cool nights, warm twilight
float dynTemp = mix(-0.05, -0.5, nightIntensity);
if (sunHeight > -0.2 && sunHeight < 0.0) {
dynTemp = mix(-0.5, 0.15, smoothstep(-0.2, 0.0, sunHeight));
}
color = adjustTemperature(color, dynTemp);
// Sky color influence
vec3 skyColor = getNightSkyColor(DayTime);
color = mix(color, color * skyColor * 3.0, 0.2 * nightIntensity);
// Moon glow
float mg = moonGlow(screenUV, DayTime);
color += vec3(mg * 0.1, mg * 0.1, mg * 0.15);
// Lift shadows to preserve detail
color = max(color, vec3(0.005));
// Lift/Gamma/Gain
color = (color - Lift) / (Gain - Lift);
color = pow(max(color, vec3(0.0)), 1.0 / Gamma);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float nightIntensity = smoothstep(-0.2, 0.2, -sin(DayTime * TAU));
float fogFactor = fogFactorExp2(texCoord.y * 2.5, FogDensity * 0.8 * nightIntensity);
vec3 dynamicFogColor = mix(FogColor, vec3(0.08, 0.08, 0.12), nightIntensity);
result = applyFog(result, dynamicFogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
if (ENABLE_DITHER) {
result = applyDither(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,35 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/nightfall_high",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.75 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 2 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_DITHER", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.04, 0.04, 0.08 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.03 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.005, 0.005, 0.01 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.35 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.25 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.4 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.4 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.35 ] }
]
}
@@ -0,0 +1,120 @@
// Eaglercraft Shader Collection - Nightfall LOW
// Darker ambient, increased contrast, atmospheric fog - low end optimised
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
vec3 srgbToLinear(vec3 c) { return c * c; }
vec3 linearToSrgb(vec3 c) { return sqrt(max(c, vec3(0.0))); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Darker ambient - reduce overall brightness
color = adjustBrightness(color, -0.15);
// Increase contrast for moodier look
color = adjustContrast(color, 1.2);
// Desaturate slightly for atmospheric feel
color = adjustSaturation(color, 0.7);
// Cool temperature for night feel
color = adjustTemperature(color, -0.3);
// Lift shadows slightly to avoid pure black
color = max(color, vec3(0.02));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Heavy fog for atmospheric darkness
float fogFactor = smoothstep(0.3, 0.85, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity * 0.5);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapReinhard(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/nightfall_low",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.05, 0.05, 0.1 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.02 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.02, 0.02, 0.03 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.7 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.2 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.15 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.3 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.3 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.5 ] }
]
}
@@ -0,0 +1,169 @@
// Eaglercraft Shader Collection - Nightfall MEDIUM
// Balanced dark atmosphere with dynamic time-based lighting
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
// Night sky color
vec3 getNightSkyColor(float dayTime) {
float sunHeight = sin(dayTime * TAU);
vec3 deepNight = vec3(0.02, 0.02, 0.05);
vec3 twilight = vec3(0.15, 0.1, 0.2);
vec3 moonlit = vec3(0.08, 0.08, 0.15);
if (sunHeight < -0.3) {
// Deep night
return deepNight;
} else if (sunHeight < -0.1) {
// Twilight transition
float t = smoothstep(-0.3, -0.1, sunHeight);
return mix(deepNight, twilight, t);
} else if (sunHeight < 0.1) {
// Dawn transition
float t = smoothstep(-0.1, 0.1, sunHeight);
return mix(twilight, moonlit, t);
} else {
// Day (shouldn't happen for Nightfall but handle gracefully)
return moonlit;
}
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Dynamic darkness based on time of day
float sunHeight = sin(DayTime * TAU);
float nightIntensity = smoothstep(-0.2, 0.2, -sunHeight);
// Base darkness
float baseDarkness = mix(-0.05, -0.25, nightIntensity);
color = adjustBrightness(color, baseDarkness);
// Contrast increases at night
float dynContrast = mix(1.1, 1.35, nightIntensity);
color = adjustContrast(color, dynContrast);
// Desaturation at night
float dynSat = mix(0.9, 0.5, nightIntensity);
color = adjustSaturation(color, dynSat);
// Cool temperature at night, slight warm at twilight
float dynTemp = mix(-0.1, -0.4, nightIntensity);
if (sunHeight > -0.2 && sunHeight < 0.0) {
dynTemp = mix(-0.4, 0.1, smoothstep(-0.2, 0.0, sunHeight));
}
color = adjustTemperature(color, dynTemp);
// Sky color bleed
vec3 skyColor = getNightSkyColor(DayTime);
color = mix(color, color * skyColor * 2.0, 0.15 * nightIntensity);
// Lift shadows to avoid crushing
color = max(color, vec3(0.01));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float nightIntensity = smoothstep(-0.2, 0.2, -sin(DayTime * TAU));
float fogFactor = fogFactorExp2(texCoord.y * 2.0, FogDensity * 0.7 * nightIntensity);
vec3 dynamicFogColor = mix(FogColor, vec3(0.1, 0.1, 0.15), nightIntensity);
result = applyFog(result, dynamicFogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/nightfall_medium",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.75 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.05, 0.05, 0.1 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.025 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.01, 0.01, 0.02 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.6 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.25 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.2 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.35 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.35 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.4 ] }
]
}
@@ -0,0 +1,122 @@
// Eaglercraft Shader Collection - Noir LOW
// High contrast, dark appearance, reduced saturation, strong visual identity
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
vec3 srgbToLinear(vec3 c) { return c * c; }
vec3 linearToSrgb(vec3 c) { return sqrt(max(c, vec3(0.0))); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// High contrast
color = adjustContrast(color, 1.5);
// Heavy desaturation (near monochrome)
color = adjustSaturation(color, 0.2);
// Darker overall
color = adjustBrightness(color, -0.2);
// Slight cool tint
color = adjustTemperature(color, -0.1);
// Crush shadows for noir look
color = max(color, vec3(0.0));
color = pow(color, vec3(1.2));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Minimal fog for noir
float fogFactor = smoothstep(0.6, 0.95, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity * 0.15);
}
if (ENABLE_VIGNETTE) {
// Strong vignette for noir
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapReinhard(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/noir_low",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.05, 0.05, 0.05 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.01 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.2 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.5 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.2 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.1 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.4 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.3 ] }
]
}
@@ -0,0 +1,134 @@
// Eaglercraft Shader Collection - Noir MEDIUM
// High contrast monochrome with dynamic lighting
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
float sunHeight = sin(DayTime * TAU);
float nightIntensity = smoothstep(-0.2, 0.2, -sunHeight);
// High contrast
float dynContrast = mix(1.3, 1.6, nightIntensity);
color = adjustContrast(color, dynContrast);
// Near monochrome
float dynSat = mix(0.15, 0.35, nightIntensity);
color = adjustSaturation(color, dynSat);
// Darker
float dynBrightness = mix(-0.1, -0.25, nightIntensity);
color = adjustBrightness(color, dynBrightness);
// Cool tint
color = adjustTemperature(color, Temperature);
// Crush shadows for noir look
color = max(color, vec3(0.0));
color = pow(color, vec3(1.15));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float fogFactor = smoothstep(0.6, 0.95, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity * 0.2);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/noir_medium",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.05, 0.05, 0.05 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.01 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.25 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.4 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ -0.15 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ -0.1 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.4 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.3 ] }
]
}
@@ -0,0 +1,120 @@
// Eaglercraft Shader Collection - Soft LOW
// Gentle color transitions, reduced harsh lighting, subtle atmosphere
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
vec3 srgbToLinear(vec3 c) { return c * c; }
vec3 linearToSrgb(vec3 c) { return sqrt(max(c, vec3(0.0))); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Reduce harsh contrast
color = adjustContrast(color, 0.9);
// Slightly desaturate for softness
color = adjustSaturation(color, 0.85);
// Gentle warmth
color = adjustTemperature(color, 0.1);
// Slight brightness lift for shadows
color = adjustBrightness(color, 0.02);
// Lift shadows slightly
color = max(color, vec3(0.02));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Soft, gentle fog
float fogFactor = smoothstep(0.4, 0.9, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity * 0.25);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapReinhard(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/soft_low",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.7, 0.75, 0.85 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.008 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.02, 0.02, 0.02 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.85 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 0.9 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.02 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.15 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.6 ] }
]
}
@@ -0,0 +1,153 @@
// Eaglercraft Shader Collection - Soft MEDIUM
// Balanced gentle atmosphere with dynamic sky colors
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
vec3 getSkyColor(float dayTime) {
float sunAngle = dayTime * TAU;
float sunHeight = sin(sunAngle);
vec3 dawnColor = vec3(0.8, 0.7, 0.8);
vec3 dayColor = vec3(0.65, 0.75, 0.9);
vec3 nightColor = vec3(0.15, 0.15, 0.25);
if (sunHeight > 0.2) {
float t = smoothstep(0.2, 1.0, sunHeight);
return mix(dawnColor, dayColor, t);
} else if (sunHeight > -0.2) {
float t = smoothstep(-0.2, 0.2, sunHeight);
return mix(nightColor, dawnColor, t);
} else {
return nightColor;
}
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
float sunHeight = sin(DayTime * TAU);
// Reduced contrast for softness
color = adjustContrast(color, Contrast);
// Slightly desaturated
color = adjustSaturation(color, Saturation);
// Gentle warmth
float dynTemp = mix(0.05, 0.15, smoothstep(-0.2, 0.5, sunHeight));
color = adjustTemperature(color, dynTemp);
// Shadow lift
color = adjustBrightness(color, Brightness);
// Sky color influence
vec3 skyColor = getSkyColor(DayTime);
color = mix(color, color * skyColor, 0.06);
// Lift shadows
color = max(color, vec3(0.02));
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float fogFactor = fogFactorExp2(texCoord.y * 2.0, FogDensity * 0.4);
result = applyFog(result, FogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/soft_medium",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.7, 0.75, 0.85 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.01 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.02, 0.02, 0.02 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 0.85 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 0.9 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.02 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.15 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.6 ] }
]
}
@@ -0,0 +1,249 @@
// Eaglercraft Shader Collection - Shared GLSL Utilities
// This file contains common functions used across all shader presets
// ============================================================
// CONSTANTS
// ============================================================
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
const float DEG2RAD = PI / 180.0;
const float RAD2DEG = 180.0 / PI;
// ============================================================
// COLOR SPACE CONVERSIONS
// ============================================================
// sRGB to linear
vec3 srgbToLinear(vec3 c) {
return pow(max(c, vec3(0.0)), vec3(2.2));
}
// Linear to sRGB
vec3 linearToSrgb(vec3 c) {
return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2));
}
// Approximate sRGB to linear (faster)
vec3 srgbToLinearFast(vec3 c) {
return c * c;
}
// Approximate linear to sRGB (faster)
vec3 linearToSrgbFast(vec3 c) {
return sqrt(max(c, vec3(0.0)));
}
// ============================================================
// COLOR GRADING UTILITIES
// ============================================================
// Lift, Gamma, Gain (3-way color correction)
vec3 liftGammaGain(vec3 color, vec3 lift, vec3 gamma, vec3 gain) {
color = max(color, vec3(0.0));
color = (color - lift) / (gain - lift);
color = pow(max(color, vec3(0.0)), 1.0 / gamma);
return color;
}
// Saturation adjustment
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
// Hue shift (approximate, fast)
vec3 shiftHue(vec3 color, float hueShift) {
// Simple hue rotation in YUV space
float cosA = cos(hueShift);
float sinA = sin(hueShift);
mat3 hueRotate = mat3(
0.299 + 0.701 * cosA + 0.168 * sinA,
0.587 - 0.587 * cosA - 0.330 * sinA,
0.114 - 0.114 * cosA + 0.497 * sinA,
0.299 - 0.299 * cosA - 0.328 * sinA,
0.587 + 0.413 * cosA + 0.035 * sinA,
0.114 - 0.114 * cosA + 0.292 * sinA,
0.299 - 0.300 * cosA + 1.250 * sinA,
0.587 - 0.588 * cosA - 1.050 * sinA,
0.114 + 0.886 * cosA - 0.203 * sinA
);
return hueRotate * color;
}
// Contrast adjustment
vec3 adjustContrast(vec3 color, float contrast) {
return (color - 0.5) * contrast + 0.5;
}
// Brightness adjustment
vec3 adjustBrightness(vec3 color, float brightness) {
return color + brightness;
}
// Color temperature (warm/cool)
vec3 adjustTemperature(vec3 color, float temp) {
// temp: -1.0 (cool) to 1.0 (warm)
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
// ============================================================
// FOG UTILITIES
// ============================================================
// Exponential fog factor
float fogFactorExp(float depth, float density) {
return 1.0 - exp(-density * depth);
}
// Exponential squared fog factor
float fogFactorExp2(float depth, float density) {
float f = density * depth;
return 1.0 - exp(-f * f);
}
// Linear fog factor
float fogFactorLinear(float depth, float start, float end) {
return smoothstep(start, end, depth);
}
// Apply fog to color
vec3 applyFog(vec3 color, vec3 fogColor, float factor) {
return mix(color, fogColor, factor);
}
// ============================================================
// LIGHTING UTILITIES
// ============================================================
// Simple sunlight direction calculation
vec3 getSunDirection(float timeOfDay) {
float angle = timeOfDay * TAU;
return normalize(vec3(sin(angle), cos(angle * 0.5), cos(angle)));
}
// Ambient light calculation
vec3 getAmbientLight(vec3 normal, vec3 ambientColor, vec3 skyColor, vec3 groundColor) {
float skyFactor = normal.y * 0.5 + 0.5;
return mix(groundColor, skyColor, skyFactor) * ambientColor;
}
// ============================================================
// NOISE UTILITIES (Cheap, for LOW quality)
// ============================================================
// Simple hash function
float hash(float x) {
return fract(sin(x * 12.9898) * 43758.5453);
}
float hash2(vec2 p) {
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}
float hash3(vec3 p) {
return fract(sin(dot(p, vec3(127.1, 311.7, 74.7))) * 43758.5453);
}
// Value noise (cheap)
float valueNoise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f); // smoothstep
float a = hash2(i + vec2(0.0, 0.0));
float b = hash2(i + vec2(1.0, 0.0));
float c = hash2(i + vec2(0.0, 1.0));
float d = hash2(i + vec2(1.0, 1.0));
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
}
// ============================================================
// SCREEN-SPACE UTILITIES
// ============================================================
// Reconstruct view-space position from depth
vec3 reconstructPosition(vec2 uv, float depth, mat4 invProjMat) {
vec4 clipPos = vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
vec4 viewPos = invProjMat * clipPos;
return viewPos.xyz / viewPos.w;
}
// Get depth from depth texture
float getDepth(vec2 uv, sampler2D depthTex) {
return texture2D(depthTex, uv).r;
}
// ============================================================
// TONEMAPPING
// ============================================================
// Reinhard tonemapping
vec3 tonemapReinhard(vec3 color) {
return color / (color + 1.0);
}
// ACES filmic tonemapping (approximate)
vec3 tonemapAces(vec3 color) {
color *= 0.6;
const mat3 acesIn = mat3(
0.59719, 0.35458, 0.04823,
0.07600, 0.90834, 0.01566,
0.02840, 0.13383, 0.83777
);
const mat3 acesOut = mat3(
1.60475, -0.53108, -0.07367,
-0.10208, 1.10813, -0.00605,
-0.00327, -0.07276, 1.07602
);
color = acesIn * color;
color = color * (color + 0.0245786) / (color * (0.983729 * color + 0.4329510) + 0.238081);
return acesOut * color;
}
// Simple filmic tonemap (cheaper)
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
// ============================================================
// VIGNETTE
// ============================================================
// Radial vignette
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
// ============================================================
// GAMMA CORRECTION
// ============================================================
// Apply gamma correction
vec3 applyGamma(vec3 color, float gamma) {
return pow(max(color, vec3(0.0)), vec3(1.0 / gamma));
}
// ============================================================
// QUALITY DEFINES (Set via shader program JSON uniforms)
// ============================================================
// These are set as uniforms from the Java side:
// uniform int QUALITY_LEVEL; // 0=LOW, 1=MEDIUM, 2=HIGH
// uniform bool ENABLE_FOG;
// uniform bool ENABLE_COLOR_GRADING;
// uniform bool ENABLE_TONEMAP;
// uniform bool ENABLE_VIGNETTE;
// uniform bool ENABLE_NOISE;
// Helper macros for conditional compilation
// Note: GLSL ES doesn't support #ifdef on uniforms, so use runtime branching
// But we can use preprocessor defines at compile time via the JSON
@@ -0,0 +1,175 @@
// Eaglercraft Shader Collection - Vanilla Enhanced HIGH
// Best visuals on capable hardware
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform bool ENABLE_DITHER;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
// Blue noise dithering for banding reduction
float blueNoise(vec2 uv) {
return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
}
vec3 applyDither(vec3 color) {
float noise = blueNoise(screenUV * ScreenSize + Time * 100.0) - 0.5;
return color + noise / 255.0;
}
// Sky color gradient based on time of day
vec3 getSkyColor(float dayTime) {
float sunAngle = dayTime * TAU;
float sunHeight = sin(sunAngle);
vec3 dawnColor = vec3(1.0, 0.45, 0.25);
vec3 dayColor = vec3(0.45, 0.68, 0.95);
vec3 nightColor = vec3(0.04, 0.04, 0.12);
if (sunHeight > 0.2) {
float t = smoothstep(0.2, 1.0, sunHeight);
return mix(dawnColor, dayColor, t);
} else if (sunHeight > -0.2) {
float t = smoothstep(-0.2, 0.2, sunHeight);
return mix(nightColor, dawnColor, t);
} else {
float starBrightness = 0.5 + 0.5 * sin(Time * 2.0 + screenUV.x * 100.0) * sin(Time * 1.5 + screenUV.y * 100.0);
return nightColor + vec3(0.001) * starBrightness;
}
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Dynamic sky color influence
vec3 skyColor = getSkyColor(DayTime);
color = mix(color, color * skyColor, 0.12);
// Temperature shift based on time (warmer at sunrise/sunset)
float sunHeight = sin(DayTime * TAU);
float temp = mix(-0.3, 0.4, smoothstep(-0.3, 0.5, sunHeight));
color = adjustTemperature(color, temp);
// Saturation with slight desaturation at night
float sat = mix(0.9, Saturation, smoothstep(-0.1, 0.3, sunHeight));
color = adjustSaturation(color, sat);
// Contrast
color = adjustContrast(color, Contrast);
// Brightness
color = adjustBrightness(color, Brightness);
// Lift/Gamma/Gain
color = (color - Lift) / (Gain - Lift);
color = pow(max(color, vec3(0.0)), 1.0 / Gamma);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Exponential squared fog with dynamic color
float fogFactor = fogFactorExp2(texCoord.y * 2.5, FogDensity * 0.6);
float sunHeight = sin(DayTime * TAU);
vec3 dynamicFogColor = mix(FogColor, vec3(0.9, 0.6, 0.3), smoothstep(-0.2, 0.4, sunHeight));
result = applyFog(result, dynamicFogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
if (ENABLE_DITHER) {
result = applyDither(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,35 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/vanilla_enhanced_high",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 2 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_DITHER", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.55, 0.65, 0.8 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.02 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.1 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.08 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.02 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.2 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.25 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.35 ] }
]
}
@@ -0,0 +1,115 @@
// Eaglercraft Shader Collection - Vanilla Enhanced LOW
// Minimal overhead, closest to vanilla FPS
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return c * c; }
vec3 linearToSrgb(vec3 c) { return sqrt(max(c, vec3(0.0))); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
// Vanilla Enhanced color grading - subtle improvements
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Slight warmth for better sunlight appearance
color = adjustTemperature(color, 0.1);
// Slight saturation boost
color = adjustSaturation(color, 1.05);
// Subtle contrast improvement
color = adjustContrast(color, 1.03);
// Slight brightness lift for shadows
color = adjustBrightness(color, 0.01);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
float fogFactor = smoothstep(0.4, 0.9, texCoord.y);
result = applyFog(result, FogColor, fogFactor * FogDensity * 0.3);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapReinhard(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/vanilla_enhanced_low",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 0 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.6, 0.7, 0.85 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.01 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.05 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.03 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.01 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.1 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.15 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.5 ] }
]
}
@@ -0,0 +1,160 @@
// Eaglercraft Shader Collection - Vanilla Enhanced MEDIUM
// Balanced visuals and performance
#version 120
uniform sampler2D DiffuseSampler;
uniform vec2 InSize;
uniform vec2 OutSize;
uniform vec2 ScreenSize;
uniform float Time;
uniform mat4 ProjMat;
uniform int QUALITY_LEVEL;
uniform bool ENABLE_FOG;
uniform bool ENABLE_COLOR_GRADING;
uniform bool ENABLE_TONEMAP;
uniform bool ENABLE_VIGNETTE;
uniform vec3 FogColor;
uniform float FogDensity;
uniform float FogStart;
uniform float FogEnd;
uniform vec3 Lift;
uniform vec3 Gamma;
uniform vec3 Gain;
uniform float Saturation;
uniform float Contrast;
uniform float Brightness;
uniform float Temperature;
uniform float VignetteIntensity;
uniform float VignetteSmoothness;
uniform float DayTime;
varying vec2 texCoord;
varying vec2 screenUV;
const float PI = 3.14159265359;
const float TAU = 6.28318530718;
vec3 srgbToLinear(vec3 c) { return pow(max(c, vec3(0.0)), vec3(2.2)); }
vec3 linearToSrgb(vec3 c) { return pow(max(c, vec3(0.0)), vec3(1.0 / 2.2)); }
vec3 adjustSaturation(vec3 color, float saturation) {
vec3 luminance = vec3(0.2126, 0.7152, 0.0722);
float l = dot(color, luminance);
return mix(vec3(l), color, saturation);
}
vec3 adjustContrast(vec3 color, float contrast) { return (color - 0.5) * contrast + 0.5; }
vec3 adjustBrightness(vec3 color, float brightness) { return color + brightness; }
vec3 adjustTemperature(vec3 color, float temp) {
vec3 warm = vec3(1.0, 0.9, 0.7);
vec3 cool = vec3(0.7, 0.9, 1.0);
vec3 tint = mix(cool, warm, temp * 0.5 + 0.5);
return color * tint;
}
float fogFactorExp(float depth, float density) { return 1.0 - exp(-density * depth); }
float fogFactorExp2(float depth, float density) { float f = density * depth; return 1.0 - exp(-f * f); }
vec3 applyFog(vec3 color, vec3 fogColor, float factor) { return mix(color, fogColor, factor); }
float vignette(vec2 uv, float intensity, float smoothness) {
vec2 center = vec2(0.5);
float dist = distance(uv, center) * 2.0;
return 1.0 - smoothstep(1.0 - smoothness, 1.0, dist) * intensity;
}
vec3 tonemapReinhard(vec3 color) { return color / (color + 1.0); }
vec3 tonemapFilmic(vec3 color) {
vec3 x = max(vec3(0.0), color - 0.004);
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06);
}
vec3 applyGamma(vec3 color, float gamma) { return pow(max(color, vec3(0.0)), vec3(1.0 / gamma)); }
// Sky color gradient based on time of day
vec3 getSkyColor(float dayTime) {
float sunAngle = dayTime * TAU;
float sunHeight = sin(sunAngle);
// Dawn/dusk colors
vec3 dawnColor = vec3(1.0, 0.5, 0.3);
vec3 dayColor = vec3(0.5, 0.7, 1.0);
vec3 nightColor = vec3(0.05, 0.05, 0.15);
if (sunHeight > 0.2) {
// Day
float t = smoothstep(0.2, 1.0, sunHeight);
return mix(dawnColor, dayColor, t);
} else if (sunHeight > -0.2) {
// Sunset/sunrise
float t = smoothstep(-0.2, 0.2, sunHeight);
return mix(nightColor, dawnColor, t);
} else {
// Night
return nightColor;
}
}
vec3 applyPresetColorGrading(vec3 color, vec2 uv, float depth) {
// Dynamic sky color influence
vec3 skyColor = getSkyColor(DayTime);
color = mix(color, color * skyColor, 0.1);
// Temperature shift based on time
float temp = mix(0.3, -0.2, smoothstep(-0.1, 0.3, sin(DayTime * TAU)));
color = adjustTemperature(color, temp);
// Saturation
color = adjustSaturation(color, Saturation);
// Contrast
color = adjustContrast(color, Contrast);
// Brightness
color = adjustBrightness(color, Brightness);
// Lift/Gamma/Gain (simplified)
color = (color - Lift) / (Gain - Lift);
color = pow(max(color, vec3(0.0)), 1.0 / Gamma);
return color;
}
void main() {
vec4 color = texture2D(DiffuseSampler, texCoord);
vec3 result = color.rgb;
float alpha = color.a;
result = srgbToLinear(result);
if (ENABLE_COLOR_GRADING) {
result = applyPresetColorGrading(result, texCoord, 0.0);
}
if (ENABLE_FOG) {
// Better fog with exponential falloff
float fogFactor = fogFactorExp2(texCoord.y * 2.0, FogDensity * 0.5);
vec3 dynamicFogColor = mix(FogColor, vec3(0.8, 0.6, 0.4), smoothstep(0.3, 0.7, DayTime));
result = applyFog(result, dynamicFogColor, fogFactor);
}
if (ENABLE_VIGNETTE) {
float vig = vignette(screenUV, VignetteIntensity, VignetteSmoothness);
result *= vig;
}
if (ENABLE_TONEMAP) {
result = tonemapFilmic(result);
}
result = linearToSrgb(result);
result = applyGamma(result, 2.2);
gl_FragColor = vec4(result, alpha);
}
@@ -0,0 +1,34 @@
{
"vertex": "eagler_shaders/base",
"fragment": "eagler_shaders/vanilla_enhanced_medium",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "DayTime", "type": "float", "count": 1, "values": [ 0.5 ] },
{ "name": "QUALITY_LEVEL", "type": "int", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_FOG", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_COLOR_GRADING", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_TONEMAP", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "ENABLE_VIGNETTE", "type": "bool", "count": 1, "values": [ 1 ] },
{ "name": "FogColor", "type": "float", "count": 3, "values": [ 0.6, 0.7, 0.85 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 0.015 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Lift", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "Gamma", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Gain", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.08 ] },
{ "name": "Contrast", "type": "float", "count": 1, "values": [ 1.05 ] },
{ "name": "Brightness", "type": "float", "count": 1, "values": [ 0.02 ] },
{ "name": "Temperature", "type": "float", "count": 1, "values": [ 0.15 ] },
{ "name": "VignetteIntensity", "type": "float", "count": 1, "values": [ 0.2 ] },
{ "name": "VignetteSmoothness", "type": "float", "count": 1, "values": [ 0.4 ] }
]
}