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

AlphaImage: Difference between revisions

From ModEnc
Jump to navigation Jump to search
No edit summary
 
TAK02 (talk | contribs)
cannis.net is gone.
 
(25 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{flag|name=AlphaImage|files=rules(md).ini|values=Strings, see below|special=None|default=none/null|types=InfantryTypes, VehicleTypes, AircraftTypes, BuildingTypes|games=TS, FS, RA2, YR}}
{{flag
|values={{Values|strings|shp filenames}}
|default=none
|types={{Categ|Objects}}
|ts=yes
|fs=yes
|ets=yes
|ra2=yes
|yr=yes
|rp=yes
}}


=== Description ===
==About Alpha Images==
[[Image:alphatst.jpg|thumb|250px|Simple lightpost test, using the original alphatst.shp]]
Alpha images are a very nice lighting feature used in [[Tiberian Sun]], but left unused in [[Red Alert 2]] and [[Yuri's Revenge]]. Alpha images are grayscale SHPs that are attached to, for example, a lightpost. If one is attached to an object, the object automatically starts emitting light, with the brightness of the light at a given pixel determined by the index number of the corresponding pixel of the alpha image. In other words: The light is modeled after the image and its brightness is defined by the brightness of the pixels. This allows a total customization of the light's shape.


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.
{{clr}}
{{Bugs}}
{| align="center" cellspacing="2" cellpadding="4" style="border-collapse: collapse;background:#f07878;" width="80%;"
|+ '''Comparison with standard lights'''
!bgcolor="#30f030" style="border-bottom: 1px solid #000000;border-right: 1px solid #000000;" width="50%;"|Benefits
!bgcolor="#f00808" style="border-bottom: 1px solid #000000;border-left: 1px solid #000000;"|Drawbacks
|-
|style="background:#78f078;"|'''No lag at all'''. "Tiled" lights cause lag when placing them down, overlapping, destroying, etc. Alpha images do not.
|style="background:#f07878;"|Only affects brightness, not coloring.
|-
|style="background:#66cc66;"|Looks much better than the standard "tiled" light.
|style="background:#cc6666;"|Remains active even when the owner object is powered down, or when 'Turn off building' map action is applied.
|-
|style="background:#78f078;"|Customizable shape/amount/area of effect.
|style="background:#f07878;"|Is known to cause building selection bracket discoloration, as well as discoloration of line trails.{{fnl|1}}
|}<br>
{{fn|1|These are, however, barely visible, and usually don't affect your perception of the game.}}


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.  
=== Limitations ===
*<span id="static">This light does not follow around moving objects.</span> So while it is possible to create shiny headlights for Grizzly Tanks, the light itself will be left behind where the Grizzly was spawned - while the Grizzly moves around the map just as always.
*Cannot be animated.


It is possible to attach AlphaImages to infantry, vehicles, aircraft, and probably other object types, but there are severe drawbacks (see Drawbacks below).
==Using Alpha Images==
Using an alpha image is fairly easy: First of all, you need the actual image. Create it, turn it into an SHP, and store it your expand(md)##.mix. Once you have that, just put {{f|AlphaImage|yourAlphaImageFileName|link}} (without the {{tt|.shp}} extension) on your object, and everything should be fine.


==== Blade's post about it ====
The original, unused, lightpost alpha image ''should'' be called alphatst.shp, and is included in the game. It seems, however, to be wrongly named (sibmlr.shp). A correctly named alphatst.shp can be found at the bottom of this page.


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.
'''Note''': AlphaImages should be saved using Compression 1, like the mouse cursors, to work properly.


==== Benefits ====
'''A note on [[XCC Mod Creator]]'''<br>
* '''No lag at all'''. `Tiled` lights cause lag when placing them down, overlapping, destroying, etc. The AlphaImages do not.
Alpha images seem to get corrupted when read from an ecache*.mix. Since XMC automatically puts SHPs in that file, you have to abuse a category like Video to have your alpha image(s) placed directly in the game directory. As long as it doesn't end up in ecache*.mix, there's no problem using alpha images with XMC.
* Looks much better than the standard `tiled` light.
* Customizable shape/amount/area of effect.


==== Drawbacks ====
==The Alpha Image Palette==
* 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.
Alpha images are normal SHPs, but they do not have an associated palette. Rather, their color index is mapped to brightness values, making index #127 neutral, i.e. no light change, and #128-#255 gradually becoming brighter, with #255 being the brightest. The best way to illustrate this is to use a greyscale palette from black (index 0) to white (index 255) (see [[#Related files|here]]) - the brighter the color is, the brighter the light will be.<br>
* Only affects brightness, not coloring.
Using any color below #127 apparently requires Compression 1 to work properly, otherwise crashes and/or distortions will happen.
* 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.
=== 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 [[Media:alphatst.pal|JASC format]] and [[Media:ALPHATST_ra2.pal|RA2 format]].
==Examples==
[[Image:alpha_no_lag.jpg|thumb|150px|LOOK DADDY, NO LAG!]]
The most prominent example of alpha image usage is DCoder's "LOOK DADDY, NO LAG!" screenshot. Other screenshots to note are Renegade's alpha test screenshots, illustrating not only how good correct alphas can look ingame, but also what happens if you use index 126 and below (without using Compression 1). Important to note here is that the full-palette screenshot was taken on Arena, after the same image had crashed the game to desktop (just by scrolling to where it was) on Bay of Pigs.{{clr}}
{|
|[[Image:Alphatst_ren1.gif|none|thumb|150px|Image used as SHP]]
|[[Image:Alphatest1_ren1.jpg|none|thumb|150px|Ingame screenshot]]
|
|-
|[[Image:Alphatst_ren2.gif|none|thumb|150px|Image used as SHP]]
|[[Image:Alphatest2_ren1.jpg|none|thumb|150px|Ingame screenshot]]
[[File:Ero.png|none|thumb|250px|Everything can be used as AlphaImage!]]
|[[Image:Alpha Proof.png|none|thumb|150px|Darkening works - have a look!]]
[[File:Supershield.jpg|none|thumb|250px|download here http://www.ppmsite.com/forum/viewtopic.php?t=33068]]
|}
:''This section is rather small and research-centered; if you have more, actual-mod-screenshots, please add them.''


Pallette indecies (0-126) mess up the image, index 127 does nothing, and (128-255) add (index-127) to the lighting.
==Related files==
*[[Media:alphatst.pal|Grey scale palette, JASC format]]
*[[Media:Alphapalown.pal|Grey scale palette, RA2 format]]
*[[Media:alphatst.shp|Original alphatst.shp, correctly named]]


Also, you can get the original alphatst.shp [[Media:alphatst.shp|here]].
==See also==
*(dead link)[http://www.cannis.net/forum/index.php?showtopic=5597&st=0 Thread on C-GEN including ecache*.mix problematic discovery]
''Tiled light specific flags:''
*[[LightVisibility]]
*[[LightIntensity]]
*[[LightRedTint]]
*[[LightGreenTint]]
*[[LightBlueTint]]


=== Examples ===
[[Category:General_Editing_Information]]
 
[[Category:General Tutorials]]
The original effect: [[Image:alphatst.jpg]]
 
Also, see the [[Media:alpha_no_lag.jpg|LOOK DADDY, NO LAG!]] screenshot.
 
 
=== Credits ===
 
[[User:Blade|Blade]] - documented this effect and the way image data is rendered onto the map.
 
[[User:DCoder|DCoder]] - lag stress test, screenshots, rewrite.
 
NineBreakerFan - palette conversion to RA2 format and color 127 research.
 
gamemate - animated SHP & movable object test.
 
[[User:Renegade|Renegade]] - custom SHP/gradient tests
 
[[Category:INI_Flags]]

Latest revision as of 08:58, 22 April 2020

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: Normal text. (Limited to: shp filenames)
Default: none
Applicable to: TechnoTypes: AircraftTypes, BuildingTypes, InfantryTypes and VehicleTypes
as well as ObjectTypes: Animations, Projectiles, TMPTiles, OverlayTypes, ParticleSystems, Particles, SmudgeTypes, TerrainTypes and VoxelAnimTypes


About Alpha Images

Simple lightpost test, using the original alphatst.shp

Alpha images are a very nice lighting feature used in Tiberian Sun, but left unused in Red Alert 2 and Yuri's Revenge. Alpha images are grayscale SHPs that are attached to, for example, a lightpost. If one is attached to an object, the object automatically starts emitting light, with the brightness of the light at a given pixel determined by the index number of the corresponding pixel of the alpha image. In other words: The light is modeled after the image and its brightness is defined by the brightness of the pixels. This allows a total customization of the light's shape.


Bugs/Side-Effects/Unexpected Limitations

Comparison with standard lights
Benefits Drawbacks
No lag at all. "Tiled" lights cause lag when placing them down, overlapping, destroying, etc. Alpha images do not. Only affects brightness, not coloring.
Looks much better than the standard "tiled" light. Remains active even when the owner object is powered down, or when 'Turn off building' map action is applied.
Customizable shape/amount/area of effect. Is known to cause building selection bracket discoloration, as well as discoloration of line trails.1

1 These are, however, barely visible, and usually don't affect your perception of the game.

Limitations

  • This light does not follow around moving objects. So while it is possible to create shiny headlights for Grizzly Tanks, the light itself will be left behind where the Grizzly was spawned - while the Grizzly moves around the map just as always.
  • Cannot be animated.

Using Alpha Images

Using an alpha image is fairly easy: First of all, you need the actual image. Create it, turn it into an SHP, and store it your expand(md)##.mix. Once you have that, just put AlphaImage=yourAlphaImageFileName (without the .shp extension) on your object, and everything should be fine.

The original, unused, lightpost alpha image should be called alphatst.shp, and is included in the game. It seems, however, to be wrongly named (sibmlr.shp). A correctly named alphatst.shp can be found at the bottom of this page.

Note: AlphaImages should be saved using Compression 1, like the mouse cursors, to work properly.

A note on XCC Mod Creator
Alpha images seem to get corrupted when read from an ecache*.mix. Since XMC automatically puts SHPs in that file, you have to abuse a category like Video to have your alpha image(s) placed directly in the game directory. As long as it doesn't end up in ecache*.mix, there's no problem using alpha images with XMC.

The Alpha Image Palette

Alpha images are normal SHPs, but they do not have an associated palette. Rather, their color index is mapped to brightness values, making index #127 neutral, i.e. no light change, and #128-#255 gradually becoming brighter, with #255 being the brightest. The best way to illustrate this is to use a greyscale palette from black (index 0) to white (index 255) (see here) - the brighter the color is, the brighter the light will be.
Using any color below #127 apparently requires Compression 1 to work properly, otherwise crashes and/or distortions will happen.

Examples

LOOK DADDY, NO LAG!

The most prominent example of alpha image usage is DCoder's "LOOK DADDY, NO LAG!" screenshot. Other screenshots to note are Renegade's alpha test screenshots, illustrating not only how good correct alphas can look ingame, but also what happens if you use index 126 and below (without using Compression 1). Important to note here is that the full-palette screenshot was taken on Arena, after the same image had crashed the game to desktop (just by scrolling to where it was) on Bay of Pigs.

Image used as SHP
Ingame screenshot
Image used as SHP
Ingame screenshot
Everything can be used as AlphaImage!
Darkening works - have a look!
download here http://www.ppmsite.com/forum/viewtopic.php?t=33068
This section is rather small and research-centered; if you have more, actual-mod-screenshots, please add them.

Related files

See also

Tiled light specific flags: