An open API service indexing awesome lists of open source software.

https://github.com/1bye/threlte-postprocessing

📬 postprocessing for svelte three.js (threlte)
https://github.com/1bye/threlte-postprocessing

3d js postprocessing svelte svelte-postprocessing threejs threlte ts webgl

Last synced: 10 months ago
JSON representation

📬 postprocessing for svelte three.js (threlte)

Awesome Lists containing this project

README

          

# Threlte Postprocessing

[//]: # (

)

[//]: # ( Threlte Postprocessing)

[//]: # (

)

[![Version](https://img.shields.io/npm/v/threlte-postprocessing?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/threlte-postprocessing)
[![Downloads](https://img.shields.io/npm/dt/threlte-postprocessing.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/threlte-postprocessing)
[![License](https://img.shields.io/npm/l/threlte-postprocessing?style=flat&colorA=000000&colorB=000000)](https://github.com/1bye/threlte-postprocessing/blob/main/LICENSE)

Threlte Postprocessing is a postprocessing effects library for [Threlte](https://threlte.xyz/), bringing powerful post-processing capabilities to your Svelte 3D applications. Built on top of [three.js](https://threejs.org/) and [postprocessing](https://github.com/pmndrs/postprocessing), it provides a set of ready-to-use effects that can be easily integrated into your Threlte scenes.

```bash
npm install threlte-postprocessing
```

## Quick start 🚀

```svelte

import { Canvas } from "@threlte/core";
import Scene from "./Scene.svelte";

```

```svelte

import { EffectComposer } from 'threlte-postprocessing'
import { DepthOfFieldEffect, BloomEffect, NoiseEffect, VignetteEffect } from 'threlte-postprocessing/effects'




```

## Demo
Link to [demo](https://codesandbox.io/p/github/1bye/threlte-postprocessing/main)

## Features ✨

- 🎯 Seamless integration with Threlte and Svelte
- ⚡️ Simple, declarative API
- 🎨 Rich set of post-processing effects
- 📦 Tree-shakeable effects
- 🔧 Fully typed with TypeScript
- 🎮 Real-time effect parameter updates

## Effects Documentation 📚

### Bloom
Adds a glow effect to bright areas of the scene.

```svelte

```

### BrightnessContrast
Adjusts the brightness and contrast of the scene.

```svelte

```

### ChromaticAberration
Simulates lens color separation artifacts.

```svelte

```

### ColorAverage
Reduces the image to a single average color.

```svelte

```

### ColorDepth
Reduces the color depth of the image.

```svelte

```

### ColorGrading
Applies color adjustments to the final render.

```svelte

```

### Depth
Renders the scene's depth buffer.

```svelte

```

### DepthOfField
Simulates camera focus effects by blurring objects based on their distance from the focal point.

```svelte

```

### DotScreen
Creates a dot-screen effect similar to halftone printing.

```svelte

```

### Glitch
Creates digital glitch effects.

```svelte

```

### GodRays
Creates volumetric lighting effects.

```svelte

```

### Grid
Overlays a grid pattern on the scene.

```svelte

```

### HueSaturation
Adjusts the hue and saturation of the scene.

```svelte

```

### Noise
Adds film grain or noise to the scene.

```svelte

```

### Pixelation
Creates a pixelated effect by reducing the resolution.

```svelte

```

### Scanline
Adds scanlines to the scene, similar to old CRT displays.

```svelte

```

### Sepia
Applies a sepia tone to the scene.

```svelte

```

### SMAA (Subpixel Morphological Antialiasing)
Provides high-quality antialiasing.

```svelte

```

### ToneMapping
Applies tone mapping to the scene.

```svelte

```

### Vignette
Darkens the edges of the scene.

```svelte

```

### Custom Fluid Effect
Fluid like in [react-fluid](https://github.com/whatisjery/react-fluid-distortion/tree/main)
```svelte

import { FluidEffect } from "threlte-postprocessing/custom";

```

### And more...
You can check more effects in [effects folder](./src/lib/effects)

## Contributing 🤝

We welcome contributions! Here's how you can help:

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-effect`)
3. Commit your changes (`git commit -m 'Add amazing effect'`)
4. Push to the branch (`git push origin feature/amazing-effect`)
5. Open a Pull Request

## Performance Tips 💨

- Only use the effects you need
- Adjust effect quality settings based on device capabilities
- Consider using the `` component for better control
- Enable effect pass switching for dynamic performance optimization

## Credits 🙏

This library builds upon several amazing projects:
- [Threlte](https://threlte.xyz/)
- [three.js](https://threejs.org/)
- [postprocessing](https://github.com/pmndrs/postprocessing)

## License 📄

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

Made with ❤️ for the Threlte and Svelte community