Saturday, 15 February 2014

Lighting in Games

So in my last blog I mentioned that next I was going to focus on lighting. Now I'm not going to focus on why lighting in games is important since I looked at lighting's importance in an older blog, which (if any of you are interested in) is located HERE. It talks a little bit about why lighting is important and also what can be effected or changed when lighting is involved. This blog however is going to focus on some types of lighting that you can do and how you can achieve some of them.

So there are numerous different types of lights and different methods of lighting that a lot of industries, not just the gaming industry uses. Light is an absolutely crucial aspect of games and entertainment, and really can make or break the atmosphere of the movie or game. Different lights can give you different effects and different combinations of different types of lights can make your game look absolutely outstanding. Now since there are so many different types of lights I'm only going to focus on few.

TYPES OF LIGHTS AND TECHNIQUES

When lighting objects there are a few different methods to do so, 3 important ones to know about are Per-vertex, per-pixel and per-face lighting.

  • Per-Face Lighting


    •  Per-Face Lighting, also referred to as flat shading, is a lighting technique that shades and lights each polygon of an 3D object based on the angle between the polygon's surface normal and the direction of the source.
    • In addition, it also takes into consideration the respective colours of the polygons and the intensity of the light source.
    • In this type of lighting all polygons are coloured with only one colour meaning that all other polygons have a differentiation between themselves and their adjacent polygons. This means that almost every polygon has its own unique colour depending on the intensity and location of the light source.

  • Per-Vertex Lighting

    •  Also known as Gouraud Shading, Per-Vertex lighting calculates the lighting at each vertex, Linear Interpolating between vertices. This gives the a very polygonal appearance. 
    • Basically this type of lighting estimates the surface normal of each vertex in a 3D polygonal model, which is generated by averaging the surface normals of the polygons that meet at each vertex.
    • Using these estimates lighting is then computed based on a reflection model are then done in order to determine the intensity of each colour at the vertices.
  • Per-Pixel Lighting


    • Also known as per-fragment lighting, Per-pixel lighting calculates the lighting at each pixel in a 3D model, this gives a more more realistic look to the light on the model.
    • This type of lighting is able to be combined with things like normal mapping and bump mapping, which allows for really interesting effects and more realistic lighting.
    • Per-pixel lighting is the commonly used lighting in video games as it allows for greater realism and detail.
  •  Lambert

    • Lambert, named after Johann Lambertian who developed the idea, is a lighting technique that specifies how light illuminates a surface.
    • Essentially this light model states that on objects light is emitted evenly across all angles. This means that different points or areas of an object will look the same no matter what angle the are viewed from.
    • To calculate Lambert you take the dot product of the surface normal vector and a normalized light-direction vector pointing from the surface to the light source. Then multiple that number by the colour and the intensity of the light.
  • Phong

    •  Phong Lighting or Phong Shading, named after Bui Tuong Phong who first published the method in 1973, is an interpolation technique for surface shading and is also known as Phong Interpolation or normal-vector interpolation shading.
    • It interpolates surface normals across rasterized polygons and computes pixel colour based on the interpolated normals and a reflection model.
    • Phong Lighting is used for surfaces that have specular highlights, which are the direct reflection of the light off of the object.
    • This model is made up of two components: the diffuse light you get from lambert and the light's reflection, which is found by determining the angle we are viewing the object at and compare it to the angle the light is hitting the object at the same time.
  • Blinn-Phong

    •  Also known as Blinn-Phong reflection, this is a modified phong reflection model, developed by Jim Blinn, that uses a halfway vector between the viewer and the light-source vector instead of the reflection.
    • The Blinn-Phong model, while less efficient than the Phong model in most cases, is faster in  the case where the viewer and light are treated to be at infinity, which is the case for most directional lights.
    • When using directional lights, Phong-Blinn lighting allows for each light to have its own computation which can then be used for the entire frame or while the light and viewpoint remain in the relatively same position.
  • Specular

    •  Specular Lighting, also known as specular highlight, is the bright spot of light that appears on shiny objects or models  and uses the highlight to give visual clues for light source locations.

    • It is commonly used to give light reflection off of metallic surfaces such as mirrors and highly polished/ reflective metallic surfaces. In addition, it is used for reflecting sunlight off water and can add a degree of photo realism to most 3D scenes. 
  • Diffuse


    •  Diffuse Lighting, also known as diffuse reflection, is the reflection of light from a surface that an incident ray is reflected at many angles rather than just one in the case of specular lighting.
    • In order to determine diffuse lighting we need to calculate the angle between the surface ans the light, the diffuse intensity of the light and the diffuse reflectance of the material.
  •  Ambient

    •  Ambient Lighting is a fixed-intensity and fixed colour light source that effects all objects in the scene equally. All objects in the scene are brightened with the specified intensity and colour.
    • This type of lighting is mainly used to provide the scene with a basic view of the different objects in it, and is considered to be the simplest type of lighting to implement.
    • In order to represent how exposed each point of the scene is, ambient light is combined with ambient occlusion (which I will focus on in a later blog), which produces a similar effect to an overcast day.

 

 

LIGHT SOURCES

There are numerous different types of light sources, however in this blog I will be briefly going over only a few of them.
  • Spotlight Lighting

    •  This is a type of light source that originates from a single point and spreads outward in a cone shape, illuminating only a specific area which is determined by the diameter of the of the light.
  • Directional Lighting

    •  This is a light that illuminates all objects equally from any given direction, like an area light of infinite size and distance from the scene. Anything in the direct path of this light source is illuminate while those objects that aren't in the light's path are not seen.
  • Point Lighting 

    •  A point light is a light source that originates from a single point, and spreads outward in all directions.
  • Area Lighting

    •  This type of light originates from a small area on a single plane, which is a more accurate type of light source than point light.
  • Volumetric Lighting

    •  This light source originates from a small volume, which is an enclosed lighting object within that space. With Volumetric light shading is interpolated based on how the angle of these light sources reach the objects in a scene.
So my next blog is going to go over more in detail the following lighting techniques and will give a few tutorials on how to achieve a few of these effects in Photoshop and Maya.

Lighting Effects
  • Radiosity
  • Global Illumination
  • HDR/Bloom 

No comments:

Post a Comment