Jump to content

Creating alpha gauge images


n4gix

Recommended Posts

Lifted with no shame directly from here: http://blogs.technet.com/engauged/default.aspx

 

Creating alpha gauge images

by: EnGauged (Gauge & Panel Programmer from the MSFS ACES Studio)

 

Warning: I'm not a technical writer. I just play one on TV. There are no guarantees that the following instructions will work for you.

 

Sometimes a gauge author/developer will want to add a (static) shadow element to a gauge. This is pretty easy to do, especially with XML gauges. With C gauges, it’s easy but there appears to be a bug with the system in the virtual cockpits. So if you have special gauges for the 2D cockpit, you can safely use an image that has alpha. Otherwise you’ll have to wait for the next version of Flight Sim.

 

Creating an image that will alpha blend in the panel system requires the use of Photoshop. The RGB channel can contain whatever colors you wish, although it will typically be black (for a shadow) or white (for a highlight). In my example, I’ve used a red & white checkerboard pattern to illustrate the point.

 

http://www.theyak.com/msgs/59721/59722_ul8.jpg

 

Now there must be another channel that specifies the how to blend this with the elements below it in the Z order. My simple example uses vertical stripes of black, white, and varying shades of gray:

 

http://www.theyak.com/msgs/59721/59727_jtl.jpg

 

The name that you give this channel doesn’t matter. There should only be one alpha channel in the file.

 

After creating the .psd, the next step is to run imagetool on the file. Unfortunately, this step must be run from the command line; the menus don’t have an option for creating a bitmap-with-alpha. Run the following from the commandline if the file is named “foo.psd”:

 

imagetool -gauge -gaugealpha -nogui -nobeep foo.psd

 

Now we should have a bitmap that flight sim and imagetool will interpret as having an alpha channel. To test this theory, open the resulting .bmp with imagetool and click on the “View”…”Alpha Channel” menu item.

 

To see this image in-game, add it to your favorite gauge. Add the image as you would any other image (how to do this is out of the scope of this tutorial, as it’s one of the basics of gauge creation), but make sure that you indicate that the image should be alpha blended. In the case of XML gauges, this would mean adding “Alpha=True” as an attribute. In the case of C gauges, this would mean adding the IMAGE_USE_ALPHA flag in the DRAW_FLAGS parameter for the STATIC_IMAGE macro.

 

When I created a gauge with a white background and added the above image, I get the following result:

 

http://www.theyak.com/msgs/59721/59726_hkZ.jpg

 

In other words, black = transparent, white=opaque, and grey = everything in between.

 

So, try using the 3 easy steps (create psd, run imagetool, modify XML/C) to add alpha to your gauge! Let me know how it goes.

 

Bill Leaming http://smileys.sur-la-toile.com/repository/Combat/0054.gif

Gauge Programming - 3d Modeling Military Visualizations

Flightsim.com Panels & Gauges Forum Moderator

Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium

Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional

Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium

NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...