Quick Tip: EZ Crops for War Paint previews

Discussion in 'Tutorials & Resources' started by Mikroscopic, Nov 5, 2017.

  1. Mikroscopic

    aa Mikroscopic

    Messages:
    600
    Positive Ratings:
    605
    Here's a neat trick I learned for getting transparent-background shots of weapon models for custom war paints using the ingame weapon preview. What we need to do is use layer blending modes in an image editor such as Photoshop or GIMP to create an alpha mask that can cancel out the background.

    [​IMG]

    First we need to be able to replace the background. The background image is materials/vgui/item_carousel_bg.vmt. We'll replace this image with an animated texture, so we can get two versions of the image: one with a white background, and one with a black background.

    To do this, create two 512x512 images, one fully white and one fully black, and save them as .tga. Then open VTFEdit and import both at once, making sure that "Animated Texture" is selected under Texture Type. Save it as item_carousel_bg.vtf and place it in the tf/custom folder under the directory tf/custom/<anything>/materials/vgui.

    In the same folder, create a vmt called item_carousel_bg.vmt with the following text:
    Code:
    "UnlitGeneric"
    {
        "$basetexture" "vgui\item_carousel_bg.psd"
        "Proxies"
           {
                  "AnimatedTexture"
                  {
                     "animatedtexturevar" "$basetexture"
                     "animatedtextureframenumvar" "$frame"
                     "animatedtextureframerate" "1"
                  }
           }
        "$translucent" 1
        "$ignorez" 1
        "$vertexcolor" 1
        "$vertexalpha" 1
    }
    Now view your weapon in the ingame inspect view (use the command mat_reloadallmaterials if the game was already open) and the background should be alternating between black and white. Click and hold the weapon in place, then take a screenshot when it is black, and once more when it is white.

    After you've gotten the screenshots, go into an image editor and open them as layers. Duplicate the bottom layer, then select the top layer and set its blend mode to "Difference"

    [​IMG]

    The result should look something like the above image. Now right click the top layer and select "Merge Down". This combines the top two layers into one layer. Take this resulting layer and invert the colors.

    [​IMG]

    Now we have something we can use as a mask. Select the entire layer and copy it. Then, right click the bottom layer and add a layer mask to it. Paste the clipboard into the layer mask (in GIMP, this is done by selecting the mask, and pressing Ctrl+V, Ctrl+H). Disable the top layer, and you can see the result.

    [​IMG]

    Now the weapon has a transparent background! All that's left to do is crop the image and export it, and you'll have a nice image to use in promos for your war paints.

    [​IMG]
     
    • Like Like x 4
    • Thanks Thanks x 3
  2. Necrσ

    aa Necrσ

    Messages:
    201
    Positive Ratings:
    465
    • Thanks Thanks x 1
    • Like Like x 1