Archive eagler-shaders (other, 1.8.8, clean)
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"slug": "eagler-shaders",
|
||||||
|
"name": "Eagler Shaders (Lightweight GLSL)",
|
||||||
|
"category": "other",
|
||||||
|
"mc_version": "1.8.8",
|
||||||
|
"author": "NT9712",
|
||||||
|
"license": "unknown",
|
||||||
|
"upstream_ref": "main",
|
||||||
|
"sha256": "2726ce78b18e790a87d73650518c95e55bc7f9c43c2cddae95e3ddf0070f7809",
|
||||||
|
"size": 206611,
|
||||||
|
"storage": {
|
||||||
|
"git_path": "eagler-shaders/",
|
||||||
|
"fs_url": "https://fs-archive.eaglercraft.tech/archives/eagler-shaders.tar.gz"
|
||||||
|
},
|
||||||
|
"play": {
|
||||||
|
"sandbox_url": "https://play-archive.eaglercraft.tech/eagler-shaders/",
|
||||||
|
"sandbox_attr": "allow-scripts allow-same-origin allow-pointer-lock",
|
||||||
|
"network_notes": "May connect to user-chosen wss:// multiplayer servers."
|
||||||
|
},
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/NT9712/eagler-shaders",
|
||||||
|
"retrieved_at": "2026-11-28T06:10:35Z",
|
||||||
|
"type": "upstream",
|
||||||
|
"notes": "Lightweight shaders repository on GitHub"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vetting": {
|
||||||
|
"verdict": "clean",
|
||||||
|
"tools": [
|
||||||
|
"vet-static.mjs",
|
||||||
|
"virustotal-hash",
|
||||||
|
"static-code-review"
|
||||||
|
],
|
||||||
|
"date": "2026-11-28",
|
||||||
|
"notes": "Standard site script loading and clipboard.writeText copy helper.",
|
||||||
|
"reviewer": "vet-gemini-2"
|
||||||
|
},
|
||||||
|
"large_files_omitted_from_git": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Eagler Shaders (Lightweight GLSL)
|
||||||
|
|
||||||
|
Lightweight GLSL shader pack and configuration for Eaglercraft by NT9712, providing light and dark visual presets optimized for low-end hardware and mobile/Chromebook WebGL contexts.
|
||||||
|
|
||||||
|
- **Archive page:** https://archive.eaglercraft.tech/entries/eagler-shaders.html
|
||||||
|
- **Play:** https://play-archive.eaglercraft.tech/eagler-shaders/
|
||||||
|
- **Large download (fs-archive):** https://fs-archive.eaglercraft.tech/archives/eagler-shaders.tar.gz
|
||||||
|
- **MC Version:** 1.8.8
|
||||||
|
- **Author:** NT9712
|
||||||
|
- **License:** unknown
|
||||||
|
- **SHA-256:** `2726ce78b18e790a87d73650518c95e55bc7f9c43c2cddae95e3ddf0070f7809`
|
||||||
|
- **Vetting:** clean (2026-11-28)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Gradle
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
.vscode/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Local development
|
||||||
|
local.properties
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting this License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) the power to direct or cause the
|
||||||
|
direction of management of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by the
|
||||||
|
copyright notice included in the Work.
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this License, "intentionally
|
||||||
|
submitted" means any electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, bulletin board systems, or
|
||||||
|
similar communication channels, but excluding communication that is
|
||||||
|
conspicuously marked as "Private" or "Confidential."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise dispose of the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in Source or Object form, with
|
||||||
|
or without modifications, and in Source or Object form, provided
|
||||||
|
that You meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to the Derivative
|
||||||
|
Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the NOTICE file contained within the
|
||||||
|
Work, except that You may omit any statements in the NOTICE file
|
||||||
|
that do not pertain to the Derivative Works, provided that You
|
||||||
|
can demonstrate that such statements are not relevant to the
|
||||||
|
Derivative Works.
|
||||||
|
|
||||||
|
You may add Your own attribution notices to Derivative Works that
|
||||||
|
You distribute, provided that such attribution notices do not
|
||||||
|
cause the Work to be confused with the work of the original
|
||||||
|
author.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution submitted to Licensor for inclusion in the Work
|
||||||
|
by You shall be under the terms and conditions of this License,
|
||||||
|
without any additional terms or conditions. Notwithstanding the
|
||||||
|
above, nothing herein shall supersede or modify the terms of any
|
||||||
|
separate license agreement You may have with Licensor regarding
|
||||||
|
such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and distributing the Work. Such permission may
|
||||||
|
be granted separately by the Licensor.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides their Contribution) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law or agreed to in writing, shall
|
||||||
|
any Contributor be liable to You for damages, including any direct,
|
||||||
|
indirect, incidental, special, exemplary, or consequential damages
|
||||||
|
(including, but not limited to, procurement of substitute goods or
|
||||||
|
services; loss of use, data, or profits; or business interruption)
|
||||||
|
however caused and on any theory of liability, whether in
|
||||||
|
contract, strict liability, or tort (including negligence) and
|
||||||
|
any such liability shall be governed by the terms of this License.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and accept responsibility for, warranty, or additional liability
|
||||||
|
obligations consistent with the code of conduct of Your organization,
|
||||||
|
provided that such warranty or additional liability obligations are
|
||||||
|
not imposed by the Licensor.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be in the default font of the
|
||||||
|
user's terminal or editor.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
# Eaglercraft Shader Collection
|
||||||
|
|
||||||
|
A lightweight, visually distinctive shader collection for Eaglercraft with **light and dark presets** optimised for **low-end WebGL devices** (integrated GPUs, older Chromebooks, weak laptops).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **6 Presets**: Vanilla Enhanced, Bright, Soft, Nightfall, Noir, Abyss
|
||||||
|
- **3 Quality Levels**: LOW (aggressive optimisation), MEDIUM (balanced), HIGH (best visuals)
|
||||||
|
- **One-step integration**: `EaglercraftShaderIntegration.install(renderer)`
|
||||||
|
- **Safe fallbacks**: Failed shaders automatically fall back to vanilla rendering
|
||||||
|
- **Minimal overhead**: Vanilla Enhanced LOW targets vanilla FPS
|
||||||
|
- **No expensive effects**: No ray tracing, volumetric lighting, SSR, or heavy blur chains
|
||||||
|
|
||||||
|
## Presets
|
||||||
|
|
||||||
|
### Light Presets
|
||||||
|
| Preset | Description |
|
||||||
|
|--------|-------------|
|
||||||
|
| **Vanilla Enhanced** | Default. Improved colour balance, better sunlight, lightweight fog, subtle water enhancement |
|
||||||
|
| **Bright** | Brighter lighting, clearer atmosphere, more vibrant colours |
|
||||||
|
| **Soft** | Gentle colour transitions, reduced harsh lighting, subtle atmosphere |
|
||||||
|
|
||||||
|
### Dark Presets
|
||||||
|
| Preset | Description |
|
||||||
|
|--------|-------------|
|
||||||
|
| **Nightfall** | Darker ambient, increased contrast, atmospheric fog, nighttime mood |
|
||||||
|
| **Noir** | High contrast, dark appearance, reduced saturation, strong visual identity |
|
||||||
|
| **Abyss** | Deep shadows, cool/dark colour grading, atmospheric darkness |
|
||||||
|
|
||||||
|
## Quality Levels
|
||||||
|
|
||||||
|
| Level | Description | Target |
|
||||||
|
|-------|-------------|--------|
|
||||||
|
| **LOW** | Disables tonemap, vignette, dithering. Fast sRGB conversion. Minimal fog. | Weak integrated GPUs, older devices |
|
||||||
|
| **MEDIUM** | Enables filmic tonemap, vignette, dynamic sky colours, better fog. | Balanced visuals/FPS |
|
||||||
|
| **HIGH** | Adds dithering, moon glow (Nightfall), dynamic temperature, exponential² fog. | Capable hardware |
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### 1. Add the Module
|
||||||
|
|
||||||
|
**Gradle (build.gradle.kts):**
|
||||||
|
```kotlin
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://eaglercraft-teavm-fork.github.io/maven/") }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("com.eaglercraft.shaders:eagler-shaders:1.0.0")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Or copy the JAR** to your `mods` folder / classpath.
|
||||||
|
|
||||||
|
### 2. Initialize
|
||||||
|
|
||||||
|
In your client initialization code (e.g., your main mod class or client setup):
|
||||||
|
|
||||||
|
```java
|
||||||
|
import com.eaglercraft.shaders.EaglercraftShaderIntegration;
|
||||||
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
|
|
||||||
|
// Call once during client startup, after GameRenderer is created
|
||||||
|
EaglercraftShaderIntegration.install(gameRenderer);
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it! The default preset (Vanilla Enhanced LOW) is now active.
|
||||||
|
|
||||||
|
### 3. Use the API
|
||||||
|
|
||||||
|
```java
|
||||||
|
import com.eaglercraft.shaders.*;
|
||||||
|
|
||||||
|
// Switch presets
|
||||||
|
ShaderCollection.enable("nightfall");
|
||||||
|
ShaderCollection.enable("bright");
|
||||||
|
ShaderCollection.enable(ShaderPreset.NOIR);
|
||||||
|
|
||||||
|
// Change quality (requires re-enabling preset)
|
||||||
|
ShaderCollection.setQuality(ShaderQuality.MEDIUM);
|
||||||
|
ShaderCollection.setQuality(ShaderQuality.HIGH);
|
||||||
|
|
||||||
|
// Toggle on/off
|
||||||
|
ShaderCollection.toggleShaders();
|
||||||
|
ShaderCollection.disableShaders();
|
||||||
|
|
||||||
|
// Query state
|
||||||
|
ShaderPreset current = ShaderCollection.getCurrentPreset();
|
||||||
|
ShaderQuality quality = ShaderCollection.getCurrentQuality();
|
||||||
|
boolean active = ShaderCollection.areShadersActive();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Details
|
||||||
|
|
||||||
|
### For Forge Mods
|
||||||
|
The `ShaderCollectionMod` class auto-initialises on `FMLClientSetupEvent`. Just add the mod to your project.
|
||||||
|
|
||||||
|
### For Manual Integration
|
||||||
|
```java
|
||||||
|
// In your client code where you have access to GameRenderer
|
||||||
|
GameRenderer renderer = Minecraft.getInstance().gameRenderer;
|
||||||
|
EaglercraftShaderIntegration.install(renderer);
|
||||||
|
|
||||||
|
// Later, when window resizes:
|
||||||
|
EaglercraftShaderIntegration.onFramebufferResize(width, height);
|
||||||
|
|
||||||
|
// On resource reload:
|
||||||
|
EaglercraftShaderIntegration.onResourceReload(resourceManager);
|
||||||
|
|
||||||
|
// On shutdown:
|
||||||
|
EaglercraftShaderIntegration.onShutdown();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Hooking into GameRenderer
|
||||||
|
If you need to replace Eaglercraft's vanilla shader rendering, modify `GameRenderer.updateCameraAndRender`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
// In GameRenderer.updateCameraAndRender, replace the shader rendering section:
|
||||||
|
if (GLX.usePostProcess) {
|
||||||
|
mc.worldRenderer.renderEntityOutlineFramebuffer();
|
||||||
|
// Replace vanilla shader rendering with:
|
||||||
|
EaglercraftShaderIntegration.renderShaders(partialTicks, this.useShader);
|
||||||
|
mc.getFramebuffer().bindFramebuffer(true);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Performance Notes
|
||||||
|
|
||||||
|
### What LOW Mode Disables
|
||||||
|
- Tonemapping (Reinhard only if enabled)
|
||||||
|
- Vignette effect
|
||||||
|
- Blue noise dithering
|
||||||
|
- Dynamic sky colour calculations
|
||||||
|
- Exponential² fog (uses simple linear)
|
||||||
|
- Temperature shifts based on time of day
|
||||||
|
- Full sRGB/linear conversion (uses fast approximation)
|
||||||
|
|
||||||
|
### Estimated Overhead (vs Vanilla)
|
||||||
|
| Preset | Quality | Overhead |
|
||||||
|
|--------|---------|----------|
|
||||||
|
| Vanilla Enhanced | LOW | ~1-2% |
|
||||||
|
| Vanilla Enhanced | MEDIUM | ~3-5% |
|
||||||
|
| Vanilla Enhanced | HIGH | ~5-8% |
|
||||||
|
| Nightfall | LOW | ~2-3% |
|
||||||
|
| Nightfall | MEDIUM | ~4-6% |
|
||||||
|
| Nightfall | HIGH | ~6-10% |
|
||||||
|
| Noir | LOW | ~1-2% |
|
||||||
|
| Abyss | LOW | ~2-4% |
|
||||||
|
|
||||||
|
### Optimisation Tips
|
||||||
|
- Use **LOW** quality on integrated graphics / Chromebooks
|
||||||
|
- **Disable fog** (`ENABLE_FOG=false` in JSON) for maximum FPS
|
||||||
|
- **Disable vignette** for slight FPS gain
|
||||||
|
- Avoid switching presets every frame
|
||||||
|
|
||||||
|
## Shader Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
ShaderCollection (core)
|
||||||
|
↓
|
||||||
|
EaglercraftShaderIntegration (adapter)
|
||||||
|
↓
|
||||||
|
GameRenderer (Eaglercraft)
|
||||||
|
```
|
||||||
|
|
||||||
|
### File Structure
|
||||||
|
```
|
||||||
|
src/main/resources/assets/minecraft/shaders/program/eagler_shaders/
|
||||||
|
├── base.vsh # Shared vertex shader
|
||||||
|
├── base.fsh # Base fragment template
|
||||||
|
├── util.glsl # Shared GLSL functions
|
||||||
|
├── vanilla_enhanced_low.fsh
|
||||||
|
├── vanilla_enhanced_low.json
|
||||||
|
├── vanilla_enhanced_medium.fsh
|
||||||
|
├── vanilla_enhanced_medium.json
|
||||||
|
├── vanilla_enhanced_high.fsh
|
||||||
|
├── vanilla_enhanced_high.json
|
||||||
|
├── bright_low.fsh / .json
|
||||||
|
├── soft_low.fsh / .json
|
||||||
|
├── nightfall_low.fsh / .json
|
||||||
|
├── nightfall_medium.fsh / .json
|
||||||
|
├── nightfall_high.fsh / .json
|
||||||
|
├── noir_low.fsh / .json
|
||||||
|
└── abyss_low.fsh / .json
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./gradlew build
|
||||||
|
# Output: build/libs/eagler-shaders-1.0.0.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Eaglercraft 1.16.5+ (26.2+ workspace)
|
||||||
|
- Java 11+
|
||||||
|
- Forge 36+
|
||||||
|
- WebGL 1.0+ / OpenGL ES 2.0+
|
||||||
|
|
||||||
|
## Known Limitations
|
||||||
|
|
||||||
|
1. **No depth buffer access** in post-process shaders - fog uses screen-space Y approximation
|
||||||
|
2. **No motion vectors** - temporal effects not possible
|
||||||
|
3. **WebGL 1 constraints** - limited uniform counts, no compute shaders
|
||||||
|
4. **DayTime uniform** must be updated from Java side for time-based effects
|
||||||
|
5. **Entity outline framebuffer** not integrated - outlines render on top of shaders
|
||||||
|
6. **No multi-pass** - single post-process pass only
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Apache-2.0 License - See [LICENSE](LICENSE) for details.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
- Eaglercraft team for the shader infrastructure
|
||||||
|
- lax1dude for Eaglercraft
|
||||||
|
- Mojang for Minecraft
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
plugins {
|
||||||
|
id("java")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.eaglercraft.shaders"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
name = "eagler-teavm"
|
||||||
|
url = uri("https://eaglercraft-teavm-fork.github.io/maven/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("com.carrotsearch:hppc:0.10.0")
|
||||||
|
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
||||||
|
implementation("org.apache.commons:commons-lang3:3.6")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
named("main") {
|
||||||
|
java.srcDir("src/main/java")
|
||||||
|
resources.srcDir("src/main/resources")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Jar> {
|
||||||
|
entryCompression = ZipEntryCompression.STORED
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
manifest {
|
||||||
|
attributes(
|
||||||
|
"Implementation-Title" to "Eaglercraft Shader Collection",
|
||||||
|
"Implementation-Version" to version,
|
||||||
|
"Implementation-Vendor" to "Eaglercraft Shaders"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
options.compilerArgs.addAll(listOf("-Xlint:unchecked", "-Xlint:deprecation"))
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "eagler-shaders"
|
||||||
File diff suppressed because it is too large
Load Diff
+248
@@ -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"
|
||||||
+122
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+135
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+190
@@ -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);
|
||||||
|
}
|
||||||
+20
@@ -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;
|
||||||
|
}
|
||||||
+166
@@ -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);
|
||||||
|
}
|
||||||
+35
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+112
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+151
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+198
@@ -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);
|
||||||
|
}
|
||||||
+35
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+120
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+169
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+122
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+134
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+120
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+153
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+249
@@ -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
|
||||||
+175
@@ -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);
|
||||||
|
}
|
||||||
+35
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+115
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
+160
@@ -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);
|
||||||
|
}
|
||||||
+34
@@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"buildCommand": "echo 'Static site - no build needed'",
|
||||||
|
"outputDirectory": "site",
|
||||||
|
"devCommand": "echo 'No dev server needed'",
|
||||||
|
"installCommand": "echo 'No install needed'",
|
||||||
|
"framework": null
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user