ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

AlphaImage

From ModEnc
Revision as of 04:52, 9 February 2006 by 71.251.134.42 (talk)
Jump to: navigation, search
Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
Flag: AlphaImage
File(s): rules(md).ini
Values: Strings, see below
Special Values: None
Default: none/null
Applicable to: InfantryTypes, VehicleTypes, AircraftTypes, BuildingTypes


Description

An AlphaImage is a grayscale SHP that is attached to, for example, a lightpost. If one is present, the lightpost uses the brightness of the AlphaImage's pixels to determine how bright the corresponding pixels of the emitted light should be, rather than just gradually becoming darker over distance (See Examples for an example). This allows allows a total customization of the light's shape.

The value of this tag points to the filename of the SHP file to be used for calculation. So, you can add the effect to other objects and create alternate effects for other structures, using different SHPs.

It is possible to attach AlphaImages to infantry, vehicles, aircraft, and probably other object types, but there are severe drawbacks (see Drawbacks below).

Blade's post about it

It works fine in RA2 and there is the possibility of creating further alpha effects if my understanding is correct. This is another totally unused feature in RA2/YR. The alpha image is called alphatst.shp, but is reported wrongly by XCC (or at least the version I have) as sibmlr.shp. Don't try to convert the image to a pallet since it doesn't use one. Instead, any index above #127 in the pallet increases the light and I suspect (though haven't tested) that values below this decrease the among of light effect (negative light). You can create a useful alpha image by working in a greyscale pallet that runs from black (index 0) to white (index 255) and setting colour as index 127 to start with. 127 is a neutral pallet entry that does not affect the light ingame at all.

Benefits

  • No lag at all. `Tiled` lights cause lag when placing them down, overlapping, destroying, etc. The AlphaImages do not.
  • Looks much better than the standard `tiled` light.
  • Customizable shape/amount/area of effect.

Drawbacks

  • The AlphaImage does not follow the owner object around, it stays at the point where that object was spawned, and doesn't dissapear until the owner object is destroyed.
  • Only affects brightness, not coloring.
  • Can only increase brightness, not decrease it.
  • Remains active even when the owner object is powered down, or when 'Turn off building' map action is applied.
  • Is known to cause building outline (the white lines around the building when it is selected) discoloration, due to the fact it bumps up the pixel as defined by that palette, which is usually a nasty brown or purple.

Using/modifying the effect

To use/edit/add alternate effects of this type, you'll need the proper palette, that goes from black(#0) to white(#255). To help you, I've uploaded the correct palette in JASC format and RA2 format.

Pallette indecies (0-126) mess up the image, index 127 does nothing, and (128-255) add (index-127) to the lighting.

Also, you can get the original alphatst.shp here.

Examples

The original effect: Alphatst.jpg

Also, see the LOOK DADDY, NO LAG! screenshot.


Credits

Blade - documented this effect and the way image data is rendered onto the map.

DCoder - lag stress test, screenshots, rewrite.

NineBreakerFan - palette conversion to RA2 format and color 127 research.

gamemate - animated SHP & movable object test.

Renegade - custom SHP/gradient tests