2 scenes, how to make them like if they where one ?

I got 2 scenes, one is a forest the other are flying leaves, if i just use an alfa over in the nodes window itignores if a tree is closer or more far away so , sometimes one leave is behind a tree and another leave is infront, now all the leaves are infront as you can see n this video at the end when a tree gets really close to the camera and the leaves see though, when is the tree that would be infront of the leaves.

http://vimeo.com/1550106

I could merge the 2 scenes but it would be very cpu intensive thats why i have them in separate layers.

this is my setup

http://www.mediafire.com/imgbnc.php/f0b5c134241ba65338f49a6b29a397376g.jpg

Use the z-combine node and I think you will have to use the vector blur node afterwards.

Have you tried Z-Combine?

http://www.blender.org/development/release-logs/blender-243/composite-uv-map-displace-id-mask-and-z-combine/

edit: ehm… Musk was a bit faster… :slight_smile:

how should i set them up ?

Z-combine node is pretty straightforward. It has only four inputs, two for images and other two for Z-values. Just connect those outputs from the two scenes you need to combine.

thanx , i tried what you said but i get this :
http://www.mediafire.com/imgbnc.php/e039f15d1136adc73110daf975152cf96g.jpg

the leaves look like planes,( they are just planes with alpha)
and the ground lost its gradient.

Here's the[blend](http://www.mediafire.com/download.php?m4ttn3ngcty) file if someone can fix it

There are probably other ways to take care of this, but here’s one:

  1. You’ll have to add the trees to the scene with the leaves. Don’t worry – you won’t be rendering them.
  2. Put the trees on a layer that is active (i.e., that shows in the 3D view)
  3. In the RenderLayer buttons for your leaf scene, de-activate the tree layer so that it does not render.
  4. Ctrl-LMB click on that tree layer in the RenderLayer buttons. This will put a black dot in the button.

Render, and use the standard AlphaOver node to composite. Normally, the Alpha of a renderlayer is completely transparent for background (nothing to render) and opaque for regular rendered faces. This setup creates transparency in the Alpha channel for anything that would be occluded by the Ctrl-LMB clicked layers. When you examine your alpha channel that comes with the leaf render, you’ll see that it is correct now. The reason I do this instead of using the Z-combine node is dual: Z-combine can give artifacts if you’re using alpha’ed textures like you seem to be on the leaves, and Z-channels are not anti-aliased, which can lead to blocky compositing. The method stated above uses Alpha, which is anti-aliased.

BTW, this kind of advanced comping technique is just one of the things I show in my new book, clickable in my sig. (wink wink) (plug plug)

Its a plesure to have a reply from you harky :rolleyes: , thanx for the tip , i will use it in further works , i just merged both scenes into one , its no so heave and when i want to work on the leaves i just use them layer as they are in a separate one.

Thanx anyway !