Giter Site home page Giter Site logo

zhegerenrucishuai / react-postprocessing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pmndrs/react-postprocessing

0.0 0.0 0.0 15.03 MB

๐Ÿ“ฌ postprocessing for react-three-fiber

Home Page: https://docs.pmnd.rs/react-postprocessing

License: MIT License

JavaScript 1.57% TypeScript 98.24% CSS 0.19%

react-postprocessing's Introduction

react-postprocessing

Version Storybook Downloads Discord Shield Open in GitHub Codespaces

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 @react-three/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://github.com/pmndrs/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?

Here's an example combining a couple of effects (live demo).

Bubbles Demo
import React from 'react'
import { Bloom, DepthOfField, EffectComposer, Noise, Vignette } from '@react-three/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's People

Contributors

drcmda avatar gsimone avatar stephencorwin avatar dependabot[bot] avatar codyjasonbennett avatar abernier avatar renaudrohlinger avatar charliehess avatar chasedavis avatar jakubrpawlowski avatar njm222 avatar iuriiiurevich avatar unphased avatar ryanhagerty avatar poolp avatar skuteli avatar itsmingjie avatar mike-dax avatar marcofugaro avatar mjurczyk avatar huntercaron avatar fnwk avatar davidbachmann avatar danielheene avatar connorholyday avatar cdebotton avatar onion2k avatar brysonandrew avatar aidannelson avatar acollectionofatoms avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.