Tron, the directX tutorial
Now is the time to speak about lights and fog

The special effects like lights and fog can give great realism to our scenes , although they consume many resources. 
DirectX have some lights and fog types .
 

Ligth types:
D3DRMLIGHT_DIRECTIONAL , is a frame- line in the 3d space, irradiates light  in one address, their rays are parallel .
D3DRMLIGHT_POINT , is a point light in the 3d space ,  irradiates equally in all the addresses.
D3DRMLIGHT_SPOT,  they are 2 cones of light, a cone indicates the umbra and the other one the dimness 

Fog Types:
D3DRMFOG_EXPONENTIAL ,  it increases the fog in way expotencia.
D3DRMFOG_EXPONENTIALSQUARED, similar to D3DRMFOG_EXPONENTIAL, but  increase more speed.
D3DRMFOG_LINEAR , increases lineally ,really only this type is suported

The fog always as linked to the master frame.
SORGO I.D.  had created a function for activate any light ,and other to activate the fog

somelight(red As Single, green As Single, blue As Single, tipelight As Integer, umbra As Single, penumbra As Single)
Parameters:
red , is the red colour componet
greend, the green colour componet
blue , the blue
tipelight is a 1 to 3 number 1=D3DRMLIGHT_DIRECTIONAL,2=D3DRMLIGHT_SPOT,3=D3DRMLIGHT_POINT
umbra is the first light cone (only actue in the Spot type)
penumbra is the secon cone (only actue in the Spot type)

Fog(colour As Single, starfog As Single, endfog As Single, density As Single, fogEnable As Boolean)
Parameters:
Colour is a fog colour 0-65000
starfog  the distance  between your and thefog 
endfog the longitude of the fog
dendity the fog density
fogEnable Active or disable  the fog
 
 
 Spot light
 Directional Light

 

 

 

 
 
 Point light
 Spot Light + Fog Enable

Public Function somelight(red As Single, green As Single, blue As Single, tipelight As Integer, umbra As Single, penumbra As Single)
Set lightframe = Ddrm.CreateLightRGB(tipelight, red, green, blue) 'create a some light type
lightframe.SetUmbra umbra 'select umbra
lightframe.SetPenumbra penumbra 'select dimness 
Camara.AddLight lightframe 'link the light with Camera Frame
End Function

Public Function Fog(colour As Single, starfog As Single, endfog As Single, density As Single, fogEnable As Boolean)
FramePrincipal.SetSceneFogMode (D3DRMFOG_LINEAR)'select the D3DRMFOG_LINEAR fog type
FramePrincipal.SetSceneFogParams starfog, endfog, density'star,end and fog density
FramePrincipal.SetSceneFogEnable fogEnable 'enable or disable the fog
FramePrincipal.SetSceneFogColor colour 'fog colour
End Function
 

by Necro_
www.sorgonet.com