This shader, built from the standard color correction shaders, can be used for mimicking animated cloth. With this shader you will be able to run animated flags and cloth in your scenes using a video to drive the displacement.



The main functions of the shader are to provide displacement driven by textures.

  • Color Sampler
    • Input for Image map
  • DisplacementSampler
    • Input for Image map
  • Displacement Scale
    • default: 300
    • range: [0, 500]
  • Displacement Blend
    • default: 0.5
    • range: [0, 1]

This shader also uses a full color correction system, editable in Previzion individually and globally with other color correction shaders.  Courtesy of Christian Bloch(EdenFX/HDRLabs.com).

  • Exposure(f/stops)
    • default: 0
    • range: [-2, 2]
  • Gamma Correction
    • default: 1
    • range: [0, 1.5]
  • Offset Brightness
    • default: 0
    • range: [-0.5, 0.5]
  • Final Contrast
    • default: 0
    • range: [0, 1.5]
  • Shadows
    • default: Black (0, 0, 0)
    • range: [+/- ∞] Full color spectrum
  • Midtones
    • default: Gray (0.5, 0.5, 0.5)
    • range: [+/- ∞] Full color spectrum
  • Highlights
    • default: White (1, 1, 1)
    • range: [+/- ∞] Full color spectrum
  • Saturation
    • default: 1
    • range: [0, 2]



Movement Generation

To make the flag displace in the proper direction, the flow of the video must be from left to right. This video shows what a wave for a flag looks like. This effect was rendered from Maya and blurred in After Effects.


Download Video

Apply the video to the DisplacementSampler attribute of the shader as a video_name.jpg this will allow you to attach the video to that attribute while in previzion. Apply a flag texture to the ColorSampler attribute.

To create a double sided flag, duplicate the front facing side and move the duplicate just behind front face, the closer they are together the less the chance of odd intersection. Next apply a separate instance of the TextureDisplacement.cgfx to the back side, reapply the DisplacementSampler file from the first side. Next open your flag image file in a photo editor and flip it horizontally, by doing this the ripple will be in sync with both sides. If you edit the UV set to flip the reverse side you will change the direction of the ripple.

After exporting, you can bring the scene into Previzion and attach the video to see how well the video moves the flag. Note: You may have to tweak some of the shader properties to get a good look.

Download Video


Login to the Dashboard to download the TextureDisplacement.cgfx.

  • TextureDisplacement.cgfx – Last Updated: March 15th, 2013 @ 3:52p PST

To download a sample of this asset download go to the Virtual Set Creation section of the Dashboard.