Awesome Open Source
Awesome Open Source
Sponsorship

react-postprocessing

npm npm Discord Shield

react-postprocessing is a postprocessing wrapper for react-three-fiber. This is not (yet) meant for complex orchestration of effects, but can save you hundreds of LOC for a straight forward effects-chain.

npm install postprocessing react-postprocessing

Bubbles Take Control

These demos are real, you can click them! They contain the full code, too. 📦

Why postprocessing and not three/examples/jsm/postprocessing?

From https://vanruesc.github.io/postprocessing

This library provides an EffectPass which automatically organizes and merges any given combination of effects. This minimizes the amount of render operations and makes it possible to combine many effects without the performance penalties of traditional pass chaining. Additionally, every effect can choose its own blend function.

All fullscreen render operations also use a single triangle that fills the screen. Compared to using a quad, this approach harmonizes with modern GPU rasterization patterns and eliminates unnecessary fragment calculations along the screen diagonal. This is especially beneficial for GPGPU passes and effects that use complex fragment shaders.

Postprocessing also supports srgb-encoding out of the box, as well as WebGL2 MSAA (multi sample anti aliasing), which is react-postprocessing's default, you get high performance crisp results w/o jagged edges.

What does it look like?

Well, you can do pretty much anything, but here's an example combining a couple of effects (live demo).

Bubbles Demo
import React from 'react'
import { EffectComposer, DepthOfField, Bloom, Noise, Vignette } from 'react-postprocessing'
import { Canvas } from 'react-three-fiber'

function App() {
  return (
    <Canvas>
      {/* Your regular scene contents go here, like always ... */}
      <EffectComposer>
        <DepthOfField focusDistance={0} focalLength={0.02} bokehScale={2} height={480} />
        <Bloom luminanceThreshold={0} luminanceSmoothing={0.9} height={300} />
        <Noise opacity={0.02} />
        <Vignette eskil={false} offset={0.1} darkness={1.1} />
      </EffectComposer>
    </Canvas>
  )
}

Documentation

react-postprocessing exports

postprocessing docs


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
typescript (8,803) 
react (4,723) 
webgl (353) 
3d (347) 
threejs (194) 

Find Open Source By Browsing 7,000 Topics Across 59 Categories

Advertising 📦10
All Projects
Application Programming Interfaces 📦124
Applications 📦192
Artificial Intelligence 📦78
Blockchain 📦73
Build Tools 📦113
Cloud Computing 📦80
Code Quality 📦28
Collaboration 📦32
Command Line Interface 📦49
Community 📦83
Companies 📦60
Compilers 📦63
Computer Science 📦80
Configuration Management 📦42
Content Management 📦175
Control Flow 📦213
Data Formats 📦78
Data Processing 📦276
Data Storage 📦135
Economics 📦64
Frameworks 📦215
Games 📦129
Graphics 📦110
Hardware 📦152
Integrated Development Environments 📦49
Learning Resources 📦166
Legal 📦29
Libraries 📦129
Lists Of Projects 📦22
Machine Learning 📦347
Mapping 📦64
Marketing 📦15
Mathematics 📦55
Media 📦239
Messaging 📦98
Networking 📦315
Operating Systems 📦89
Operations 📦121
Package Managers 📦55
Programming Languages 📦245
Runtime Environments 📦100
Science 📦42
Security 📦396
Social Media 📦27
Software Architecture 📦72
Software Development 📦72
Software Performance 📦58
Software Quality 📦133
Text Editors 📦49
Text Processing 📦136
User Interface 📦330
User Interface Components 📦514
Version Control 📦30
Virtualization 📦71
Web Browsers 📦42
Web Servers 📦26
Web User Interface 📦210