Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post-processing to selected meshes

In three.js is it possible to apply postprocessing effects only to selected meshes?

For example to have a cube with grain effect while the rest of the scene does not have it. Thank you!

like image 717
Rui d'Orey Avatar asked May 30 '16 09:05

Rui d'Orey


People also ask

What is a post process material?

Post Process Materials enable you to set up materials that can be used with your post process to create visual screen effects for damage, area type effects, or overall look for your game that can only be achieved via Post Process Materials.


2 Answers

Yes. There is a three.js example that shows how to apply postprocessing to selected meshes using masking.

I think that example can be improved for clarity, but you can modify the example like so:

composer4 = new THREE.EffectComposer( renderer, new THREE.WebGLRenderTarget( rtWidth, rtHeight, rtParameters ) );

composer4.addPass( renderScene );
composer4.addPass( renderMask );
composer4.addPass( effectDotScreen );
composer4.addPass( clearMask );
composer4.addPass( effectVignette );

You will get an output like this:

postprocessing to selected mesh

It is a complicated example, so you will have to study it carefully.

three.js.r.77

like image 130
WestLangley Avatar answered Sep 21 '22 02:09

WestLangley


Yes, if you put your object to another scene. But you will face a problem with dept rendering, some object will be always on top. It depends on situation of your scene.

like image 43
Martin Avatar answered Sep 22 '22 02:09

Martin