0

I'm want to apply post-processing with EffectComposer to specific objects in my scene. So far I'm only able to apply effects such as FilmPass to the entire canvas as one big rectangle.

I'm not sure to begin with this. Do I pass paramters such as these:

{ minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, stencilBuffer: true }

to my WebGLRenderTarget? Why does the stencil parameter only take a bool value instead of the mesh you want to use as the stencil? Should I be inserting a MaskPass into my render chain somewhere? In either approach, how do I indicate which mesh I want to target as the clipping path for my effects?

zakdances
  • 22,285
  • 32
  • 102
  • 173
  • The three.js example http://threejs.org/examples/webgl_postprocessing_advanced.html shows you how to implement masking. – WestLangley Jan 08 '14 at 14:37
  • @WestLangley Maybe I'm missing something, but after looking at the code, that example is applying post-processing to 4 scenes, not individual objects/meshes. Even the variable named `sceneModel` is actually a rectangular scene, not the head mesh itself. (`sceneModel = new THREE.Scene();`) Is there a way to force post-processing to clip to a specific object, such as the head mesh in the example? – zakdances Jan 09 '14 at 01:39
  • Yes. `renderMask = new THREE.MaskPass( sceneModel, cameraPerspective );` is using the contents of `sceneModel` to create the Mask. It renders `sceneModel` into the stencil buffer(s), and that becomes the mask. You are going to have to experiment and step throught he code with the debugger to understand it. If you have problems, then show a live example of what you have tried, and ask a specific question about it. – WestLangley Jan 09 '14 at 02:23
  • @WestLangley I'm going to take a closer look at the example as you recommend. I think what's confusing me is the shape of the 4 "objects" in the scene. Because they're rectangular, I'm having trouble identifying them as nested scenes or Object3Ds (such as the rotating heads). – zakdances Jan 09 '14 at 03:01

0 Answers0