Hi,
I'd like to combine a scene with several effects composition (outline + godRays + bloom) on the 3D meshes and a background (cubemap) which is not affected by all the effects.
The best I've achieved is to have both the scene and the background but rendered with all the effect passes. I tried several things to prevent effects to apply on the background but it didn't succeed until then.
Issue #79 seems to be quite close to my problem but it applied to processing 4.5 and I use 5.5.0 (TexturePass have disappeared from doc).
What should I try for solving this differentiated rendering issue ?
Hello,
post processing effects are usually applied to the final scene as a finishing touch. That's why the documentation doesn't include information about this particular use case.
This library is specialized for the typical scene setups. Be warned that your setup may suffer in terms of performance because of its advanced nature.
Some things have changed since version 4, but the basic strategy looks like this:
blendFunction to SKIP. Render the effect using a stand-alone EffectPass. This will only update the bloom texture. Set needsSwap of this pass to false if you're going to skip step 3.needsSwap of your bloom pass to true. Use a second EffectPass instance to render other simple effects like Sepia and Noise that should only be applied to the 3D objects.RenderPass that doesn't clear the frame buffer. This pass respects depth. It also produces aliasing artifacts.TextureEffect wrapped in another EffectPass instance. You can also add SMAAEffect, OutlineEffect, GodRaysEffect, VignetteEffect, etc. to this pass.It fully depends on what the effects do to determine where they should be executed. For example, the Outline effect as well as the God Rays effect both ignore the background whereas the Bloom effect processes the entire scene.
Here is an example that shows all this in detail.
Glitch, Shock Wave and Pixelation can just be added to the end of the pass queue if needed.
I hope this helps!
WebGLBackground has been changed in [email protected]. The scene background no longer tests depth. This means you'll need to use a custom cube texture material to draw the background.
The EffectPass has also been changed in [email protected]. When there's no apparent need to render anything, it will now leave the internal frame buffers untouched.
The render pipeline changes as follows:
blendFunction to SKIP. Render the effect using a stand-alone EffectPass.EffectPass instance to render other effects.TextureEffect.Many thanks for your answers and the example code, which are really helpful !
I'm glad I could help. If you have any other questions, just open another issue.
Most helpful comment
WebGLBackground has been changed in
[email protected]. The scene background no longer tests depth. This means you'll need to use a custom cube texture material to draw the background.The
EffectPasshas also been changed in[email protected]. When there's no apparent need to render anything, it will now leave the internal frame buffers untouched.The render pipeline changes as follows:
blendFunctiontoSKIP. Render the effect using a stand-aloneEffectPass.EffectPassinstance to render other effects.TextureEffect.I've updated the example accordingly.