# CinematicVanilla v2

**Built on Super Duper Vanilla v1.3.8 by Eldeston / FlameRender Studios**  
Upgraded by CinematicVanilla — all new code lives in `shaders/lib/cv_*.glsl`.

---

## What's New in v2

### 1. Performance Presets (`cv_presets.glsl`)
Four selectable presets via Iris/OptiFine GUI:

| Preset | Shadow | Clouds | VL Samples | RT Steps |
|--------|--------|--------|-----------|----------|
| **Low** | 512px / 64 blocks | 8 steps | 4 | 8 |
| **Medium** | 1024px / 96 blocks | 16 steps | 8 | 16 |
| **High** *(default)* | 2048px / 128 blocks | 32 steps | 12 | 20 |
| **Ultra Cinematic** | 4096px / 192 blocks | 64 steps | 16 | 32 |

Each preset also scales bloom passes, motion blur quality, and water features.

---

### 2. Color Presets (`cv_presets.glsl`)
Seven cinematic looks, all selectable in-game:

| # | Name | Mood |
|---|------|------|
| 0 | **Vanilla+** | Clean, faithful |
| 1 | **Warm Cinematic** *(default)* | Filmic amber warmth |
| 2 | **Cold Realistic** | Desaturated, crisp |
| 3 | **Dreamcore** | Oversaturated, dreamy |
| 4 | **Horror** | Dark, crushed, grey |
| 5 | **Cozy Rain** | Soft blue-grey |
| 6 | **Sunset Orange** | Vivid warm glow |

Each preset controls contrast, saturation, bloom, exposure, fog tint, and sky tint.

---

### 3. Cinematic Night Atmosphere (`cv_night.glsl`)
- **Star Twinkle** — per-star independent shimmer using dual-frequency noise
- **Moon Glow Halo** — soft radial glow around the moon (adjustable radius + strength)
- **Blue Ambient Fog** — deep indigo night mist that fades at dawn
- **Night Contrast Boost** — shadow crush for cinematic darkness

---

### 4. Dynamic Weather System (`cv_weather.glsl`)
- **Rain Atmosphere** — desaturates and tints scene blue-grey during rain
- **Storm Fog** — exponentially increases fog density in heavy rain
- **Thunder Flash** — double-flash lightning with random timing per storm cycle
- **Rain Ripple Normals** — three-layer ripple normal offset on wet surfaces
- **Wet Surface Sheen** — increases reflectivity of sky-exposed surfaces during rain

---

### 5. Realistic Water Upgrade (`cv_water.glsl`)
- **Depth Absorption** — Beer-Lambert RGB absorption (red first, blue last → cyan tint)
- **Underwater Caustic Scatter** — animated light patterns, rain-blurred
- **Underwater Fog** — exponential blue-green distance fog
- **Dynamic Wave Height** — large-scale sine wave offset layered on existing water normals
- **Fresnel** — Schlick approximation for grazing-angle reflections

---

### 6. Improved God Rays (`cv_godrays.glsl`)
- **Henyey-Greenstein Phase** — more physical forward scattering (vs flat isotropic)
- **Temporal Dither** — Bayer-4 dither + frame jitter to remove banding
- **Time-of-Day Boost** — shafts 2.6× brighter at sunrise/sunset
- **Cave Light Leak** — soft warm glow near sky-exposed indoor openings
- **Horizon Clamp** — prevents shafts from appearing below terrain

---

### 7. Screenshot / Photo Mode (`cv_photomode.glsl`)
Activate by uncommenting `#define CV_PHOTO_MODE` in `settings.glsl`.
- **2.35:1 Letterbox** — cinema black bars
- **Stronger DOF** — DOF_STRENGTH forced to 4
- **Enhanced Bloom** — 1.5× preset bloom
- **Movie Grade** — extra contrast + bleach bypass + black lift
- **Film Grain** — 1.2% analog noise

---

### 8. Advanced Cloud System (`cv_clouds.glsl`)
- **Sunset Tint** — bottom orange glow + pink-purple top rim at twilight
- **Storm Darkening** — heavy grey desaturation during rain
- **Silver Lining** — bright rim on cloud tops from grazing light
- **Depth Cueing** — aerial perspective darkening for distant clouds
- **Day/Night Ambient** — dark blue-grey unlit base at night

---

### 9. Nether & End Atmosphere (`cv_dimensions.glsl`)

**Nether:**
- Heat distortion UV warp (configurable strength)
- Lava glow boost (warm pixel detection → orange bloom)
- Two-layer dense red/orange fog
- Floating ash shimmer

**The End:**
- Purple cosmic fog with void deepening
- Ethereal particle glow
- Cosmic star color shift
- Deep void darkening below island level

---

## File Map

```
shaders/
├── lib/
│   ├── settings.glsl           ← All toggles (including new CV_ ones)
│   ├── cv_presets.glsl         ← ★ Performance + Color presets
│   ├── cv_night.glsl           ← ★ Night atmosphere
│   ├── cv_weather.glsl         ← ★ Dynamic weather
│   ├── cv_water.glsl           ← ★ Realistic water
│   ├── cv_godrays.glsl         ← ★ God ray improvements
│   ├── cv_clouds.glsl          ← ★ Advanced clouds
│   ├── cv_dimensions.glsl      ← ★ Nether & End atmosphere
│   ├── cv_photomode.glsl       ← ★ Photo / screenshot mode
│   ├── cv_integration_notes.glsl ← ★ WHERE to wire each function
│   └── post/
│       └── tonemap.glsl        ← Extended with preset tint support
├── world0/world.glsl           ← Overworld: includes all new libs
├── world-1/world.glsl          ← Nether: includes presets + dimensions
└── world1/world.glsl           ← End: includes presets + dimensions
```

## Wiring New Features Into Passes

All new functions are defined but the existing composite/deferred passes need
the actual function calls inserted. See `lib/cv_integration_notes.glsl` for
exact code snippets and locations for each system.

**Priority order for wiring:**
1. `cv_presets.glsl` — already included in world.glsl (auto-applies)
2. Weather atmosphere → `composite.glsl` fragment end
3. Night contrast → `deferred1.glsl` fragment end
4. Water absorption + ripples → `gbuffers_water.glsl`
5. God ray phase + time boost → `composite.glsl` VL loop
6. Cloud tinting → `gbuffers_clouds.glsl`
7. Photo mode → `composite6.glsl` final block
8. Dimension effects → world-specific composite passes

## Performance Tips

- Start with **High** preset (default) for 1440p cards
- Use **Medium** on 1080p / mid-range GPUs
- Disable `CV_WEATHER_THUNDER` if you dislike the flash effect
- Set `CV_CLOUD_STEPS` manually to override preset cloud quality
- `CV_PHOTO_MODE` is for screenshots only — disable during normal play
