4
$\begingroup$

I'm trying to do an animation where a desertic road scrolls like a treadmill. I have a long road designed like this : enter image description here

as the road scrolls (moves) from right to left, I'd like to show only the center square of this long road. What I mean really is to show only what's inside this cube (without actually seeing the cube obviously) : enter image description here

I tried to use the mask modifier but I can't really get to what I want. I was thinking that instead of displaying only what's happening in the cube, it might be easier to mask everything that is inside these ones : enter image description here

Either way I can't really figure out how to use the mask modifier in that case, to use these cubes as masks without seeing them in the render... I hope I'm clear enough, sorry if it's not. I'd appreciate your help, and wish you a great week-end.

Cheers

$\endgroup$
4
$\begingroup$

With a boolean modifier

You had it right with either of these solutions. I would use the first one. But as you noticed, the cube mask hides the part you want to show. Select the cube and go into object properties and set the viewport display to "Wire". also don't forget to uncheck "Render" in the visibility so it doesn't appear in your animation.

enter image description here

Then Select the road object, add a boolean modifier set to "intersect" and pick the cube mask.

Now you can either move the mask or the road to get the desired effect.

enter image description here

With a custom shader

You can limit the visibility of the road with a custom shader. You then don't have to use a mask object, and you won't have boolean artifacts, but the drawback is the mesh doesn't get "cut" on the edges of where it needs to stop displaying.

Select the road, go into the shading editor and add a new shader. Let's say you want the road to display between y = - 1 and y = 1. Add this setup to visualize the alpha of the material (1 is white, meaning the material is opaque. 0 is black, meaning the material is transparent):

enter image description here

Plug it into the alpha input of a principled bsdf shader and connect the bsdf to the material output. In the right hand side panel, go to options and set the blend mode to "Alpha Clip".

enter image description here

Result :

enter image description here

$\endgroup$
1
  • $\begingroup$ Wow thank you so much for the very detailed answer, it's really cool. I'm gonna test it right away :) Thanks again ! $\endgroup$
    – Sidlich
    Dec 19 '20 at 16:36

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.