Motionsport Adrenaline

Publisher: Ubisoft
Credited: Yes

Responsibilities:

Initial design and development of complete sport mode.

Focus towards animation

Collision and collision mesh modelling

Film Vignette Effect in Unity

Sample of a flickering (film) vignette effect for Unity.

The complete code and assets for this example can be found at https://github.com/cmroche/UnityVignetteShader

The process to doing this is fairly simple, first we create a texture and import it to unity as an Alpha 8 type texture. The alpha channel will be opaque on the outer edges and transparent on the inner area. Use this material on a quad in your camera’s view frustum and select the vignette shader.

The idea behind producing the flicker is fairly straight forward. Select a random value in a range, apply a slight bias, and blend from the current value to the next value. Once we reach our target choose a new random value and repeat the process. To make the shader look like the vignette is moving in and out of the edges of the frame we want to select intensity values that completely saturate part of the texture’s alpha.

There are a few tuneable variables we’ll use for polishing the effect:

public float IntensityBias = 0.6f;
public float MinimumIntensity = 1.0f;
public float MaximumIntensity = 1.4f;
public float BlendSpeed = 1.0f;

If you want a linear range of intensity values, set your IntensityBias to 0.5, if you would like to bias towards a more opaque frame move your IntensityBias upwards, values between 0.6 and 0.8 seem to work well.

A simple coroutine to select intensity values and blend continuously:

IEnumerator DoBlending()
{
   while (true)
   {
      float rate = 1f / BlendSpeed * BlendUpdateRate;

      if (currentValue == targetValue)
      {
         targetValue = Random.Range(MinimumIntensity, MaximumIntensity);
      }
      else
      {
         float dir = Mathf.Sign(targetValue - currentValue);
         currentValue += dir * rate;

         if (dir != Mathf.Sign(targetValue - currentValue))
         {
            currentValue = targetValue;
         }

         float intensity = Bias(IntensityBias, currentValue);
         Shader.SetGlobalFloat("_Intensity", intensity);
         //UnityEngine.Debug.Log("Current intensity " + intensity.ToString() + " target intensity " + targetValue.ToString());
      }

      yield return new WaitForSeconds(BlendUpdateRate);
   }
}

The vignette shader to apply the effect, the 0.8f here is the saturation point of the alpha channel this way we can still see through the frame at the highest intensity. You can obviously change this to your needs.

half4 frag(v2f i) : COLOR
{
   half4 c = i.color;
   c.a = clamp(tex2D(_MainTex, i.uv).a * _Intensity, 0f, 0.8f);
   return c; 
}

All the code and assets in this example are public domain. You may freely reuse or modify in any way and for any purpose (even commercial) without the need to attribute or notify me. Of course if you would like to credit me this simple work, I certainly won’t complain.

A Much Simpler UIToolkit Shader (Unity)

A much simpler, even slightly more efficient, shader that works with Prime31’s UIToolkit (for Unity). This shaders removes the alpha test (an expensive operation on iDevices), replaces tint colour with a simple main colour (allows you to control a sprite’s alpha), and uses premultiplied alpha in the source texture. Premultiplied alpha’s help to reduce colour bleeding giving you a better visual result, are slightly less computationally expensive, and are supported by TexturePacker.

You may reuse or distribute this code in any way without either notification or credit.

Shader "Custom/UI Premultiplied Alpha"
{
	Properties
	{
		_Color( "Main Color", Color ) = ( 1, 1, 1, 1 )
		_MainTex( "UI Texture", 2D ) = "white" {}
	}

	Category
	{
		Tags { "Queue" = "Transparent" }
		Blend One OneMinusSrcAlpha
		ColorMask RGB
		Cull Off
		Lighting Off
		ZWrite On

		BindChannels
		{
			Bind "Vertex", vertex
			Bind "TexCoord", texcoord
		}

		SubShader
		{
			Pass
			{
				SetTexture[_MainTex]
				{
					combine texture * constant ConstantColor[_Color]
				}
			}
		}
	}
}

Backyard Baseball: Sandlot Sluggers – PC, Wii, 360

Publisher: Atari
Credited: Yes

The video trailer used for this project was unfortunately produced before some important visual elements were completed in the game, such as anti aliasing.

