Published using Google Docs
Wall_Hiding_System_Documentation
Updated automatically every 5 minutes

Wall Hiding System

v1.0

Note: If you are encountering visual artifacts on the screen during the game, you need to set "Custom Depth-Stencil Pass" to "Enabled with Stencil" In Project Settings.

See the 'Additional Information' section for additional information.

Note: If it's too dark inside the Buildings (engine versions 5.0+), read the fix at the end of the documentation.

If you're having problems with integrating asset into your project:

Create an empty project, add a Wall Hiding System into it, then set the game mode to GM_Demo in Project Settings.

After that, everything should work the same way it does in the demo.

Table of content:

Getting Started

Material Functions

Function Parameters

Mesh Settings

Additional Information

Project configuration

Turn the Hide effect on or off during gameplay

Lighting problems

Getting Started

To add a hiding effect you need to:

Open the material that you want to hide (the material that is applied to the mesh) and Switch Blend Mode to Masked

Right сlick on the materials column, add the "Material Function Call" node

Highlight the node and select one of the hiding functions shown below:

Add a Collection Parameter node in a similar manner

Highlight the Collection Parameter node and select MPC_Walls

Then select one of the Collection Parameters

Connect the Collection Parameter node to the MF_Hide function, and the MF_Hide node to the Material Opacity Mask channel



Next, you need to create logic that will change the coordinates of the variable in the material collection. It is better to do this in the Event Tick player controller.
Create a "Set Vector Parameter Value" node, select MPC_Walls in the Collection Parameter node, then select one of the parameters of this collection.

The example below shows one of possible ways to get the coordinates of a character controlled by the player.

Parameters Collection stores variables that a material can use. You can add your own parameters there if needed (to make multiple hiding places, for example.)

The example below uses two variables in the Parameter Collection to hide the walls around both the character and the cursor. You can, for example, hide walls around multiple players in a similar fashion.


The Materials folder contains examples of how the hiding functions can be used, examples of how to use them together with vegetation masks and examples of how to combine several masks together.


You can, for example, combine several hiding functions in a way shown below:


Note: Combining multiple functions in such a way can create performance-intensive materials. It is advised to check Shader Complexity from time to time by pressing F5 when the game is running.

Material Functions

Asset includes 7 Material Functions that are designed for hiding objects, they are located at this path:
Content\Wall_Hiding_System\Materials\Material_Functions

MF_Hide

This function is designed for hiding walls and works best with long meshes (Large size along one of the axes, or scaled along one of the axes). For large, square meshes, it is better to use a function that has a hiding capsule, it's called MF_Hide_Capsule.

It only hides the walls that overlap a character.

MF_Hide_Dithering

Very similar to MF_Hide, but has a Dithering effect.

Ghosting effect can be removed by switching antialiasing type to FXAA in the settings of your project.

MF_Hide_Capsule

A simplified version of MF_Hide that is less performance-intensive. It is well suited for hiding roofs and other objects that are above the character. Anything within the capsule of a specified radius, that is located between the camera and the player, will be hidden.

MF_Hide_Capsule_Dithering

Very similar to MF_Hide_Capsule, but has a Dithering effect.

Ghosting effect can be removed by switching antialiasing type to FXAA in project settings.

MF_Hide_Capsule_With_Height

This is a variant of the MF_Hide_Capsule function.
It has a vertical mask that leaves the bottom part of a mesh visible. This is meant to be used in situations where you need to hide objects like poles, antennas and trees, which can overlap the player's character at a great distance, but at the same time you also need the base of the object, e.g. a tree stump, to remain visible.

It can also be used in place of MF_Hide as a cheaper option in terms of performance.

MF_Hide_Inverted

This is an inverted hiding material. Meshes start to appear when the player approaches them.

MF_Hide_Vegetation

This function completely hides an object that is located between the player and camera at any distance. Quite handy for hiding vegetation.

In the demo level, some meshes like trees or walls with windows have 2 material channels, one channel uses a normal material, and the other channel uses a hiding material.

This can be useful for hiding only the foliage of trees while leaving branches or stumps visible, for example. Or it can be used to have visible doorways while the walls themselves are hidden, so that if a player is behind a hidden wall that has a doorway, he will always be able to find the entrance to a building.


Function Parameters

This is a list of parameters that are found in some or all of the Material Functions.

Location (V3)

World Location of the space where the object will be hidden

Radius (S)

The size of the area that will be hidden

Radius Falloff (S)

Feathering of the hiding area. If set to 0, the hidden area will have a sharp border.

Capsule Radius (S)

Width of the capsule that is aimed from the camera to the hiding point. Everything inside the capsule  will be hidden.

Capsule Radius Falloff  (S)

Feathering of the hiding capsule borders. If set to 0, the hidden area will have a sharp border.

Height (S)

The height of the mask at which the bottom of the mesh remains visible.

Height Falloff  (S)

Feathering of the vertical mask. If set to 0, the hidden area will have a sharp border.

Enable Noise Texture (B)

Enables a noise texture around the edges of the hidden area.

Noise Texture (T2d)

Selects the noise texture that will be used around the edges of the hidden area.

3 texture variants can be found in the Noises folder.

Noise Texture Size (V3)

Tiling of the noise texture.

You can compress or stretch it along one of the axes with this parameter.

Opacity (S)

Opacity value of the material.

Start Offset (S)

Positive values offset the capsule closer to the camera, negative values move the capsule further away.


Mesh Settings

In the demo, the Camera channel is used to get the coordinates under the cursor so that the character starts moving to that space.

For this reason, all wall, roof and tree meshes and other objects that can prevent mouse clicking on them have the Camera channel disabled in their collision settings. This is done to make it for the player to move their character.

Additional Information

Project configuration

To enable character outline, follow these steps:

  1. In Project Settings, find “Custom Depth-Stencil Pass” and set it to “Enabled with Stencil”

  1. If you don't have a Post Process Volume in your scene, place one by using the Place Actors window (or just copy one from the demo level)
  2. Turn on "Infinite Extent" in the Post Process Volume settings to make post processing work on the whole map

  3. In Post Process Volume settings, find “Post Process Materials” and add an element to the Post Process Materials array (by clicking on a + sign), then select “Asset reference”

  1. Then place a M_Highlight_PostProcess material in the empty slot.

Turn the Hide Effect on or off during gameplay

https://drive.google.com/file/d/1EHbBtsBOn59lWhxvVR_v-F4PR-t9EVwS/view?usp=drive_link

Lighting problems

If the inside of buildings is too dark, you will need to disable Global Illumination in the project settings.

The video was recorded on the engine version 4.27, in version 5 the lighting model changed.

You can also switch the lighting model to the old one.

To make it even lighter, you can change the intensity of Sky.

Also look at the post process parameters, there you can additionally make the falling shadows not so dark or reduce the AO.