Difference between revisions of "ShaderLamp (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
 
(6 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
  
With the openGL shader, it is entirely possible to apply multiple light sources to each of your scenes. These light sources can either be static or dynamic. Static light sources would be fixed in place & their parameters will always stay the same, whereas dynamic light sources could be pinned to something that is moving, such as: a character or object in the scene & / or the parameters of the light could also be adjusted over time, to create atmospheric lighting such as flickering, sway or a shift in the intensity or reach of the overall light.
+
...
 
 
There are two different types of light available: 1. spotlight & 2. point light.
 
 
 
Finally I would just like to point out that you have to manually declare the amount of light sources on the scene, by declaring them with the '''shaderActivateLighting()''' function.
 
 
 
Finally finally, light sources can actually be bound to a loop using the '''bind()''' function, or you can create your own loop using the '''mainLoop''' event handler or by creating a loop inside of the editor using the '''jump to x''' action part inside of an action block.
 
  
  
Line 34: Line 28:
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
|-
 
|-
| value || float (decimal) || The amount to blur the screen by; recommended value somewhere between 0 & 20.
+
| index || integer (number) || The index number to assign to the light source. Index starts at 0.
 +
|-
 +
| type || integer (number) || The type of light you want to create. 0 = spotlight. 1 = point light.
 +
|-
 +
| pos || point (x, y, z) || The position of the light source. Z controls how close the light source is to the screen. Lower value = closer.
 +
|-
 +
| targ || point (x, y, z) || The target position of the light source. The light travels from pos to targ. ''Only for point lighting; set {0,0,0} for spotlight.''
 +
|-
 +
| falloff || point (cnst, lnr, quad) || The falloff controls the amount of light decay over distance. ''Please see [https://developer.valvesoftware.com/wiki/Constant-Linear-Quadratic_Falloff here] for more details on light attenuation.''
 +
|-
 +
| ac || point (r,g,b) ''or'' function (h,s,v) || This allows you to apply an ambient color to the light source. It uses RGB by default but you can use HSV instead if you prefer by using the hsv() function.
 +
|-
 +
| dc || point (r,g,b) ''or'' function (h,s,v) || Diffuse color is similar to ambient color, but it is used to tint the screen itself, as opposed to just the light source.
 +
|-
 +
| df || float (decimal) || The diffuse factor controls the strength of the diffuse color. 1 = default. Higher than 1 = brighter. Lower than 1 = darker.
 +
|-
 +
| exp || integer (number) || The exponent controls the spread of light from the source. 0 = 180º whereas an higher value will have a smaller spread. ''This parameter is only required for spotlights.''
 
|-
 
|-
| delay || integer (number) || The amount of time to blur/focus the screen over; in milliseconds (ms).
+
| cutoff || float (decimal) || The cutoff is used to define how soft or sharp the edges of the light will be. The value should be between 0 & 1. ''This parameter is only required for spotlights.''
 
|}
 
|}
  

Latest revision as of 16:04, 9 May 2015

Name Type
shaderLamp(index, type, pos, targ, falloff, ac, dc, df, exp, cutoff) Execution


...


Examples

Spotlight

...

...

Point Light

...

...


Syntax Breakdown

Name Type Description
index integer (number) The index number to assign to the light source. Index starts at 0.
type integer (number) The type of light you want to create. 0 = spotlight. 1 = point light.
pos point (x, y, z) The position of the light source. Z controls how close the light source is to the screen. Lower value = closer.
targ point (x, y, z) The target position of the light source. The light travels from pos to targ. Only for point lighting; set {0,0,0} for spotlight.
falloff point (cnst, lnr, quad) The falloff controls the amount of light decay over distance. Please see here for more details on light attenuation.
ac point (r,g,b) or function (h,s,v) This allows you to apply an ambient color to the light source. It uses RGB by default but you can use HSV instead if you prefer by using the hsv() function.
dc point (r,g,b) or function (h,s,v) Diffuse color is similar to ambient color, but it is used to tint the screen itself, as opposed to just the light source.
df float (decimal) The diffuse factor controls the strength of the diffuse color. 1 = default. Higher than 1 = brighter. Lower than 1 = darker.
exp integer (number) The exponent controls the spread of light from the source. 0 = 180º whereas an higher value will have a smaller spread. This parameter is only required for spotlights.
cutoff float (decimal) The cutoff is used to define how soft or sharp the edges of the light will be. The value should be between 0 & 1. This parameter is only required for spotlights.


Resources

Name Description
n/a A working .ved file, complete with resources. Check out the readme.txt file for instructions.