Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 24
Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/poll/poll_cookie.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 24
Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/poll/poll_cookie.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 24
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 59
Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/leftindex.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 59
Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/leftindex.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 59
This tutorial will show you how to create light beams.
-------------------------------------------------------------------------------
Creating the Textures
-------------------------------------------------------------------------------
First of all, you need the textures, that will be used
for the beam. Using your prefered picture-editor, do
one picture for the dust-particles like this one:
This is almost the same as you can find in one of the original
pk3-files, airdust.tga, but for our purpose thatone is
to bright, so I inverted it and made white black and vice
versa. In the game, black will be completey invisible
and white opaque, so our new image will be only slightly
visible.
For the light-beam itself, make another tga-picture,
with a gradient from black (0%) to dark grey (50%),
like this one:
Ive started the gradient a little away from the
edges, this will look better in the final game.
Save them as targa 24-bit files, 1st as beamdust.tga,
2nd as beamfade.tga in a folder mohaa/main/textures/beam/
which you might have to create first
The values of brightness depend on your monitor and
the Gamma-Correction in MOHAA, so this might be too
dark for you. If so, choose brighter values, but keep
in mind that real black must be applied for invisible
parts.
Writing a shaderTo use these textures, you must write
a shader-file which tells the engine what this is all
about:
Open notepad an copy/paste the following in a new txt-file:
textures/beam/beamfade
// this is the name of
the texture, which will appear in MOHradiant
and the directory, where it can be found.
{
qer_editorimage textures/beam/beamfade.tga
// the picture that shall
be shown in the MOHradiant textureviewer
qer_keyword utility
qer_trans .4
// the amount of transparency
in mohradiant. It has nothing to do with the
transparency in MOHAA game.
surfaceparm nolightmap
surfaceparm nonsolid
surfaceparm trans
cull none
sort additive
{
map textures/beam/beamdust.tga
blendFunc add
tcMod scroll 0.05 0
// the speed of texture
scrolling in x and y direction
tcMod scale 1 1
// size of applied texture
higher value is a smaller texture. Smaller textures
scroll proportionally faster
nextbundle
map textures/beam/beamfade.tga
}
}
Save this file as mohaa/main/scripts/beam.shader.
Great! Next time you start MOHradiant, you will find
a new directory beam in your textures, and
in there the texture beamfade. If you see
other textures written in black, then these are NO shader
textures and wont be animated or anything. Best
thing is, you switch them off: In Preferences, unselect
Show Shader Textures. Our beamfade must
be written in blue!
-------------------------------------------------------------------------------
The Room
with Light
-------------------------------------------------------------------------------
For this test-map, build a little room with an info_playerstart.
A worldspawn key ambientlight with value 10 10 10 will
make it a little brighter in our room. Add a 'static_lamp_lightbulb-covered-on-wire-short'
under the ceiling. Then a 'static_corona_reg' (make
it's scale 0.25, so it won't show through the lamp's
cover in case you could look from above on it) and place
it directly in the center of the lamp's bulb! Add a
light under the lamp.
Select only the light and press 'n'. In the Entity-Inspector
give the light two new key/values:
angles: 90 0 0
spot_angle: 35
The keyangles
makes the light a spotlight, the value tells it where
to shine to (down in this case).
The key spot_angle with
value 35 says, that this spotlight has an angle of 35°
from the direction it shines (see key angles) in all
direction outwards. A key of 90 would make half a sphere.
Fine! Light a cigarette and (Stop! No! Smoking causes
serious damage to your health and there won't be any
medikits for this) lean back:
You should now compile the map and take a look, what
this 35° will look like in the game. Maybe you want
to change it to a different value? Also, it is useful
to check how wide the spotlight is on the floor, because
this is the lower diameter of the lightbeam, our next
task.
-------------------------------------------------------------------------------
The Beam Itself
-------------------------------------------------------------------------------
In my map, the light-circle on the floor was 12 wooden
boards wide, so I make a curve cylinder under the lamp
in this size: Create a square brush of this wide and
any height, and with it being selected, choose Curve-->Primitive-->Cylinder.
Make the cylinder reaching from the floor to the lower
edge of the lamp-cover:
Next, we must make a cone out of the cylinder. Select
it and press 'v'. You'll see nine pink and green boxes
appear on the cylinder. In the XZ-View select the upper
left box by dragging a mouse-window over it. You have
now selected 3 points. Pull them to the edge of the
lamp and to make it more easy, count how many units
of the actual grid you have to go. Now select the middle
left points the same way, make the grid half the size
and drag the point(s) the same number of units to the
middle. This way, the left side of the (ex)cylinder
should still be a strait line afterwards. Do the same
on the right side and then again on both sides in the
YZ-View. If some boxes stay where they were, take them
where they belong afterwards. Great!
Select your beam, and apply the beamfade texture, and
you're done! Save the map, compile it and it might look
like this:
If everything is too dark, choose a higher value for
the ambientlight, a brighter light and if then the lightbeam
isn't almost visible, you could change the tga-files
from the beginning: Maybe you prefer a brighter version
of the dust and in the beamfade.tga a gradient from
0% to 80%? Then change the textures!
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 305
Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/rightindex.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 305
Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/rightindex.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 305
Warning: require(): open_basedir restriction in effect. File(/home/map/cgi-bin/mohaa/poll/include/config.inc.php) is not within the allowed path(s): (/var/www/vhosts/own3mall/mohaaaa.co.uk:/usr/share/php:/usr/share/pear) in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 318
Warning: require(/home/map/cgi-bin/mohaa/poll/include/config.inc.php): failed to open stream: Operation not permitted in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 318
Fatal error: require(): Failed opening required '/home/map/cgi-bin/mohaa/poll/include/config.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/lightbeams.php on line 318