Thursday, 31 January 2013

Lighting and Shading

Types of Lighting

  • Ambient
  • Diffuse
  • Specular
  • Emissive

Ambient

Ambient lighting is basically natural light that is always visible on an environment or an object. In terms of video games it is best to use ambient lighting in various scenes and models to give them a more realistic look and feel.




Diffuse

Diffuse lighting is a soft light that is scattered and gives off a smooth reflection on a surface. By looking at the the image below you can see that the light is very smooth and soft and the and gives the ball a more believable look.





Specular

Specular lighting gives off a spotted highlight which gives off the light source location. As shown below the spheres have a diffused lighting but also has a spec of light on the left side as well. Specular light is the shiny spot of light seen in many objects. This gives off a more realistic look.







Emissive

Emissive lighting represents the original light source like the sun or fire.





With all the various lighting used in objects in your game the overall mood will become very appealing. It will also look very natural and realistic.




Shading

Toon/Cel Shading

Toon or sometimes called Cel shading is a type of shading in which the object looks cartoony like a Photoshop drawing.



Multi-Pass Lighting/Rendering

This process occurs when the scene is rendered more than once adding more light to it every time. By doing this, the rendered scene will not just look plain. It will be a scene with depth and realism.



Deferred Lighting

Deferred rendering is the event in which you render the fragment used for shadowing into textures. This way every pixel is then calculated and can be rendered as geometry.







Shaders!!!


What are Shaders?

Small pieces of code executed by graphics hardware.




Types of Shaders
  • Vertex Shaders
  • Pixel/Fragment Shaders

Vertex Shaders

Vertex Shaders process a stream of vertices one at a time. This means that other vertices will not be affected by the shader in the graphics pipeline. There are defined by characteristics such as textures, normals, and positions. 
Vertex in and Vertex out
Here is an example of a vertex shader adding in a single vertex.

1
2
in  int   gl_VertexID;
in  int   gl_InstanceID;


Here is an example of a vertex shader outputting the vertex.

1
2
3
4
5
out gl_PerVertex {
    vec4  gl_Position;
    float gl_PointSize;
    float gl_ClipDistance[];
};

This code was taken from the website http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/vertex-shader/



Examples of Vertex Shaders:

  • Model Skinning
  • Morphing
  • Particle Systems
  • Displacement Mapping


Pixel/Fragment Shaders

Pixel or sometimes referred to as Fragment shaders process a parallel stream of pixels. This means one pixel is processed at a time and their is no accessibility between pixels.

Data In Colour Out






Examples of Fragment Shaders:

  • Bump Mapping
  • Per-pixel lighting


Thursday, 17 January 2013

Screenshot


My screenshot is based on our game called Nax, pages of Sorcery as seen in the image above. 
Our first task this semester is to complete the a new and improved screenshot of our game. So I have taken a picture from the first level of our game and made a few adjustments.

Here is how the image looked before



Here is how it looked after



As you can see I have made the initial image brighter so you can see the objects more clearly. Also, the image has certain redness to it because it think it looked a bit blank and dull. I gave this screenshot a red colour to add a little feel to it.

Particles
The magic is brighter as well. This way you can tell that it has more effects and gives off a highlight in its surroundings.

HUD
I have given the HUD a bevel emboss as well as a outer glow because I think they were blending into the background too much. I also gave the HUD its own little background so you can see them easily.



This a second image taken our game.




In this picture, the main character is about take on the security guard. I thought that if there is a spotlight shone only on the two individuals the players would concentrate on what is about to occur and focus on that.