
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
realism-effects
Advanced tools
A collection of the following effects for three.js:
PoissonDenoisePass
)
ℹ️: You can explore the demos by clicking on the images
This effect uses postprocessing.js. If you don't have it installed, install it like so:
npm i postprocessing
Then install this effect by running:
npm i realism-effects
Then add it to your code like so:
import * as POSTPROCESSING from "postprocessing"
import { SSGIEffect, TRAAEffect, MotionBlurEffect, VelocityDepthNormalPass } from "realism-effects"
const composer = new POSTPROCESSING.EffectComposer(renderer)
const velocityDepthNormalPass = new VelocityDepthNormalPass(scene, camera)
composer.addPass(velocityDepthNormalPass)
// SSGI
const ssgiEffect = new SSGIEffect(scene, camera, velocityDepthNormalPass, options?)
// TRAA
const traaEffect = new TRAAEffect(scene, camera, velocityDepthNormalPass)
// Motion Blur
const motionBlurEffect = new MotionBlurEffect(velocityDepthNormalPass)
// SSAO
const ssaoEffect = new SSAOEffect(composer, camera, scene)
// HBAO
const hbaoEffect = new HBAOEffect(composer, camera, scene)
const effectPass = new POSTPROCESSING.EffectPass(camera, ssgiEffect, hbaoEffect, ssaoEffect, traaEffect, motionBlur)
composer.addPass(effectPass)
NOTE:
OrthographicCamera
isn't supported yet. OnlyPerspectiveCamera
is supported at the moment. It'll be supported in the future.
const options = {
distance: 10,
thickness: 10,
autoThickness: false,
maxRoughness: 1,
blend: 0.9,
denoiseIterations: 1,
denoiseKernel: 2,
denoiseDiffuse: 10,
denoiseSpecular: 10,
depthPhi: 2,
normalPhi: 50,
roughnessPhi: 1,
envBlur: 0.5,
importanceSampling: true,
directLightMultiplier: 1,
steps: 20,
refineSteps: 5,
spp: 1,
resolutionScale: 1,
missedRays: false
}
If you use SSGI, then you don't have to use the RenderPass anymore as SSGI does the rendering then. You can save performance by leaving it out. Keep in mind that then you need to put TRAA and Motion Blur in a separate pass like so:
const effectPass = new POSTPROCESSING.EffectPass(camera, ssgiEffect)
const effectPass2 = new POSTPROCESSING.EffectPass(camera, traaEffect, motionBlur)
composer.addPass(effectPass)
composer.addPass(effectPass2)
Since the right options for an SSGI effect (or for other effects provided by realism-effects
) depend a lot on the scene, it can happen that you don't seem to have an effect at all in your scene when you use the SSGI effect for the first time in it without any configuration. This can have multiple causes such as distance
being way too low for your scene for example. So to find out which SSGI options are right for your scene, you should use a GUI to find the right values easily. The example already comes with a simple one-file GUI SSGIDebugGUI.js
that you can use in your project like so:
npm i tweakpane
SSGIDebugGUI.js
to your project and initialize it like so in your scene:import { SSGIDebugGUI } from "./SSGIDebugGUI"
const gui = new SSGIDebugGUI(ssgiEffect, options)
That's it, you should now have the GUI you can see in the example scene. The options
parameter is optional for the SSGIDebugGUI and will default to the default options if no options
parameter is given.
Besides for SSGI, there are also debug GUIs for more effects. You can copy the following debug GUIs from the repository:
If you'd like to test this project and run it locally, run these commands:
git clone https://github.com/0beqz/realism-effects
cd realism-effects/example
npm i --force
npm run dev
If the project is useful for you and you'd like to sponsor my work:
If you'd like, you could also buy me a coffee:
Edge fade for SSR: kode80
Velocity Shader: three.js sandbox
SSAO effect and PoissonDenoisePass: N8programs - GitHub Repo: ssao
FAQs
Effects to enhance your three.js scene's realism
The npm package realism-effects receives a total of 362 weekly downloads. As such, realism-effects popularity was classified as not popular.
We found that realism-effects demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.