Holographic foil card effect

Earlier this week I saw a really neat effect where @Sererena simulated the view-dependent shimmering of a foil card, fed by a smartphone accelerometer.  This seemed like a good challenge to improve my material creation skills in UE4, so I gave it a go yesterday and came up with something I’m reasonably happy with. The view angle is controlled by WASD rather than the accelerometer since I was more focused on the material.

Download

You can download the assets and test project (built with Unreal Engine 4.15), licensed as CC0.

Construction

The material has 8 layers:

  • Background
  • Distant large stars
  • Small stars / motes
  • Near large stars
  • Character foil outline
  • Character
  • Foil on character accents
  • Card border
Outline of foil card material (M_FoilCard) showing the various layers

The foil character accent layer and the star layers all parallax as the view angle changes (shift around, with a larger shift for nearer layers, faking a sense of depth).

The foil layers (everything except the character) are colored by a lookup into a ‘holographic plate’ texture, using an ad hoc function of the tex coord, distance, and tilt amount.

The character accents layer is done with a color notch filter and one star layer, directly added to the character color (rather than lerping to it). This is the part I’m least happy with in the current implementation, but I’d need to test it with a real character to see exactly what I’d want to change.

The material is built using a bunch of material functions as building blocks to make it cleaner, but these aren’t meant to ‘stand alone’; there are lots of assumptions built into them about textures and parameter values.

I’m using a live capture of a 3D character instead of a 2D base, but after the capture Blueprint updates the render target, everything else is the same either way. The capture BP is an opaque box containing the character, a capture component, and a controlled light source.  Even with setting the capture component to only capture the self actor and setting an aggressive culling distance, some ‘global’ things like atmospheric fog still render into it, so I had to use the mode that gave me depth in alpha rather than an opacity mask in order to discard it.

The outline is done with a Sobel edge detection filter on the thresholded depth from the character render target (which has depth as alpha). Rather than using a kernel of the adjacent texels, it uses texels 8 away to increase the width of the outline. If I were using 2D characters I’d probably skip the runtime Sobel filter and do that offline once into a mask texture.

Graphics research framework

This is pretty much just a laundry-list of features with some pretty pictures.


Useful stuff

  • Flexible scene-graph with multiple render targets
  • Virtual File System for seamless loading from regular directories, Quake PAK archives, or ZIP files.
  • Limited GUI support (transparent text windows which can be dragged around or typed into, great for debugging)

Level formats supported

  • Quake level loading (.BSP, version 0x1D)
  • Quake II level loading (.BSP, version 0x26)
  • Quake III level loading (.BSP, version 0x2E)

Model formats supported

  • Quake II model loading (.MD2)
  • Quake III model loading (.MD3)
  • Molecule loader (.M3D)
  • 3DS loading (.3DS, incomplete)

Textures/materials supported

  • JPG
  • PNG
  • TGA
  • PCX
  • BMP
  • Q2 .WAL
  • Q3 .shader

Demo effects:

  • Tunnel
  • Infinite 3D grid
  • Tie-dye (composite effect)
  • Sinus Scanlines
  • Copperbars
  • Iterated function systems with multiple morph modes and pre-defined matricies for the morphers: Binary, Coral, Crystal, Dragon, Fern, Floor, Spiral, Swirl, Tree, Triangle, and Zig-zag
  • Particle systems: Snow, rain, grid-bugs, explosion debris

Full-screen processing:

  • Radial blur
  • Roto blur
  • Motion blur
  • Glow blur

Procedural surfaces:

  • Sphere
  • Ellipsoid
  • Cylinder
  • Rectangular prism
  • Torus
  • Superellipsoid
  • Supertoroid
  • Elliptic Torus
  • PQ torus knots
  • Springs
  • Bezier curves
  • Supershapes
  • Spherical harmonics

Misc. features:

  • Texture-mapped fonts
  • For a neat effect, text strings can be bound to any of the path objects, such as the PQ torus knot.
  • Skydome (including real sun position and CIE clear/cloudy sky luminace)
  • FBm generated heightmaps
  • Heightmap from image
  • Skybox

Generated surfaces (no parameters):

  • Pisot Triaxial
  • Triaxial Tritorus
  • Pillow Shape
  • Whitney Umbrella

These are all generated using a general purpose parameterized-surface generator with different parameter matricies.

Real-time ray tracer

Here are a few images from my real-time raytracer (taken on a 900 MHz Athlon):

It supports temporal supersampling, where only a fraction of the pixels are rendered in any given frame, so the image is rendered at interactive rates with degraded quality when being moved, but it converges to an optimal solution if the camera is left alone for a second or so (not enabled on these pictures).

I intend to add adaptive sub-sampling to increase speed without much loss in quality, and as an extension, the level of subdivision can be increased when the camera is still. This should give the speed advantages of sub-sampling without the problems in static images (missing small objects), although it will still have aliasing in animation if an object projects to something smaller than the initial grid resolution and falls fully inside of a grid cell.

It currently only supports spheres and planes, another area for expansion.

Note: The scene files are from an computer graphics course I saw online a long time ago, but I don’t remember exactly where they came from. If anyone has contact information, please let me know and I’ll add it here.