1
$\begingroup$

What I want to do is to use an equirectangular environment texture as my world environment texture. But I also use render layers to exclude and mask out parts of the texture. The masked out parts of the environment texture will just be rendered black.

Basically, I'm creating a 360 degree video and I want to add 3D into it and mask it so that it fits with the environment texture.

Any ideas?

$\endgroup$
2
$\begingroup$

I'm not quite sure I understand, but I think you are saying that you want mask out parts of an environment texture (video) in your 360 deg video.

Setup

In a 3D scene, select the camera, go to the Object Data tab in the Properties panel (should show camera data). Under Lens, select Panoramic from the 3 options, go to the nearby drop down menu, and select Equirectangular. With the mouse in the 3D Viewport, key N to open the right side bar. Make sure Rotation: X: is set to 90, Rotation: Y: to 0, and Rotation: Z: to 0. Load in your 360 deg video by going to the Properties panel's World Data tab. Switch to Cycles Render Engine if you haven't already. Click Use Nodes, then the square button with the circle in it to the right of the color information slot, enter image description here, and select Environment Texture. Press Open and locate your video. Select Open Image when you have found it.

Figure out how many frames are in your video and type that into the Frames: box that should appear below the path to your video. One way to do this is to go to the Video Editing Screen Layout, key Shift + A, select Movie, and select your video (a strip should appear with arrows on either end pointing inward). If you right click on each of these arrows, numbers should appear (the largest being the rightmost). Remember these numbers. The formula for frames in your is Rightnumber - Leftnumber + 1. Important: Delete the strip before you return to the Default Screen Layout.

Masking

In the 3D Viewport, change to Viewport Shading > Rendered. Drag different shapes around to blot out the spots you don't want in your final video. You can keyframe these shapes if objects in your video that need masking move.

Compositing

In the Properties panel, go to the Render tab > Film > Transparent. Make sure it's checked. Go to the Render Layers tab > Passes > Environment. Make sure it's checked.

Switch to the Compositing Screen Layout (at the top where it normally says 'Default'). Use the following node setup:

enter image description here

Use the color input in the Alpha Over node to set the color of the masked out area. All of this produced an example result of this for me:

enter image description here

Limitations

Everything masked out has to be the same color. If you want that color to be transparent, click on the color input and drag the Alpha: value to 0. You could add an alternate image as a background I guess, but it would be strange having to design one image to background everything masked out in the background. Should you show the inclination to do so, this would be the node setup:

enter image description here

And it would produce something like this:

enter image description here

Hope this helps and best of luck!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.