A long over due post about Unreal Engine

I realised today that I haven’t posted anything about Unreal Engine, and since my final major project for uni is made in it I thought this might be a good chance to show off some of the work we’ve done with it. Should be mentioned that I am working with two very talented artists on this project, so the models are not my own, however the shading/rendering is all mine in the following screenshots. Bare in mind this is all work in process stuff.

Most of the shaders are a standard PBR workflow from substance designer/painter, often starting off from substance B2M. I’m trying where possible to stay on top of the new features in UE4, using volumetic fog/lightmaps where I can. Since the game is designed to be played in VR having the 3D volumetric effects has been a real help in getting the look we wanted. As the next few weeks go on I’m excited to have more of the artists work put into the project and really start to get something that feels like a real speakeasy!

Also I post more of my work on twitter,  so follow me there if you want to see more!

Maya MEL exporter part 2

I made some changes to my MEL OBJ exporter so it exports the selected objects one by one, feel free to copy it from below, credits to Rob The Bloke for his MEL script examples on his website and to Jon Macey for hosting it. (Lucky enough to have a guest lecture from Rob recently, he really knows his stuff!)

 

Anyway here is the script feel free to copy: (and let me know if it could be better)

// Adapted from:
// https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/GUI_dialogs.html

// This procedure is called when the 'Open' button of the dialog is clicked.
// The procedure recieves the name of the file and it's extension
proc int onOk(string $dirpath,string $type) 
{
   string $path;
   string $name;
   $path = ($dirpath + "/");
   print("Path Set To: "+$path+"\n");
   // create a prompt dialog to request the users name
		
		    string $nameList[] = `ls -selection -long`;
		    select -cl  ;
            for($object in $nameList)
            {
                select -r $object;
                
                xform -cp;
                
    		    string $result = `promptDialog 
    			-title "Name The Asset: "
    			-message ("Enter Name: (" + $object + ")")
    			-button "OK" -button "Cancel"
    			-defaultButton "OK" -cancelButton "Cancel"
    			-dismissString "Cancel"`;
	 
        	 	// if OK pressed
        		if ($result == "OK") {
                    
                        // query the entry typed by the user
        			    $name = `promptDialog -query -text`;
        			    print("Exporting: " + $path + $name + "\n");
                        
                        float $x = getAttr($object+".tx");
                        float $y = getAttr($object+".ty");
                        float $z = getAttr($object+".tz");
                        
                        move -xyz -rpr 0.0 0.0 0.0 $object;
                        rotate -r -os -fo 90 0 0 ;
                    
                        file -force -options "groups=1;ptgroups=0;materials=0;smoothing=1;normals=1" -type "OBJexport" -pr -es ($path + $name);
                        
                        move -xyz $x $y $z $object;
                        rotate -r -os -fo -90 0 0 ;
                    }
        						  
        		else {
        			print("Export Canceled\n");
        		}
		}
   return true;
}

// The final parameter indicates the type of file dialog. 4=Folder Dialog
// The 1st parameter is a function to call when OK is pressed.
// The 2nd parameter is the text to appear on the OK button.
// The 3rd parameter is the type of file, somewhat meaningless here
fileBrowser( "onOk", "Text", "", 4 );

Pizza Jam – Dino Boi

Recently had a free weekend, so with a friend we took part in a game jam hosted on itch.io.

The theme of the jam was movement, and after some brainstorming at the pub we decided on an homage to this great scene in Jurassic Park:

The game is a simple platformer cobbled together in Unity over around 24 hours of dev time (Two 12 hour days). The twist being that only moving objects are visable, with the exception being your own dead body parts.

As you muddle through the levels you create a clearer picture of the map with the litter from your previous attempts. The video below shows one of the levels being finished after a few attempts:

My partner did the level design while I did the programming, and we both contributing to the art. It was pretty fun to just create some platform game staples (crushers, moving platforms etc.) and then see how we could put them together into 20 unique levels.

I always love doing game jams like this, taking a simple gameplay mechanic and letting it drive the development  always makes for something fun and interesting to play. Check out the game is you wanna play and the other games from the jam!

Smoothing Motion Capture Data

As part of my uni course I have to create a piece of original research into something in the CG field. For my project I designed and implemented a novel method of skeleton data smoothing. (This is the project I talked about a couple of posts ago).

I’d like to share some of the results of my research in a couple of videos. First video shows tracking of star jumps, to show the much smoother animation of my system compared to raw tracking data:

My system takes the tracking data broadcast across the network at 20Hz and plays it back at 60fps using a Kalman filter to interpolate across frames.

 

The Second video shows the estimation/fitting method I developed, applied to a couple of stretches. You should be able to see that the system makes accurate predictions about where the limbs should be in some cases or returns to a rest position if we have no data.

I’m really happy with the results we have achieved for the project and have submitted it to a conference for a poster submission and hope to get it accepted!

Export OBJ from Maya for UE4 : quick script

Here is a quick script I put together this morning,

It exports OBJs from Maya rotating so they are oriented correctly in UE4,

It has a nice file browser UI too!

// Adapted from:
// https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/GUI_dialogs.html

