Thanks for your interest in my Cloaking VFX project. On this page you’ll find a technical breakdown of each asset contained within, and some guidance on how to integrate the effect and its associated systems into your own project.
If you have any questions or concerns you may find them addressed in the Frequently Asked Questions section at the bottom of this page. If you can’t find what you’re looking for you can reach me at email@example.com and in the techarthub Community Discord server.
This Blueprint Component is where most of the magic happens.
When attached to an Actor it will create the necessary Material Instances that drive the effect and assign them to any Mesh Component that has the CloakComponent Component Tag. You can find several examples of these in action within the CloakingVFX Demo level that comes bundled with the project.
I decided to use an Actor Component because I felt it made it easier to add a Cloaking Device to any mesh object. It’s also part of a framework I’d like to use for similar modular upgrades in the future.
Sets the target Cloak Radius (ie. the overall size of the effect) to either its maximum value (Cloak) or zero (Decloak) before setting bCloaking to true to start animating the Materials.
Get Cloak Components
Loops through all of the Owning Actor’s components and adds any with the CloakComponent tag to an array of Cloak Components.
Creates the required Material Instances for the effect (based on your Material Settings values) and applies them to your Cloak Components.
Spawns and attaches an Audio Component to the Owning Actor from which we can play a looping cloak sound.
The Create Materials, Create Sound, and Get Cloak Components functions only need to fire once on Event Begin Play.
Randomize Cloak Origin
Generates a new randomly placed origin point for the Cloaking effect by tracing inwards from the edge of the Owning Actor’s bounds.
If you’d like the Cloaking effect to always start from a specific position you can bypass this function and just set the Cloak Origin value directly.
Updates the Origin vector value across all Materials. This is usually only fired when this location changes (via the Randomise Cloak Origin function) or when the object is moving.
Interpolates the Cloak’s Mask Radius towards its target and updates the sound volume/pitch to match.
Draw Debug Objects
An optional function which will update some debug spheres to help illustrate what’s happening underneath the hood. Set the bDebug bool to true to enable them.
All of the variables in the project have been given internal descriptions but if something doesn’t make sense you’re probably not the only one to notice, so please let me know!
|Sound||The looping Sound Cue that will play when the effect is active.|
|Volume||The maximum volume of the cloaking sound.|
|Volume Curve||A Float Curve that defines the volume of the cloaking sound over the duration of the effect.|
|Pitch Min||The minimum pitch of the cloaking sound.|
|Pitch Max||The maximum pitch of the cloaking sound.|
|Pitch Curve||A Float Curve that controls the pitch of the sound over the duration of the effect (bound by the Pitch Min and Pitch Max values.)|
These are the values that govern the Material side of the effect.
|Base Materials||A map of Materials and Material IDs that correspond to each of the meshes that will have the effect applied. These Materials will be used to create the Instances used by the Cloaking effect.|
|Cloak Material||The Material to use when the Cloaking effect is visible.|
|Base Normal Map||An optional normal map that can be added to the Cloak Material, which is blended with Cloak Pattern normal.|
|Edge Tint||The color of the edge between Cloaked and not-Cloaked parts of the mesh.|
|Edge Width||The width of the edge in centimeters between the cloaked and not-cloaked parts of the mesh.|
|Distortion Map||The texture used to drive the edge distortion.|
|Distortion Scale||The world space scale of the Distortion Map.|
|Distortion Intensity||The intensity of the edge distortion.|
|Distortion Speed||How fast the Distortion Map coordinates should pan, making the effect animate even if the Cloak Radius isn’t being updated.|
|Distortion Offset||Offsets the Distortion Map’s coordinates. This is useful if you’ve got multiple identical meshes lined up (like I have in the Demo level) and you want the distortion effect to be different for each Actor.|
|bDebug||Enables a few debug spheres that help illustrate how the effect works, which can be useful when fine-tuning the effect.|
|Speed||The speed of the cloaking transition.|
|Cloak Radius Min||The minimum size of the Cloaking Radius. This value is also used to offset the sphere mask from the object within the Randomize Cloak Origin function.|
|Cloak Radius Max||The maximum size of the Cloaking Radius. This will be specific to your particular use case.|
Frequently Asked Questions
Will this effect work in Unreal 5.0?
Yes and no. I am taking advantage of a new feature in Unreal 5.1 called an Overlay Material (it’s so new I don’t even think it has official documentation yet) which lets me draw a transparent cloaking pattern Material underneath a masked base Material.
Without this feature the effect is still doable, but we’d have to use multiple meshes to get the same result. If you’re still keen to get it to work, shoot me an email. If there is enough interest I’d be happy to make a variant for UE5.0.