MOHPA Guide To Global Lighting
This document serves to show the right way to use and manipulate global lighting in MOHPA missions.� In MOHPA terminology, �Global Lighting� refers to directional lights (also known as �infinite lights� such as the sun) or ambient lighting. You will also see how to move the global light to different positions via script or �Cvar� while a level is running.
Tuning
The following parameters make be set with Radiant �worldspawn� and additionally modified during game-play using �Cvars� (of the same name) or script commands.
Name: |
Examples: |
Description: |
global_light_direction |
( 90.0 0.0 ) |
The pitch and yaw angles (in degrees) for the direction the global light is pointing.� In this example it is pointing straight down. |
global_light_color |
( 255 0.0 0.0) |
RGB values of the color of the directional light above. Values range from 0.0=black to 255=full-bright |
global_light_ambientcolor |
( 255 0.0 0.0) |
RGB non-directional ambient light color. Values range from 0.0=black to 255=full-bright |
global_light_ambientdirectionalcolor |
( 255 0.0 0.0) |
RGB of ambient light to use on objects in shadow. Values range from 0.0=black to 255=full-bright |
Example I:
Environmental
����� // This makes a guy look like he is
walking through a glowing
����� // �lava� world
����� $world
global_light_direction������ ( 0.0 -90.0 )
����� // Direction is �up�
����� $world
global_light_color���������� ( 255 128 62
)
����� // Eerie orange
����� $world global_light_ambientcolor��� ( 0.0 0.0 0.0 )�
����� // No ambient light
Example II:
Environmental
���� // This makes a guy look like a deer in the
headlights
����� $world
global_light_direction������ ( 0.0 45.0 )
����� // Direction is �up�
����� $world
global_light_color���������� ( 255 255 255
)
����� // Eerie orange
����� $world global_light_ambientcolor �� ( 0.0 0.0 0.0 )�
����� // No ambient light
Example III:� A 90-second �Day�
����������� local.x������������������� = 1.0
������ local.x_inc��������� = 1.0/90.0
�����������������
������ // Ascending line on Y-axis(0.0-1.0) travelling
from 1.0 to 0.0 on X-axis
������ // Descending line on Y-axis(1.0-0.0)
travelling from 0.0 to -1.0 on X-axis
������ //
Don�t worry I make it sinusoidal!
������ while(local.x > ( -1.0 ))
������ {
������������� if (local.x>0.0)
������������� ���
local.y�� = 1.0-local.x
������������� else
������������� ���
local.y = 1.0+local.x
�������������
������������� // Negate on local.y makes light
shine �down�
������������� local.vector = ( 0.0 local.x
-local.y )
�������������
������������� // "Normalize" gives us
sin() and cos() since neither they or
������������� // "sqrt" exist in the
scripting language
������������� local.vector = vector_normalize ( local.vector)
������������� local.vector =
vector_toangles(local.vector)
������
������������� // Set the light direction
������������� $world
global_light_direction���� (
local.vector[1] local.vector[2] )
���������������������������������
������������� local.x -= local.x_inc
��������������������
������������� waitframe
������ }
�����������