trois icon indicating copy to clipboard operation
trois copied to clipboard

Add postprocessing

Open SaFrMo opened this issue 3 years ago • 8 comments

React Three Fiber includes easy ways to implement postprocessing - I'd like to see how straightforward it would be to create a custom effect pass in the EffectComposer using these methods. Will self-assign and keep this thread updated!

SaFrMo avatar Apr 05 '21 04:04 SaFrMo

Update - this is going well so far, I was able to implement a couple postprocessing effects successfully and am working on some different scenarios to make sure things are working well. PR hopefully by the start of next week!

SaFrMo avatar Apr 08 '21 13:04 SaFrMo

@klevron While working on this, I'm finding that it'd be useful to run three.init in the Renderer's setup function rather than mounted. There are a few questions I haven't solved yet, like getting info from child components, but before I get too far into those I want to make sure this isn't a path you've already decided against. Let me know if that's the case or if you have any other thoughts on that direction - thanks!

SaFrMo avatar Apr 12 '21 14:04 SaFrMo

We need a canvas element to init WebGLRenderer, that's why it is done in mounted(). Could you use three.onAfterInit() (this will maybe moved to renderer comp soon) ? What kind of child elements do you need access to ?

klevron avatar Apr 12 '21 16:04 klevron

onAfterInit is a good thought, I'll try that! I needed access to the scene and camera since trying to do three.init in setup was throwing "Missing Scene" and "Missing Camera" errors, but this should be a good fix for now. Thanks!

SaFrMo avatar Apr 13 '21 02:04 SaFrMo

Made a branch : https://github.com/troisjs/trois/tree/vanruesc/postprocessing

PR : #53

klevron avatar May 01 '21 23:05 klevron

This is fantastic! I've been very busy lately but will definitely take a look when I get a moment again - thanks for digging into this @klevron !

SaFrMo avatar May 03 '21 21:05 SaFrMo

Example of dof effect, already tried last year but it's easier with troisjs :) image

klevron avatar May 04 '21 22:05 klevron

I merge the PR now but will be improved later :)

klevron avatar May 06 '21 19:05 klevron