Z-buffer trouble when mixing 2D and 3D

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
CamLewis
Posts: 4
Joined: Wed Mar 29, 2017 5:39 pm

Z-buffer trouble when mixing 2D and 3D

Post by CamLewis »

I have a scene where I've imported a single .OBJ file with the scene geometry, and a 2D character I'd like to animate in that scene. Picture a room with a single box in the middle; I want the character positioned between the wall and the box, such that the camera view shows the character in front of the wall, but behind the box.

The tutorials and the manual both indicate that this is possible, because of Moho's z-buffer handling, but I cannot for the life of me get it to work. The visible depth is always tied to the order of the layers, no matter what permutation of depth options I choose (e.g., sort by depth, sort by depth with true distance, depth sorting off, etc.).

Anyone run into this? Any help would be appreciated. :)
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Re: Z-buffer trouble when mixing 2D and 3D

Post by Lost Marble »

I'm not sure what the tutorials say, but 2D layer do not use the z-buffer. Multiple 3D layers can intersect with each other because they all use the same z-buffer, but 2D layers are always composited in layer order. That layer order may be animated or automatically controlled by depth, but a 2D layer is always determined to be in front of or behind another layer - it cannot "intersect" another layer in 3D space.

-Mike
eric1223
Posts: 256
Joined: Tue Jun 25, 2013 9:35 am

Re: Z-buffer trouble when mixing 2D and 3D

Post by eric1223 »

I can tell you 2 things that may work for you.

1. If it's possible in your 3d program, you could export each 3d object sepertly. You can put them all in a group and enable depth sort (I don't know if you need true distance for this. See what works. You could also do this without grouping from the project settings from the file menu. The 3d program I have keeps everything in its rightful place according to its center point. When I export in moho, it's origin is its center point.

You could keep your obj file with 1 3d object, but you would have to mask your 2d character for it to work.

Hope it helps. Btw what program do you use for 3d?
CamLewis
Posts: 4
Joined: Wed Mar 29, 2017 5:39 pm

Re: Z-buffer trouble when mixing 2D and 3D

Post by CamLewis »

Thanks for the pointers, guys. I wasn't aware 2D layers don't contribute to the z-buffer.

I've been doing most of my stuff in Cheetah3D. :)
Post Reply