Culling triangles within volume

I am fully aware that if there IS a way to do this, it would likely be very complicated.

I have an enclosed vehicle that has the ability to topple trees as it collides with them. This is actually working very well, besides that fact that the leaves of the trees clip through the body of the vehicle, destroying the sense of immersion in we were aiming to provide with this feature.

So I’m looking high and low for a solution that doesn’t involve turning the trees into skeletal meshes, or tearing the models up into individual pieces and hiding each branch individually as it clips.

I was wondering if there was some sort of trickery I could pull to hide parts of the foliage as it clips through the body. I have a lot of ideas for how this could be done, but I’m entirely unsure if ANY of them would work. Could I detect what parts of the tree’s UV are within the vehicle’s interior volume, and use this to drive UV parameters connected to an opacity mask within the tree material? Could I somehow use the vehicle’s interior volume to drive the scale of the mesh bounds?

There has to be some way to do this!

Any input at all would be greatly appreciated!

maybe this will help:

Ahah! Very interesting. I’ll spend some time trying to set something up with this today. If I’m successful, I’ll post my results if anyone is interested.

Thanks a ton for that link!

Okay, so after going through that tutorial, I realized he’s using a translucent material to drive this effect, but my foliage needs to be masked in order to function properly. How can I add this effect over my opacity mask?


Just wanted to add that this is working perfectly otherwise, this is EXACTLY the effect that I needed and is far less complicated than I imagined.

I got this fully functional and it works like a charm. If anyone is interested, let me know and I will post my blueprint.

Cool - I’m interested in seeing your solution!

Okay no problem!

I got this to work by creating three sphere collisions that act to fill up the interior of my vehicle. The origins and radius of those spheres are sent to a Material Parameter Collection that holds all the information that the Material Blueprint uses to do this.

I originally tried using a box mask (3d) and a box collision mesh instead, but I couldn’t get the box to rotate correctly with the vehicle. Luckily in my case, using multiple spheres instead worked just fine!

Below is a picture of the section of my Material Blueprint that handles this. I simply add the masks from the three spheres, one minus the result, and then multiply this result with my original foliage opacity mask.

alt text

And the result is awesome! As my vehicle moves through any foliage that is using this Material, any parts of the foliage that intersect with my interior volume spheres are masked, and totally invisible- making my vehicle wayyy more immersive and realistic.

I’d love to show a picture or video of the end result, but sadly I’m not at liberty to do so right now.

Thanks again to ScottSpadea for the link to that awesome tutorial video!

Looks like a great solution! Is there a reason you used 3 float params per sphere as opposed to 1 vector param?

I kept getting an error message stating that the sphere mask was incompatible with vector 4’s, but I guess collection vector parameters always default to vector 4’s? I didn’t see any evident way to convert a vector 4 to a vector 3 within the Material Parameter Collection, and I’m pretty new to the Material Editor in general so I wasn’t sure if there was a way to convert v4’s to v3’s directly in the Material Editor, or split their outputs, so I just made three float scalars for each sphere and combined them to make a vector 3 instead.


But if you know a solution to that I’d be very glad to hear it! If I could have vector 3’s in my Material Collection it would definitely be cleaner than combining floats instead.

Ahhh cool, I had no idea. Thanks yet again Scott.

you can convert between vector 4 and vector 3 using a “component mask” node in the material graph.