// This procedure is called when the 'Open' button of the dialog is clicked.
// The procedure recieves the name of the file and it's extension
proc int onOk(string $dirpath,string $type) 
{
   string $path;
   string $name;
   $path = ($dirpath + "/");
   print("Path Set To: "+$path+"\n");
   // create a prompt dialog to request the users name
		string $result = `promptDialog 
			-title "Name The Asset"
			-message "Enter Name: (Dont put the extension)"
			-button "OK" -button "Cancel"
			-defaultButton "OK" -cancelButton "Cancel"
			-dismissString "Cancel"`;
	 
	 	// if OK pressed
		if ($result == "OK") {
		
			// query the entry typed by the user
			$name = `promptDialog -query -text`;
			print("Exporting: " + $path + $name + "\n");
			
			select -all;
            rotate -r -os -fo 90 0 0 ;
            
            file -force -options "groups=1;ptgroups=0;materials=0;smoothing=0;normals=1" -type "OBJexport" -pr -ea ($path + $name);
            
            rotate -r -os -fo -90 0 0 ;
		}				  
		else {
			print("Export Canceled\n");
		}
   return true;
}

// The final parameter indicates the type of file dialog. 4=Folder Dialog
// The 1st parameter is a function to call when OK is pressed.
// The 2nd parameter is the text to appear on the OK button.
// The 3rd parameter is the type of file, somewhat meaningless here
fileBrowser( "onOk", "Text", "", 4 );

5 things I wish I’d known about Unity 3 months ago

I just spent 3 months on a contract to develop a prototype for an app in Unity, these are five things I learned during development that you might find useful:

Proper commenting:

Just a simple one to start, using triple slashes above a variable declaration:

///A descriptive description
public GameObject myGameObject;

Now when we type the name of the variable the tool-tip box will have our nice description, handy!

Declutter your inspector window:

If you want public variable, but don’t want it to show in your editor:

[HideInInspector]

For some that will be obvious, for others I might have just changed your life.

Reclutter your inspector window:

Now we freed up some space in the inspector, lets fill it with something useful:

https://unity3d.com/learn/tutorials/topics/interface-essentials/adding-buttons-custom-inspector

This tutorial will get you started on making some custom editor buttons. The time you can save here will make you far more productive, for example a quick button to bypass your menus, or something like this:

if(GUILayout.Button("Print useful data"))
{
    Debug.Log(usefulData);
}

Just as a forewarning these buttons will work when you are still in the editor, so use EditorApplication.isPlaying to check if you’re playing if you need to.

C sharp is kinda nifty:

C sharp has some pretty nice built in functionality we can exploit for example:

MailMessage mail = new MailMessage();
[...]
SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
		smtpServer.Port = 587;
		smtpServer.Credentials = new System.Net.NetworkCredential("myGmailEmail@gmail.com", "myPassword") as ICredentialsByHost;
		smtpServer.EnableSsl = true;
		ServicePointManager.ServerCertificateValidationCallback = 
			delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
		{ return true; };
		smtpServer.Send(mail);

and voila you’re sending emails from you game!

There is also some extension from Unity too, e.g.

[System.Serializable]

This lets your serialize Unity Lists, Vector3, Quats, lists of Vectors and Quats, etc.

DO NOT REINVENT THE WHEEL

Building stuff with Unity is great because there is so much in there already done, and if it isn’t included you can probably find the answer online. A few quick things I figured wouldn’t be there that are just hidden in the documentation:

  1. JSON read/write functionality, you can serialize a whole class to a cross platform and readable format,but wait there’s more.
  2. WWW, the WWW class is a treasure trove of functionality.
  3. DateTime is a datatype that comes from csharp but is certainly handy.

There is a lot of stuff that you might want to write your own though, for example a percentage based approximation function is pretty handy. Chances are there is one in there and I just haven’t found it.

 

Unity has a lot of gems in the engine that’ll make your life easier, unfortunately you might have to dig a bit to find them.

Group Project – Control

At the NCCA in second year, across all 3 animation courses, there is a group project. It is a chance for the technical people (like me!) and the artists to come together and make something that utilises our combined skills. I was part of a group of 6 that made a stealth action game called control, you can watch the extended trailer here:

(Please bear in mind that the capture method significantly reduced the quality and the fly throughs behind the credits are more indicative of final gameplay)

I am happy with what we made together, and proud that we managed to get what we have in basically 3 months.

For the project I was the lead programmer, that included the AI, Gameplay, Animations and also meant I did a lot of debugging/fixing the other smaller parts of the game. This was all done in Unreal Engine’s ‘Blueprints’ a method of visual scripting.

The blueprints did make some things very easy, it was a blast for example to quickly throw together a basic player controller in a day (move, jump, crouch etc.). However I found it to be limiting for some things, especially the AI. On balance I was happy to have used blueprints though. Especially as I hadn’t used UE4 at all in the past this was a great chance to learn a new skill.

While it is unlikely I will be able to upload the game source, please email me/comment on this post if you have any questions about how I achieved anything you see in the trailer, e.g. the climbing, AI perception, the ‘bombs or anything else!

QT GUI and Car Paint Shader

I have been working mainly on my group project of late in Unreal Engine and hopefully will have some stuff to post for that soon.

However my other ongoing degree assignment at the moment is to make a car paint shader in GLSL. So far I have been looking into BRDFs and PBR, and am still really in the early stages when it comes to shader code. However I have used this project as an opportunity to play around with the QT GUI system and have made a demo program for my shader. You can find the code on my Github, and see it in action in the video below:

VIDEO MIRROR