Lighting Functions
Methods
calculateSpecular(sampler2D specularMap, vec2 uv)
Calculates a new specular based on the specular map.
Returns: Specular Multiplier
Return Type: vec3
calculateSpecular(sampler2D spcularMap)
Same as calculateSpecular but uses the UVs passed in from vertex shader.
Returns: Specular Multiplier
Return Type: vec3
calculateLight(Light light, vec3 n, vec3 spec, Material material)
Calculates basic lighting for a single light. This is used for diffuse and specular lighting.
Returns: Lighting
Return Type: vec4
calculateLight(Light light, vec3 n, vec3 spec)
Same as calculateLight but uses a default material. The default material is: Material(10.0f, 1.0f)
Returns: Lighting
Return Type: vec4
calculateLight(Light light, Material mat)
Same as calculateLight but uses a the normal passed from the vertex shader.
Returns: Lighting
Return Type: vec4
calculateLight(Light light, vec3 n)
Same as calculateLight but uses a default material and no specular multiplier. The default material is: Material(10.0f, 1.0f)
Returns: Lighting
Return Type: vec4
calculateLight(Light light, vec3 n, Material material)
Same as calculateLight but uses no specular multiplier.
correctGamma(vec4 col, float gamma)
Corrects the gamma of a color. After the final color has been calculated, this is used to correct the gamma of the final color.
Returns: Corrected Color
Return Type: vec4
applyHDR(vec4 col, float exposure)
Change the exposure of the final color. Commonly used with correctGamma
Returns: Adjusted Color
Return Type: vec4
emission(float intensity, float threshold)
Allows colors from the texture to bleed into eachother and give a bloom like effect. This effect does not stretch outside of the rendered object so other objects will not be affected.
Returns: Adjusted Color
Return Type: vec4
calculateSceneLighting()
Loops through all lights in scene and calculates the lighting for each.
Returns: Lighting
Return Type: vec4
calculateSceneLighting(Material material)
Same as calculateSceneLighting but uses a custom material passed in.
Returns: Lighting
Return Type: vec4
createDirectionalLight()
Creates a basic default directional light.
Returns: New Light
Return Type: Light
createPointLight()
Creates a basic default point light.
Returns: New Light
Return Type: Light