How do you occlude moving objects in 3D space?

rbuswellrbuswell Website User Posts: 9
edited October 2018 in HitFilm

A little background.  I watched and followed Mike Miller's tutorial on creating planets using sphere in Hitfilm.  It worked fine.  I created earth and the moon. I attached the  planet objects to 3d points and had the moon orbiting around the earth.  But when the moon was supposed to go behind the earth, it went in front.  I switched the layer order, and, as you would expect, the moon went behind when it was supposed to go in front. After much searching through forums, tutorials, etc., I didn't find a solution.  I tried Depth Matte, Depth Mask, found references to Depth Map, and Z-Res, but nothing I really understood or found useful. 

(Side note:  Could someone who understands these depth rendering things create a tutorial for them?)

I tried importing a 3D sphere model and used the same textures as I did for the spheres effect.  They looked good, and I even managed to get the transition from day to night earth using a difference key (set matte didn't work in this case).  I layered multiple spheres for the earth (day, night, clouds, atmosphere, and matte) and used a single sphere for the moon.  Everything looked good so far.  I set the spheres as 3D layers and everything looked good.  But still no occlusion when the moon went behind the earth.

Attempt 3: I moved the models into composite shots as 3d Layers to preserve the effects I added to them and set the composites to 3D Unrolled in the main comp.  This is where all hell broke loose, and I throw my hands up in frustration.  The multiple layered models of earth looked good in the initial frame, but then they started doing wonky things.  The cloud layer would only display the right half of the hemisphere with a perfect vertical line, then reappear fully, only to stretch to the right.  The daytime earth would rotate and then slice itself in half and slowly grow back.  Really weird stuff.  The moon didn't show up at all  as 3D Unrolled.  When I changed it to a 3D Layer, it was a 2D Plane the spun around its axis.  The good news is, it finally occluded correctly.

Does anyone know what I'm doing wrong, and is there a tutorial or WRITTEN resource that explains how to achieve the effect I'm looking for?  I vaguely remember seeing a discussion on occluding planets a long time ago, but I couldn't find it.

Comments

  • rbuswellrbuswell Website User Posts: 9

    Update.  I found a solution that worked in my case.  In the second version, using the earth models as 3D layers, I changed just the moon to 3D Unrolled, and it occluded properly and the earth didn't give wonky render issues.  The moon had no effects applied to it, which is why I could change it safely.  I still would like to know more about what happened and especially have someone explain the depth features in HitFilm.

  • Stargazer54Stargazer54 Moderator Moderator, Website User, Ambassador, HitFilm Beta Tester Posts: 2,726 Ambassador

    @rbuswell You might have been experiencing a known bug.  If you build a 3D scene in a composite shot everything works as expected when objects are 3D unrolled.  But . . . . if you bring that same comp into another comp and turn on 3D unrolled for the first comp then, the camera clipping plane will clip off your object in Z.   Which is probably what you were seeing with parts of your object appearing and disappearing.

    The devs promise a fix is coming.  Just don't know when.

     

  • Triem23Triem23 Moderator Moderator, Website User, Ambassador, Imerge Beta Tester, HitFilm Beta Tester Posts: 18,304 Ambassador

    Super short description of Depth Layer:

    Instead of 2D, which immediately renders an object in Layer Order, then passes it directly to the Effects buss, or 3D Unrolled  which doesn't render any objects until hitting a full 2D layer (which is why you can't add effects - the 3D Unrolled layers render AFTER a 2D layer's effects), the easiest one is "Depth Layer."

    This is kind of like "2.5D Unrolled." You can define a "layer pair" to calculate occlusion  then pass the 2D layers to their Effects busses. 

    So, if you set the planet layer's depth layer to the moon, and vice-versa  they should occlude correctly while still being 2D with Effects. 

    I had a quick video for this  but I think I deleted it. 

    The planet tutorial didn't get into this  of course. It was more about texture creation, day/night mapping and showing off the new (at the time) upgrade to Sphere so that filter reacts to 3D lights.

    I intend to relaunch Hit-U in January  There have been enough core changes in the software to require new versions of extant tutorials .. Then I guess I'll FINALLY get around to Animation pt 4, Cameras pt 4, then lights, materials  etc. 

  • GrayMotionGrayMotion Website User Posts: 1,368 Enthusiast
    edited October 2018

    "using the earth models as 3D layers, I changed just the moon to 3D Unrolled,"

    As Triem23 explained in detail....

    Leave both the Moon and the Earth models in 2D layers. Make the moon 75% smaller than the Earth. Add a 3D point and animate it on Y , Offset the Moons position to 700 on Z and then parent the Moon model to the point.

    In the stack put the Moon layer above the Earth. Go to the layers properties of the Moon and set the Depth Source layer to Earth. 

    The Moon is now in orbit around the Earth

    A no-audio example for you
    https://www.youtube.com/watch?v=KvKbJ6Xb4sk

  • rbuswellrbuswell Website User Posts: 9

    Thank you all for your responses.  I finally got everything to work by scaling up the clip windows and setting the depth source layer on the sun and the moon.  

    TRIEM23: I am glad to hear that there will be more HitFilm University videos coming.  I LOVE those.  I find it helpful to not only know HOW to do an effect but to understand what is going on inside the program, so I can apply the principles and know what's going on when things don't work right.  HU has the only video that explains blend modes that went beyond, "Just try it out and see what happens."  I hate that kind of instruction, because I'll move a slider, nothing will happen, and I've learned nothing about the effect.  Your videos explain what conditions must be met to see a result, which is not usually the case with most tutorials I find online.  Bravo to you, sir.

    GRAYMOTION:  Your video was extremely helpful and the final piece to my missing puzzle.  Thank you.

This discussion has been closed.