|
|
|
Posted by: Admin
on Friday, April 20, 2007 - 05:49 AM |
|
|
|
 |
Alpha Map Lesson
I have to say first off, that materials in the Game Engine aren't
exactly tied in with the materials for the normal Blender Modelling
Mode...
Example..
Add a plane in Blender, facing along the Y-axis..

Switch back to 'Object' mode.. then press 'F' to enter the 'UV Face
Select Mode'...

In the view port to the right, switch to 'UV Image Editor'.
You'll see a blue square representing your plane.
Click on
'Image, Open' and select an image that already has an alpha map (IE.
png, .tga formats can contain an alpha map within the same file).
Alpha map, referring to an image with transparent parts.

I need to rotate mine, so, I'll put my mouse cursor over my '3D View'
window to the left, and press 'R' until the image on my plane to the
left, is facing the same directions as the image to the right in the
"UV Image Edit" window. Click on 'UV Coordinates' when asked
after pressing 'R'. Finally, in the 'Buttons' view port at
the
bottom, under the 'Texture Face" tab, click the 'Alpha' button to make
your plane transparent where it should be based on the image's alpha
map. Also, click 'Twosided' so your plane will show the image
on
each side.

Also, with the vertex color set on white, you may want to click 'set
VertCol' so the true colors show on your plane.
What we have above will work for a transparent game object, however, it
won't render correctly if we wish to use this in an image or animation.
(Image Below)

If we press 'P' to start the game, it looks great for a transparent
object. (Below)

To create a transparent image for rendering, we'll need to create a new
Material for our Plane. With our plane selected, click the
"Shading" button (or press 'F5') then click 'Add New' under the 'Link
to Object' tab...

Go over and click the 'Add New' under the Texture tab. Click
the
Textures button (F6), Texture Type, select image.. Go over to the
'Image Tab' which just has a load button at this time and a scroll
arrow. Click the scroll arrow and select your image which
should
still be listed. If not, reload it by pressing the load button and finding your file.

Since the image were using contains it's own Alpha Map, simply click
the 'Use Alpha' button under the 'Map Image' tab. Under the
'Preview Tab', click the 'Alpha' button to see a preview of your image
with it's transparent background...

Pressing 'F12' now for a quick render, you'll see we need to make a
couple more adjustments before we get the desired results...

Click the "Material" button.
Under the 'Map To' tab, make sure you have the 'Alpha' button pressed.

Under the 'Material' tab, the bottom right slider bar is labeled 'A'.
Scrolling over it, you'll see it stands for 'Alpha'.
Sliding this down to 0, will allow the sky material to show
through our plane..

The next button we need to push, is the 'Ztrans' button under the
'Links and Pipeline' tab. This will allow everything else in
our project to show through our plane...

Pressing 'F12' now for a test render of our plane, will show our plane
with the results below...

There's still 2 problems with our plane. First is, the slight
shading where the transparent parts of our image is. This can
be corrected under the 'Shaders' tab. Slide the "Ref" slider
all the way over to 1.0. Turn the "Spec" all the way down to
0.00 and the "Hard" slider all the way down as well to 1.

That takes care of our plane. The last problem we have to
deal with is the fact that the shadow of our plane is still a square
and not a shadow of our splatter image. To fix this, we'll
need to create a new material for our ground plane. Under the
'Shaders' tab of our new material, press the 'TraShad' button
to allow transparent shadows to be rendered on our ground plane.
Any object that you wish to have Transparent shadows rendered
on will need to have this button pressed.
Our final result looks like this.

It is possible to achieve the result using 2 different images.
For example, one color image of a brick wall and a second
image, Black and White, black being the transparent parts, white being
the solid parts. Use this image as the alpha map for your
brick wall to add windows.
Playing with these options some, you can easily create stain glass
windows.

It took me a long time to figure these out with blender.
Hope this helps.
Here is the 'splat' image that I used for this tutorial. You can right click and save it from here to practice with.
Transparent Images
Feel free to email me with any questions.
Scott
Share this article:
|
|
| Transparent Textures | Log-in or register a new user account | 0 Comments |
|
| Comments are statements made by the person that posted them. They do not necessarily represent the opinions of the site editor. |
|