Monday, 27 January 2014

Pipes and Lights

Around the Block and Back Again


The last few weeks have been hectic, between work and two game jams I almost forgot I started this. Well then lets see what w can learn.

Week 2

Graphics Pipeline

Vertex Array – vertex shader – triangle assembly – rasterization – fragment shader – testing and blending – framebuffer


Uniform state data imported into the vertex and fragment shaders in order to use them to alter data and export it to the game. Shaders convert data to pixels, Open gl likes optimized pathways where it can keep working with the same data types. Shaders are what work with your normal and displacement maps.

Vertex shader goes through a stream of vertices one by one, processes a single vertex only with access to only that vertex and no access to the rest of the vertices. The vertex goes in, gets processes and then it is throw out. This process needs to be quick as you have to do this for every vertex you have. 

You can store your vertices in an array, and the matching colors to each vertex in another array. This makes a VBO (Vertex Buffer Object) which you can use to make an object in game.

OpenGL Assebly Language

There are high level shader languages out there like HLSL, Cg, GLSL. HLSL and Cg are the same language except Cg is specifically changed and used by Microsoft. 

What I did This Week

This week I did not accomplish as much as I wanted to as I had work to do for my other subjects. I was able to finish up my particle system though, adding in the ability to be used with animated sprites.

Great Canadian Appathon Game Jam

This week I participated in the Great Canadian Appathon. We started our program in unity. At the start we were excited because we could use the unity engine to handle our physics but we found out that it was unable to do proper collisions in a top down grid based environment though we were able to do triggers. As such we had to write out own collisions. While we got the farming aspect in as well as all the visuals we were unable to get the gameplay up to a point where it was enjoyable so we did not submit it in the end. We plan to continue on it later as we like the project and the game idea and I will be working on it in my free time.

Week 3

Lighting

Realism, interesting effects, staging, depth, creates mood, drawing attention. Doom 3 lighting, allowed for hiding of artifacts, the game didn’t need high quality textures and allowed for the human condition to produce something scarier than what they were being show.

Per-vertex lighting is when you get the values of the lighting on all points by interpolating between the light values of the three sources.


Types of Light

Emissive light is the light given off by an object.

Ambient lighting is the amount of lighting in a scene. This light does not have a directional light source and is a constant value where Intensity = K*Illumination.

Diffuse light is defined as the light from the object to light source that reflects. For example when you look at an object you see the diffuse light. This is calculated with the dot product where Cosine Theta = normalized (n (dot)   (Position - Light source))

Specular Light is the light that gets reflected off the object to the viewer. You notice this most as a glare that comes of a metallic or glass surface.  You use the light as an incident angle on the surface and get a reflected angle from the perfect normal.



The amount of light in a scene is equal to the ambient light, the diffuse and the specular all together.

For Calculations

N -  the exponent is a material set value that you can attach to each vertex

V - is the player/camera position

R - is the light and normals that we have

Can use a normal texture to help with calculations

Lamberts Laws

1.) The illumination on n surface illuminated by light falling on it perpendicularly from a point source is proportional to the inverse square of the distance between the surface and the source.
2.) If the rays meet the surface at an angle, then the luminance is proportional to the cosine of the angle with the normal.
3.) The luminous intensity of the light decreases exponentially with the distance as it travels through an absorbing medium.

Step shading

This is a cartoon like shading where instead of a scale there are just pre-set shading points.
To do this you set shader data in different ranges to one value so that everything between for instance 0.3 and 0.7 is equal to 0.5.



Multi pass lighting

The idea is to render the geometry then to complete the scene by calculating the lighting on another pass-through with the now set normals. Then you combine the lighting and geometry at the end for the final scene. This is not just used for lighting but for other special effects.

Deferred lighting

Separate geometry from lighting calculations.
Pass 1: render geometry
Pass 2: compute lighting
Enable regions where lighting is in a sample, do lighting in those regions you sample.

What I did This Week

This week I decided to make sure that I am ready for all future code integration. I took all the code from last term and first year and have started to make my own engine of sorts. Currently I am using the code from the tutorials in order to finish the first three base assignments.

Global Game Jam

This week I took part in the global game jam where my team and I got to work with the Oculus Rift. Our team consisted of Eric Lemieux, Guri Waraich, Mario Greco and I. We made the game Headshot. Using the Oculus and a X-Box controller you would shoot at enemies and navigate mazes. It was fun to work with the Oculus though it was difficult as there was little troubleshooting information.
Check our game if you want (http://globalgamejam.org/2014/games/headshot)

A Time in Summary

Man I did not expect to take that long to update on my second post. I figured I would get more than one a week but I guess not.

No comments:

Post a Comment