Responsibilities:

Initial Design and Development, Prototyping

Low Level and Engine Development (Physics, CPU/GPU/Memory Performance, Pipeline)

 

FIFA 10, PC PS2 and PSP

Publisher: EA Sports
Credited: Yes

http://www.mobygames.com/game/fifa-soccer-10_

I was moved onto FIFA 10 shortly after their production period began and our Family Guy project was cancelled. Given the size of FIFA 10, and the amount of work that EA had planned for the FIFA 10 release, it proved to be an interesting and fun project to take part in.

Responsibilities:

Optimization – Early on in this project I was tasked with profiling and optimizing the PC build of FIFA 10 to straighten out a lot of performance issues with the desired minimum specification computer. About two weeks of work went into analyzing rendering and shaders used and many shaders were rewritten and new sets of low quality shaders were produced which allowed us to more than double the frame rate on our target systems. Not long after this was completed the same process was carried out across all platforms.

Networking – FIFA 10 for the PC suffered many problems with latency and input lag caused by the synchronized nature of online games. I wrote protocol dissectors for wireshark to help analyze communications between peers and found two issues responsible for these issues. Bandwidth was simply too high, and useless data was being sent across the pipe, additionally packet queues were not properly balanced and would either be too large causing input lag for slow connections or too small causing frame skipping on faster connections. Once these problems were addressed I was able to get online gameplay  for anyone with a 56k modem reliable, and with minimal input lag. All lag targets were set to be under 150ms, the point at which it becomes noticeable in FIFA10.

Physics – Probably the most interest task on this project was working with a friend at implementing new net physics into the game. Production wanted the ability to have different net shapes in the game, which produced a unique problem, we did not have a way to model the physics data required for these net shapes at the time. So working with a colleague we produced a way to export net constraint data from maya through a text file and load this data into the game and use a simple verlet algorithm for making realistic looking mesh deformations when be ball happened to be so close.

Clipping on PSP – The PSP, only having a 16 bit depth buffer, also suffered a huge issue with rendering from certain close up camera views. In these views it would not be abnormal to see polygons on player models, or parts of the stadium Z-fighting due to imprecision in the depth buffer. This took a fair bit of effort to address as the solution involved splitting our field of view into two rendering passes adjusting the near and far clipping planes to get as much precision as we could based on what we were rendering. The problems with this approach came from the loss of depth data as we moved from rendering the stadium to rendering the on field models, scripts had to be written to help split the stadiums into usable groups of geometry for each pass and even now if you can kick the ball into the stadium you will notice it still draws on top of stadium geometry. This circumstance is difficult to force and rare to come by, the end result is the near flawless playback of up close cameras and NIS sequences.

This strategy worked so well that the change would also be pulled back into FIFA World Cup for the PSP.

 

NHL 09, PC and PS2

Publisher: EA Sports
Credited: Yes

http://www.mobygames.com/game/nhl-09

NHL 09 is one of the first projects I worked on. Though this didn’t stop me from jumping into the project and getting involved in some of the more intensive areas of development.

Responsibilities:

Cameras – I worked on implementing new camera handlers and scripts for existing game play modes as well as the new Be A Pro gameplay introduced into NHL’09. Some of the Be A Pro scripts were so well received by EA that they were brought back to EA’s internal next gen development team as well.

TRC – I spent several week sorting out TRC violations picked up by EA’s testing team for the PS2 platform.

Gameplay – One of the more interesting aspects of development was modifying some of the controller input and player handling for the new Be A Pro game mode. Gameplay has to be changed to lock players to a single model on the ice, special care was required if that player received a penalty or subbed out.

Optimizing – We had some frame rate issues with a specific camera view that generally allowed the full ice surface to be visible at any one time during gameplay. Specifically on the PS2. I profiled and optimized some of the on ice “scratching” effects during these camera modes so as to reduce the processing overhead and hit the require 30fps target for release.

Multithreading – A couple of bugs were brought forward from previous years involving some bad locking technique on our asynch file loading. The result is that if you held the down button on the team or jersey selections screen you would eventually deadlock the PC and PS2. A small bug in the file loader caused the required mutex call to synchronize the file loading queue to be optimized out on release builds due to an improperly implemented RAII attempt.