Home :: Login :: Forgot Password :: Search :: FAQ
Support our host

News

Software

Reference

Community

Parts Library

About Us

Reference > Tutorials
Published By ahui on Monday, September 08, 2003 - 02:10 AM

Printer-friendly page



Adding a Background Image to a POV-Ray Generated Image Using Alpha Channels and PhotoShop

POV-Ray can create images with an alpha channel, which can be used to determine transparency. This tutorial will show one way to use the alpha channel and add a background image that is visible through the POV-Ray generated graphic.

Note: You should only use this method if your end result needs to have an alpha layer. For example, Max OS X's window server uses alpha channels to determine transparencies and drop shadows. Or by doing further changes to the alpha layer, you may be able to get some effects that you can not with any other method. This tutorial should give you an idea of some of the blending options that can be done using alpha layers.

If you just want to put a background image behind a POV-Ray image, it is much easier to save the POV-Ray image in the PNG file format. Open the PNG in Photoshop, and paste a background in a layer behind the POV-Ray image. It will produce the same results in this tutorial, but your PNG will NOT have alpha channels.

Figure 1: Transparent LEGO bricks generated by POV-Ray
Figure 2: A Simple Flat Image Star Field
Figure 3: Transparent LEGO bricks with Star Field
 
Step 1 Create your image in POV-Ray and make sure it has an alpha channel. On the Mac, save it as a PICT format file. In Windows save as a TIFF format file. GIF, JPEG, and PNG do not have alpha channels.
Step 2 Open the file in Photoshop
Step 3 Open the Layer Palate (select the "Windows" menu and select "Layers").
Step 4 Open the channels Palate (select the "Windows" menu and select "Channels").
Step 5

Select the channel "Alpha 1", as shown in figure 4.

Figure 4: Selecting the "Alpha 1" channel
Step 6

Figure 5: Selecting the entire image
(Ctrl+a on Windows, Command-a on Mac)
Step 7 Copy the alpha channel (Ctrl+C on Windows, Command-c on Mac)
Step 8

Select the RGB channel by clicking on it and hide the alpha channel by clicking on it's view button, as shown in figure 6.

Figure 6: Selecting the RGB channel
Step 9

Paste the alpha channel into a new layer that will be named "Layer 1" as shown in figure 7. (Ctrl+v on Windows, Command-v on Mac).

Figure 7: Pasting the alpha channel in a new layer
Step 10

Change the blending of "Layer 2" from "Normal" to "Screen", as shown in figure 8.

-->

Figure 8: Changing the blend of a layer
Step 11 Open your other background image, and copy it.
Step 12

Switch back to your original image and paste the background image into a new layer, "Layer 2".

Figure 9: Copy & Pasting Background Image
Step 13

Move "Layer 2" below "Layer 1"

Figure 10: Moving layers
Step 14

Invert "Layer 2" (Ctrl+I on Windows, Command-I on Mac)

Figure 11: Inverting Layer 2
Step 15

You should see an inverted blend of the background and the original POV-Ray image, as shown in figure 12.

Figure 12: Invert blend background
If you are using an LCD, you may have to look at it at an angle to see the white L3P over the inverse star background. If you don't have this result, you may not have both "Layer 1" and "Layer 2" visible, or you may have skipped changing "Layer 2" blending to "Screen".
Step 16 Select all (Ctrl+a on Windows, Command-a on Mac)
Step 17 Copy Merged (Shift+Ctrl+c on Windows, Shift-Command-c on Mac)
Step 18

Paste the clipboard into a new layer that will be named "Layer 3" (Ctrl+v on Windows, Command-v on Mac)

Figure 13: Layer 3 after the copy-merged operation
If the new layer doesn't contain the blend of "Layer 1" and "Layer 2", you may not have done a "Copy Merged". This is a common error I make.
Step 19 Hide "Layer 1" and "Layer 2" as shown in figure 14.

Figure 14: Hiding "Layer 1" & "Layer 2"
Step 20

Invert "Layer 3" (Ctrl+i on Windows, Command-i on Mac) as shown in figure 15.

Figure 15: Inverting "Layer 3"
Step 21

Change blending on "Layer 3" from "Normal" to "Screen", as shown in figure 16.

-->

Figure 16: Changing the blend of a layer
Step 22

Figure 17 shows the finished image.

Figure 17: The final image

Click on the image to enlarge and notice the yellow brick has the stars visible through it.


Help Desk Tutorial: Adding a Background Image to POV-Ray Using Alpha Channels & Photoshops
Version 1.0
Created by James Reynolds, (james@scl.utahAVOIDSPAM.edu)
http://www.ldraw.org/



Recipient 2007
Kevin Clague

Want to learn more about LDraw? Check out the following books:




Current Contest Winners

Model of the Month


Scene of the Month



Vote for Next Month's Winner

Submit Your Creation for Next Month's Contest

What's new in lugnet.cad?

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Willy Tschager - 14 hours ago

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Jim DeVona - 20 hours ago

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Daniel Siskind - 20 hours ago

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Orion Pobursky - 20 hours ago


There are 71 unlogged users and 0 registered users online.

You can log-in or register for a user account here.





 


 Log in Problems?
 New User? Sign Up!

©2003-2008 LDraw.org, see Legal Info for details.
LDraw™ is a trademark owned and licensed by the Estate of James Jessiman
This website is powered by Peeron.com.

LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this site. Visit the official Lego website at http://www.lego.com.
LDraw is a completely unofficial, community run free CAD system which represents official parts produced by the LEGO company.