Background Image / Picture Using Alpha Mask

The Twilight Render Team shares tips, ideas, helpful hints, and more on using Twilight Render
Post Reply
Posts: 11137
Joined: Fri Mar 20, 2009 2:41 pm
OS: PC 64bit
SketchUp: 2013-20

Background Image / Picture Using Alpha Mask

Post by Fletch » Fri Sep 18, 2009 8:33 am

For Maximum control of your background image:

It is best to insert the background image into a photo editor for 2 advantages:
  1. easily adjust the rendering output from Twilight so that color, resolution, and tone match the Background Image.
  2. adjust the background image so that color, resolution, and tone match the rendered image
In order to get a quick "cut out" of your model, you will need what is called an "Alpha Mask". The Alpha Mask rendering preset is found in the "Advanced" group of render settings. Refer to the Alpha Mask section of the User Manual.

The key with Alpha Masks is to render them as large as possible but with the exact same aspect ratio as the original rendering, then to down-size the mask image to match the rendered image. For example, if the original rendering is made with an aspect ratio of 4:3(standard) or 16:9(widescreen), render the alpha mask with the same aspect ratio of 4:3 or 16:9. This is automatic if the "Fit to View Proportions" radio button is checked in the Resolution Section of the Render Tab in the Render Dialog Window.

The steps are very similar to the demonstration in the Tips and Tricks' Photomatch - Aligning a Rendering with the Original Image tutorial here.
  1. open the Background Image, for example, "MyBackground.jpg" inside your photo editor of choice
  2. figure out the resolution of the "MyBackground" Image (look for a menu item "Image>size" in your image editor) It will give the size and resolution.
  3. render your model with similar resolution to maximize believability for the final composite image.
  4. save the final rendering in Twilight Render as "MyRender"
  5. in the image editor, stack the "MyRender" image as a new layer on top of the "MyBackground" image.
    Now for the Alpha Mask
  6. select your entire model, OR, be sure NOTHING in the model is selected.
  7. render alpha mask "MyRender_Mask" at TWICE the resolution of the MyRender image.
  8. in your photo editor open and resize the "MyRender_Mask" image to be exact same resolution of the "MyRender" image
  9. select the resized mask image and Edit>copy it to your computer's "clipboard"
  10. add an "Alpha Mask" channel to the "MyRender" layer, (now Alt-click on the mask in Adobe Photoshop to activate it) and paste the MyRender_Mask into that mask channel.
  11. now the image will have a high-quality/clean mask
The larger the mask rendering, the higher the quality the anit-aliasing of the masked image will be.

Posts: 16
Joined: Fri Jul 23, 2010 4:21 am

Re: Background Image / Picture Using Alpha Mask

Post by ZooBoing » Mon Aug 02, 2010 7:54 pm

very nice tutorial!

Posts: 120
Joined: Mon Feb 16, 2015 5:51 pm
OS: Windows
SketchUp: Sketchup 2016

Re: Background Image / Picture Using Alpha Mask

Post by Melk-ART-e » Thu Apr 16, 2020 7:25 pm

do you have this video tuttorial? :?:

Posts: 11137
Joined: Fri Mar 20, 2009 2:41 pm
OS: PC 64bit
SketchUp: 2013-20

Re: Background Image / Picture Using Alpha Mask

Post by Fletch » Fri Apr 17, 2020 5:52 pm

Subject: How to use the Alpha Mask / Alpha Channel
Fletch wrote:
Thu Jan 24, 2019 12:17 pm
If you want to put in a different sky background, or want to place only a single selected item you have rendered into another image, you need to render an Alpha Mask.
Render the Alpha Mask at twice the resolution you will need in your final image and resize the mask in your image editing program. This increases the quality of your alpha mask image.
Then place that Alpha Mask rendering onto the Alpha Channel for your rendered image's layer.


In GIMP this video tutorial explains how to copy and paste your black and white image into the alpha mask channel for your rendered image layer (these are the steps for GIMP as shown in the video tutorial linked here):
  1. open Alpha Mask Rendering (it's a greyscale image, basically almost completely black and white)
    resize the Alpha Mask Render (which you rendered at 2x the scale of the original rendered image) and resize it to be exact same size as original rendering. (Use the "resize image" function to do this - not the "free transform" or "scale" function.)
  2. Ctrl+C to copy the entire newly re-sized Alpha Mask Render
  3. Now you right-click your rendered image layer and choose "Add Alpha Channel". (choose either white or transparent alpha channel, it doesn't matter)
  4. Then select the rendering's new alpha channel icon now showing on your layers pallette next to the thumbnail of the rendering, and paste the Alpha Mask Render into the Alpha Channel for the rendered image using Ctrl+V
  5. GIMP will create a new layer with the pasted info, right-click that new layer and click the anchor icon, which will force that info to be pasted into the alpha mask channel.
  6. In GIMP or in Photoshop if the alpha mask on your layer is being edited it will have a highlight line around the little mask thumbnail icon
  7. add new layer BELOW your rendering containing the new sky you want to use
NOTE: If you are in Photoshop, and you create a mask on your rendered image layer, you can hold ALT key down and click the mask icon on the layer to open up that alpha channel for editing, then paste in your mask there. Click on the image icon thumbnail for the same layer to get out of alpha channel editing mode.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests