Adaptive Camouflage

About the project

For this project I wanted  to create a camouflage shader that would imitate the effect that i have seen in movies so many times before. I had noticed in games that while such shaders existed they did not possess certain features that were staples of the effect in movies so i also wanted to see why. I noticed early on the problems that existed with the concept of camouflage shaders and I wanted to see if I could do anything to remedy this. 


This project is split into two parts:

  • Camouflage

  • Glitch Effect


The first step was to create the actual method for the camouflage, this proved more difficult than I first anticipated and I had to do a lot of RnD to find a method that would work for what I tried to accomplish. This eventually led me to what I refer to as "Fake Transparency", I call it that because the shader does not involve any actual transparency.

"Fake Transparency"

To achieve this fake transparency I used an opaque material in which I manipulated the normals to point away from the camera. This way it would sample the reflection capture from the opposite direction which requires me to have the roughness at 0 and the metalness at 1. I didn't want the camouflage to be perfect and still fail at close inspection. I did this by adding a Fresnel Function, with it I could highlight the edges of the vehicle to make it slightly visible on close range.

Fake Transparency.png

To get the desired result of this effect I had to turn down the Screen Space Reflection and turn off Tangent Space Normal. Doing this did give me the desired effect but also results in the normal map not displaying correctly on the mesh while visible. This is fixed by transforming the normal map from Tangent Space to World Space.

Converting Tangent Space to World Space.

Fake Transparency vs Opacity

I realized early on that I couldn't just make the mesh invisible with opacity, doing so would present certain issues as camouflage and transparency are very different. While I did find certain methods in unreal that fit perfectly with what I was going for, due to specific limitations related to the shader model they had to be abandoned. The SceneColor node seemed perfect for creating a camouflage effect, but it was limited to Translucent materials, meaning it would look good while camouflaged but would look terrible when visible.

When using opacity certain parts will still be visible halfway through the transition. Translucent shaders have similar problems but would also cause sorting issues.


Opaque Shader


Masked Shader


Transclucent Shader

This is solved using an Opaque shader since you actually can't see through it. Doing this also allowed me to achieve the staple effect of camouflage in movies which is the ability to hide the interior of an object and selectively show it at certain points. Examples of this effect is when you open the door to an invisible car or when Harry Potter pokes his head out of the cloak of invisibility. You don't see the interior of the vehicle unless you look through the open hatch, the same way you don't see the intestine of Harry Potter when he pokes out of his cloak.


Glitch Effect

I wanted to create some sort of a glitch effect to emulate disruptions in the camouflage. This type of glitch effect would have to work slightly differently than a normal as it had to affect reflections rather than a texture. While cloaked the shader uses two types of effects to simulate glitches; shifting and pixelation. Shifting would jump between different values for the normal direction causing the view to become slightly offset, the pixelation would play with the resolution, making it jump between different resolutions. These two effects were later lerped into the fake transparency through a glitch and turbulence mask to simulate glitches.


To create a smoother transition later on I created an additional effect for when the transition is midway between visible and cloaked. This effect is created by offsetting the red and the green channel of the base color with a small value and then flickering them back and forth.



For the transition I created 2 transition masks, one that swipes from one side of the mesh to the other one that only highlights the scanline of the transition. These two were combined for the camouflage mask and by only using the the scanline mask I could add an additional effect for a smoother transition.





Final Result


I tried several different methods of achieving the camouflage effect, all which had its own downsides and limitations. If given the time I would have liked to explore more methods to find the most optimal solution, there are still several methods I did not get to explore as in depth as I would have liked.