I have a Sublevel with many actors, with diverse materials. (It’s a model of a neighborhood: trees, cars, roads, signs, grass, buildings, etc.) I’m placing this model on a round table, and want to clip it to the table, similar to the inverted sphere mask seen here: WTF Is? Material - Sphere Mask in Unreal Engine 4 - YouTube
Then the player will be able to pan the diorama around, and see the content sliding, but always clipped to stay on the table.
How can I best apply this sort of masking effect to every material of every mesh inside a Sublevel?
(Note: I listed 4.16 as my version, but we will hopefully be moving to 4.18 in the next month or so.)
Ideas so far:
- Modify every material that’s used to apply a masking function to the Opacity or Opacity Mask. (Requires converting all materials to Masked or Translucent.) Do not re-use materials between things outside the Sublevel and things within it. Optionally, write a utility that does this automatically (for potentially many materials).
- Modify the engine so that all materials automatically use this sort of masking.
- Some sort of multi-pass rendering using z-buffer and other masking to clip the sub-level.
Proven not to be usable:
- Modify every material to expose an Opacity or Opacity Mask parameter, and then at runtime crawl all the actors and replace materials with Dynamic Material Instances. Not only does this require modifying all the materials anyhow (like #1 above), but dynamic material instances cannot (I think?) take complex node graphs as inputs to parameters.