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

Difference between revisions of "Alpha Image"

From ModEnc
Jump to: navigation, search
 
Line 1: Line 1:
{{HorizontalBar|This page should be merged with [[AlphaImage]] under [[AlphaImage]]}}
+
#REDIRECT [[AlphaImage]]
 
 
== AlphaImage ==
 
 
 
AlphaImage is a very nice feature that was used in TS, but left out of RA2. An AlphaImage is a grayscale SHP that is attached to a lightpost. If one is present, the lightpost uses the brightness of the AlphaImage's pixels to determine how bright the corrosponding pixels of the emitted light should be, rather than just gradually becoming darker over distance (See Appendix II for an example). This allows allows a total customization of the light's shape.
 
 
 
=== Original post ===
 
Attached is the image for the AlphaLight effect seen in TiberianSun. 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. Put this file into the normal mod mix files and place a [TSTLAMP] on a map and marvel at the difference between alpha image light and the regular cell tinting effect. 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.
 
 
 
=== Screenshot ===
 
[[Image:alphatst.jpg]]
 
 
 
[[Media:alpha_no_lag.jpg|LOOK DADDY, NO LAG!]]
 
 
 
=== Explanations ===
 
The key is this tag:
 
[TSTLAMP]
 
AlphaImage=ALPHATST
 
So, you can add the effect to other buildings and create alternate effects for other structures.
 
 
 
To 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]].
 
 
 
Keep in mind that the game adds (pixel's index-127) to the current map level.
 
 
 
So, indecies (0-126) reduce the lighting by (127-index), index 127 does nothing, and (128-255) add (index-127) to the lighting.
 
 
 
Also, you can get the original alphatst.shp [[Media:alphatst.shp|here]].
 
 
 
And the best part is ''this effect does not lag at all''.
 
See the [[Media:alpha_no_lag.jpg|LOOK DADDY, NO LAG!]] screenshot.
 
 
 
=== Appendix I ===
 
Unfortunately, according to gamemate, ''animated'' alpha-images are ''not'' possible; in addition, if the alpha image is attached to something movable, the emitted light will stay at it's initial position, and not move around with the object.
 
 
 
=== Appendix II ===
 
Tests with custom SHPs suggest that only colors #127 and above will work.
 
<table>
 
<tr>
 
<td>[[Image:Alphatst_ren1.gif|left|thumb|Image used as SHP]]</td>
 
<td>[[Image:Alphatest1_ren1.jpg|left|thumb|Alpha-Test ingame screenshot]]</td>
 
<td width="300">This test was on Arena - when I played on Bay of Pigs, my G.I.s just explored the terrain, I was just innocently scrolling around, and *woop* – there I was, back in windows...</td>
 
</tr>
 
<tr>
 
<td>[[Image:Alphatst_ren2.gif|left|thumb|Image used as SHP]]</td>
 
<td>[[Image:Alphatest2_ren1.jpg|left|thumb|Alpha-Test ingame screenshot]]</td>
 
<td width="300">Second test, as suggested by DCoder, only used colors #128 and higher; as you can see, it worked like a charm.</td>
 
</tr>
 
</table>
 
Although only #128 and above were tested, the original post suggested that #127 was the neutral color, the "border", so to speak. Therefore it is assumed that #127 should work as well, while #126 and below probably corrupt the image.
 
 
 
=== Appendix III ===
 
I (NineBreakerFan) have done some experimenting. I changed color 127 on the palette to a bright red.
 
http://www.freewebs.com/yurismods/127.png
 
As you can see on the test screenshots at the top of the page, that part is null. In conclusion 1-126 screw up your alpha image. 127 is null. (No changes to that area.) And 128-255 are used to make parts of you alpha images brighter.
 
 
 
=== Credits ===
 
Blade - documented this effect and the way image data is rendered onto the map.
 
 
 
DCoder - lag stress test, screenshots.
 
 
 
NineBreakerFan - palette conversion to RA2 format and color 127 research.
 
 
 
gamemate - animated SHP & movable object test.
 
 
 
Renegade - custom SHP/gradient tests
 
 
 
[[Category:General_Editing_Information]]
 

Latest revision as of 16:53, 4 July 2006

Redirect to: