Round Cone Mask

Overview

This effect is based on the World Dissolve script with the Round Cone masks. It dynamically adjusts round cone transforms to follow the player and scale dynamically when objects are detected between the camera and the player.

How To Use It

Ensure that you have properly set up World Dissolve with the Round Cone mask. If not, follow the setup instructions.

Add SeeThroughHelperRoundCone.cs to any game object in your scene.

Assign the World Dissolve object and camera transform.

Add Mask Object to the Masks Objects list and assign all properties. The Mask transform is one of the transforms of the Round Cone masks. It will follow the player and scale dynamically when an object is detected between the camera and the player.

Each property has a tooltip with a default value.

Now the Round Cone mask transforms will follow the camera and the player.

How To Fix Camera Lag

When one of the Round Cone transforms copies the camera position, it might create laggy output. To fix that issue, you need to use the Custom Camera Update. This Unity event calls every function that you add to On Camera Update in the LateUpdate() of the See Through Helper.

Example modified camera script looks like this

The late update logic is turned off, and it is called from the OnCameraUpdate event in the see through helper script.

Using Cinemachine

Cinemachine has the manual update option. You need to enable it.

Add the Manual Update to the OnCameraUpdate.

See Through Helper Round Cone

For each mask you are using, you need to add a new Mask Object to the mask objects list.

Mask Object

Mask Transform: Transform of the mask, used for positioning and scaling.

Enable Follow: Enables the mask to follow a target transform.

Follow Target: The target transform that the mask should follow.

Follow Offset Distance: Offset distance towards the camera from the target position. Default: 0.3

Enable Smooth Transition: Enables smooth transition effect while following the target.

Smooth Follow Duration: Time taken for the smooth follow effect to stabilize. Default: 0.02 seconds

Enable Dynamic Scaling: Enables dynamic scaling of the mask based on the presence of objects between the mask and the camera.

Detection Layer: Layer mask used to detect objects that interfere between the camera and the mask.

Min Scale: Mask scale when no obstruction is detected. Default: 0.01

Max Scale: Mask scale when obstruction is detected. Default: 1

Scale Adjustment Duration: Time taken for the mask scale to adjust smoothly. Default: 0.05 seconds

Other Settings

Force Update Mask Parameters: Enable if you are experiencing any lags due to the updating of the mask transform's position.

Enable camera mask follow: Do not turn off if you want the camera mask transform to follow the camera.

Initial camera mask scale: The lower the camera mask scale, the more accurate the see-through is, but when the camera is near a wall, it might produce glitches. You need to balance the value depending on your gameplay needs.

Last updated