Sunday, April 26, 2015

Polishing up the Baby Model

  Good news, the basis of the baby model is completed so I was able to jump to polishing up the model more in details. Some of the features I needed to polish on the baby was well more on the head; dealing with the size of the head, the shape of the nose and mouth as well. Then there's the hands that need polishing, back, butt and lastly the positioning of the arms which I'll get to later. When given this project, one of the things the client wanted with the baby model was the model having a big head. Having this information I was able to make the head bigger through selecting all polygons on the head and scaling them up in all axis. Once doing that I shrink the top vertices of the neck a bit to make it look better


  If you were to look at my previous blog, the last image posted showed the baby's back straight. My goal with the back was to create a more realistic back; to curve it more. Essentially that's what I did and this process was long. Creating this curve from the back well... Most 3D modelers would have an idea how I did it. The idea is pretty simple however the process took some time. Basically what I did was grab a few desired vertices and move them towards the stomach and as I descended down to the next edge, I would go in more with the vertices giving that inward look for the back. Towards the middle I begun grabbing vertices and pulling them away from the stomach to create that arc look. Now as odd as it sounds, if you were to look at the butt... It's pretty flat. It should be rounded more. 


  As you can see with the picture above, I was able to succeed that. Through some observation you can definitely pin point that I added a lot more edges to the stomach to round it out more but as well as to begin working on the butt. Modeling the butt was very similar to polishing the bottom of the back. I begun pulling vertices out and then inward. After doing so I begun rounding the butt out more that that it doesn't look flat on the sides. If you were to compare this picture above with the first picture in this blog, the noses are different. In all honesty the nose's shape was bother me a lot and after accomplishing the arc on the baby's back I was thinking... Why not do the same for the nose. So similar to the back, I arc the nose to create more realism and appeal.
  Unfortunately around this time I stopped creating different versions of saved files and continue polishing with this one, so I wouldn't be able to pull up the progress of how I did certain things with the model. Fortunately because I made this baby model, I can go into details on what I did as far as processes goes. After getting the shape of the head, the neck, the back, butt and nose..My next task was positioning the arms. 
  
  The problem with the model is that it's in T Pose. Upon texturing it where practically texturing the armpits as if it was stretched. So upon moving the arms down when rigging, the texture for the arm pit's would still be stretched. Knowing this would be an issue I changed the baby's posed from T to relax, as you can see above. Now wouldn't this be a hassle to do for both arms? YES! This is where mirroring came along. I grabbed half of the models polygons from one side and deleted it. Upon deleting it, in the modifiers tab, I selected Symmetry. Symmetry is just like mirror but the difference is, it has a auto weld function that upon collapsing the stack of modifiers... It welds the symmetrical half, to the original half. With symmetry, it makes a copy of the model and then you can choose which axis the copy is in. Where I'm going at with this is, all I had to do is re position one arm and boom! I'm down with the other side! Now re positioning one arm was bad as it is. What I had to do was select a ring of polygons that would separate the arms from the shoulders and delete it. Once deleting that ring allowed me to gain access in maneuver just the arm of the model and not the arm and the model at the same time. So when I did this, I translated the arm down a bit, rotated it as desired. Once I was satisfied with the position I had to re attach it to the model. From using 3ds Max for a while now, I'm very comfortable and confident when it comes to doing crazy things. Re attaching the arm back to the body is very possible. The way I did it was selecting border. With border I selected the opening of the arm and hit Cap which creates a face in the opening. I did the same with the shoulder. After doing this I selected both new faces and hit bridge. Hitting bridge connected both the new faces together which in turn.. Connected the arm to the body.
  Having re position the arm I had a few tasks left for the baby. This came from rounding the head out more and polishing the hands. To give an idea of how I rounded the head... I begun moving vertices inward to give less of boxed head shape and more of a sphere shape.



  After accomplishing that I begun polishing the hands more. The hands to start off were just spheres in the beginning. Considering Max the baby, would grip on objects, we needed a more realistic hand.  I was able to accomplish this through very similar methods. Pushing and pulling vertices in and placing them in desire locations. I also spent a lot of time on rounding the hands out more so that they don't look like there are any sides that look squared. Thus after doing this finished the baby model! Well at least modeling it! As you can see there was a big jump from pictures as far as progress went. My teammate had textured the baby for me. After texturing was completed meant we were one step closer for integrating the baby. The last things left are Rigging, Skinning and Animating the baby. Hope you guy's enjoy the model!


Creating a Basis 3D Baby Model

  Currently I am enrolled in my senior project course and I must say, I'm really excited. This course is divided up into two eight weeks where we will be developing a product based on a project a client has given us. The project me and my group have been given is called Max Proof which will be a game where players have to baby proof an area so that Max; the baby can walk safely. The game is in isometric view and will take place in the babies home. Before the baby begins to walk in the area, players are given thirty seconds to baby proof the area.This can come from securing doors using locks, fill in holes using boards, even moving items in the scene to different locations. As a group, we are given the task to of course deliver the complete project to our client. So as a group how have we spread the work out? Well for what I can say, I was assign to create the baby model, rig and skin it, as well as create the animations for the baby. To continue this I was also assign for helping develop the inventory with one of my team members on top of doing the collision functionality in the game. For me, senior project is a big deal so I can say this 3D baby model has been the most complex model I have ever developed and I am very excited to continue to work on it. So lets dive into it!
  Having begun a few side projects before senior project I was developing a character model for a game. When I got to senior project I had three options; create the baby from scratch, use the character model I was already working on and make it into the baby or use a model I had completely finish that was just for fun. The option I went with was of course, the character model. The model I had completed for fun was a model many might be familiar with; sack boy!

  This was a very fun model to work on and I've been dying to implement this model in a game. Unfortunately because I am not a 3D modeler but a programmer there are a few bad things about the sack boy model I created. Such as cleanliness and location of polygons. When it came to the sack boy model, it was not organize as far as polygons went. I basically went nuts as you can tell. On top of this, if you look at sack boy's legs... His legs are to far from the hips and they are already bent. With that creates a lot of issues with rigging and animating because since they are already bent, we may get a lot of illegal geometry when straightening the legs in animation. Thanks to those reasons I was able to come to conclusion to go with the other model because it was very clean.

  As you can see above, this was the character model I was working on based off a tutorial I was watching. I went with this because it was way more cleaner in polygons here. A lot of the placements as well made a lot more sense. In all honesty, before I actually get started to show how I develop the baby, I just want to say I'm really excited to show how much of a transformation I made from this model above to what the results are now. So when I begun modeling the baby model using this one I develop as a template, I started off with the hands and feet first. The way I went about creating the hands and feet was through the tool called bevel. Bevel is just like extruding but with outline in it where you basically pushing or pulling a polygon out and either scaling the face more or less. When it came to the hands I selected the face that pointed forward and used Insert which created another face in the polygon and shrink it down. Having that new polygon created I bevel it out to create the thumbs. Thus ending the basis of the feet and hand.
  The next step was proceeding on the stomach...Giving the baby a belly! This honestly was the most fun part because it was pretty hilarious to work on. I mean when I first was doing this I was like wait...This guy looks pregnant, he can't look pregnant!

  Eventually though I was able to get it right. The way I went about doing the baby's belly was very simple. I selected one edge going vertical, hit Ring which selects a ring of edges that's horizontal to the one I originally selected and then hit Connect. Doing this creates a new ring of edges going horizontal that connects to the ring of edges going vertical. Having three new rings of edges, I basically started selecting vertices and bringing them out, creating that round shape belly. After doing that I selected all polygons on both legs  and scaled them down on the Z axis and stretched the legs out a bit on both the X and Y axis to created that look as if the legs are fat. I also did this for the arms as well. So with this being said, I practically had most of the basis down! Just needed a head next!


  If I were to give any detail on how I did the head, the most descriptive way I would say I accomplish this came from how I did the hands. Basically beveling things out, scaling polygons down. As you can see with the picture above, I bevel quite a bit to create the head. Before I went crazy though, I made sure to extrude first to create the neck. The next step was creating the eyes and and nose for the baby. Just like anything else, I messed around with either Insert or Outline and then extrude it. Well for the most part of the nose. One of the things I did do with the nose though was also translate some of the polygons as well as shrink them more as desired. On top of that as I got towards the nostrils, I beveled inwards to create that hole; making sure that the polygons that was going in was not overlapping any existing polygons.


  When it came to the eyes I actually did not have to do anything with Outline, Insert or Bevel. If anything I would think of it as just planning it out. My goal for the eyes were to get it at least an oval shape which I achieved through moving vertices to desire locations. You may be wondering now, how come in the picture above the other eye looks weird. The reason why I left the other eye alone was because I knew I was going to end up deleting half of the model in the future so that I can mirror it and eventually weld the two together. It sounds confusing but when I go over it later on, you'll see what I mean. The last step for creating the basis of the baby was the mouth and man I must say this was the most difficult thing to work on. It wasn't fun at all only because it gave a weird look as if his cheeks were going in. Just like how I did with everything else, I used the friendly bevel tool. With the mouth I beveled inward and eventually begun extruding by small iterations inwards. After having what I needed to work with as far as polygons I begun shaping the mouth more by moving the vertices to desire locations. Just like with the eyes, I tried going an oval shape. The difference between doing this and the eyes were well... I needed lips and I needed a hole for the mouth. After having the final part extruded out I also beveled inwards to create that hole for the mouth but as well give me more opportunity to shape the lips more. Thus finishing the basis of the entire. Model. Now keep in mind, I said basis! All of this is just a foundation of what I'm really going to work on. Still very excited to show off the baby!

Monday, April 20, 2015

Unreal Engine 4: Lift Demo v1

  After having to get Leap Motion integrated in Unreal Engine 4 I immediately jumped into learning a few new things through going to the Leap Motion website where there was an example implementation of Leap in Unreal Engine 4. Having spend some time looking at the different projects offered I felt I become somewhat familiarized with what I wanted to do. One of the things I like to do now is whenever I begin a new project, create a requirement list. To me creating a requirement list is very helpful because you can use the list as a way to debug your project further or to see if everything is matching what your requirements are for the project. For this project, I created a small requirements list.
Lift Demo
Requirement ID
Description
Status
1.1
The system shall recognize when a hand is added
Complete
1.1.1
If the system recognizes if a hand is added, the system shall set the hand mesh to visible
Complete
1.1.2
The system shall recognize when the hand is removed and set the hand mesh to not visible
Complete
2.1
The system shall be able to determine when a hand has collided with a handler
Complete
2.1.2
If a hand collides with the right handler, the system shall move the ball right with some torque
Complete
2.1.3
If a hand collides with the Left handler, the system shall move the ball left with some torque
Complete
2.1.4
If a hand collides with the back handler, the system shall move the ball backwards with some torque
Complete
2.1.5
If a hand collides with the forward handler, the system shall move the ball forward with some torque
Complete
2.1.6
If a hand collides with the top handler, the system shall have the ball jump based on an impulse
Complete
3.1
The system shall be able to change the balls material if both hands collide with one another
Incomplete
3.1.2
If two hands collide with each other, the system shall be able to change the balls collision status
Incomplete
4.1
The system shall be able to grab different objects in a scene using two hands
Incomplete

  As you can see above, I still have quite a few major aspects to still implement in the demo but other than that, I was able to get one portion working fine! So to begin the process I started off with a new project using the rolling ball template in Blueprint. Looking at some of the functionality I changed some methods, added a few functions as well as integrated the Leap Motion Controller onto the pawn blueprint. But that's not really saying much or diving in is it?

To dive into it, in the pawn blueprint of the ball I added the component Leap Motion Controller

   When I first did this, I ran into a problem. Upon starting the game, the hands would appear assuming you had your Leap Motion Controller set up. But considering the pawn is a ball that roll's, the hands would roll too. In order to prevent this from occurring I actually just attached the controller as a child of Spring Arm. Thus, the hands would not rotate. So the hands were integrated in the pawn's blueprint, but what is it doing? Nothing really. My goal was to have the hands control the movement of the ball. The way I went about doing this was creating Handlers. Each handler would determine which way the ball would maneuver when a hand collided with it. Thanks to UE4 this was simple in the Pawn's blueprint. I created five box collisions. The names I gave to these handlers were RightHandler, LeftHandler, TopHandler, Forward, Backward. All child's of Spring Arm so there relative rotation are not relative to the ball.

  After creating these new components, I placed them in the desire location close to the Leap Motion Controller. Now begins the logic! To begin with the logic I created three functions called MoveRightLeft, MoveForwardBackward, and Jump. These functions say what they need to do. Move the ball right, left, forward, backward or jump. Clicking the + sign at the top right of functions I created my MoveRightLeft function. In it was really only three statements. Setting a boolean called HandCollides to true and if HandCollides is true add a torque to the target ball. In the torque pin, I broke out the vector where I multiplied a float called RollTorque of 50000000.0 value to the parameter XAxis and plugged the value of that to the X coordinate of the vector. To end the function, I created an Input parameter called XAxis of float type.

 
  Thus ending the MoveRightLeft function. The MoveForwardBackward function was very similar. The only difference was, I use the resultant value and plugged it in the Y coordinate and changed the input paramter name to Y Axis.


  Lastly, I just needed one more function left. The Jump function. This one was already given, I just made it into a function for organization.


  Having the functions finished, I jumped back to the Event graph to get the implementation running in the game loop. Actually implementing was fairly easy, all I had to do was on each begin overlap of a handler, call the desire function relative to the name. On end overlap set HandCollides to false which disables the ball from continuing moving.



  Thus completing most part of the Demo. All I needed left was the material changing dynamically on the mesh as well as the ability to grab objects with the Leap Motion Controller. As far as it came down to dynamically changing the mesh, I was very familiar how to do it upon a key press... But not sure how to go about doing it if both hands collided with one another. To actually get the balls material to change dynamically and with it's collision I created an input event called I. My logic behind this was if the ball was not invisible, set the material to visible and set the collision response to ignore all on all objects that are dynamic. If the ball is invisible, change the material back to the original and set the collision response to block world dynamic.


  After doing this I decided to just jump into the level to see how the integration worked out and man it's so cool! My goal before actually calling this demo completed is to not only complete my requirements list, but to create the balls movement more smoother through creating a Gyro Ball. Based on the hands location in the gyro ball I want the ball's location to increase whether the hand is moving forward in the ball, forward left ect. Personally I feel this route is much cleaner. My other goal is to actually spend some time designing the level. The current level was just something I threw in to see how the functionality of the pawn works. Can't wait to release version 2 of it!!




Integrating Leap Motion in Unreal Engine 4

Currently I am taking GSP 475, phew one step closing to graduating! For this class we essentially have a eight week project where student's have the option to create something with emerging technology. For me, I decided since I have the desire to continue expanding my knowledge in Unreal Engine 4 now that 3 is slowly becoming obsolete, I wanted to do a project with Unreal Engine 4. Being up to date I am, I actually read an article from Epic about Leap Motion. For those not aware, Leap Motion is a motion tracking device that tracks hand movement. It's pretty cool and can be integrated in many software such as; Unreal Engine 4. For this project my goal essentially was to create a small game where players can maneuver a ball based on hand movements as well as have the ability to pickup objects and place them in desire locations. For this project, I decided to call it Lift. Before jumping in to how I went about developing this project, I wanted to give a brief description on how to Integrate Leap Motion into Unreal Engine 4. Here it is!


Instructions for getting Leap Motion Running


To install and be able to use this product, first you must obtain a few other software such as Leap Motion SDK, Visual Studio Community 2013, as well as Unreal Engine 4’s source code. To continue this you will also need a Leap Motion Controller.

So let’s begin with the first software.

How to obtain Leap Motion SDK:

1.      Go to the Leap Motion site.
2.      From there jump in the Developer tab and the download should begin right away. If not, hit the download link to begin the download.
3.      After the download is complete, run the installer application.
4.      Assuming a Leap Motion Controller is on hand, connect the Leap Motion Controller to your computer.
5.      In the taskbar, a Leap Motion Controller Icon should appear. Right click>Visualizer to test that the software and hardware are working properly.

There you go, you officially have integrated the working software and hardware into your computer. The next step is downloading Visual Studio Community 2013.

Acquiring Visual Studio Community 2013:

1.      Go to the Visual Studio site.
2.      Hit Download.
3.      Run the .Exe
4.      Continue following the steps guided by Microsoft visual studio to fully install it

One more list of steps and then you’re done! We now have to download Unreal Engine 4 source code onto your computer through GitHub so that you can acquire the Leap Motion Plugin in the Engine.

How to obtain Unreal Engine 4 Source code through GitHub:

  Establishing an account with Unreal Engine:

1.      Go to the Unreal Engine 4 site.
2.      If an account has been created before, sign in otherwise sign up.
3.      After signing in or signing up, go to Account
4.      In the box Get UE4 Full Source Code, right click and open in a new tab linking your GitHub account
5.      In the steps below featured on the page, click the first step’s link GitHub.com which will take you to GitHub

  Creating an account on GitHub:

1.      If an account has been created before, sign in otherwise sign up.
2.      After signing in or signing up you should have been taken to Epic Game’s page on GitHub. If not, retrace your steps back to step 4 which assuming if logged in on GitHub. You’ll be taken to Epic Game’s page.
3.      Once on Epic Game’s page on GitHub, click Unreal Engine.

  Installing GitHub:

1.      Once on the page, scroll down to Getting Up and Running where you’ll click GitHub for Windows. Assuming you have windows.
2.      On the new page open, hit the download button to install GitHub on your computer.

3.      Before continuing any further, jump back to the previous tab in Unreal Engine to your account.
4.      Hit Profile and plug in your GitHub name to sync it to your Unreal account.

  Forking and Cloning a Repository:

1.      Back to the GitHub page, at the top right corner of Epic Game’s GitHub profile, hit Fork. Doing so will create a copy of the whole source code to your account.

2.      After doing this jump into the GitHub application that you installed.
3.      Hit + > clone.
4.      From there you should see Epic Game’s where you’ll have the option to cloning Unreal Engine or Unreal Engine Tournament. Clone Unreal Engine.
5.      Choose a destination you would like to clone the repository to on your computer.
6.      After doing so a folder of the repository shall appear on the desire designated location.

  Obtaining the Source Code:

1.      Go to the folder that was just created.
2.      Run the Setup.bat file
3.      After that’s completed run GenerateProjectFiles.bat
4.      Once the files have generated a solution file for visual studios called UE4.sln should be available.
5.      Open UE4.sln.
6.      Once Visual Studio has open up, in the solution explorer right click on UE4 > build. This may take some time to build.

Once the build has completed you shall have the entire source code project of Unreal Engine now officially on your computer plus giving you access to Leap Motion Controller Plug in. But the instructions doesn’t just end here! You still got to actually plug in the plug in in a project.

  Plugging in Leap Motion into an existing Project:

1.      Open the editor through clicking Epic Game’s Launcher or through going to Engine > Binaries > WIN64 > UE4Editor
2.      Once either or is clicked, Launch the most current version of the editor you have.
3.      Next, create a new project with whatever template you desire.
4.      Afterwards, go to Window > Devices and Enable Leap Motion. Doing so will restart your project to enable it.


There you have it. Leap Motion has been fully integrated in your project! 

Monday, November 24, 2014

Creating a Game Engine: spriteContainer and Tile

  For the first few weeks in our GSP 420 course me and my group have begun the "production" phase where we're beginning to work on our specified cores; Main framework Core, Graphics Core, and AI & Collision Core based on the class diagrams we've developed for them. To begin the core that I'm in, I started off doing the spriteContainer class and Tile class. The way me and my group wanted our game engine to be was as universal as possible, so the idea I had for the spriteContainer class was to have a storage where we can place Texture2D objects in and whenever we want to grab those images we can just invoke the variable from the class. To start this off as somewhat a template I created various Texture2D variables giving them a getter and setter such as; player, enemy, block1, and exitTile.

public static Texture2D player{get; private set;}
public static Texture2D enemy{get; private set;}
public static Texture2D block1{get; private set;}
public static Texture2D exitTile{get; private set;}

  The reasoning for them having a getter and setter is simple, the name says it all. To get the value of the variable and or be able to assign something to the variable. Purposely having the setter private so only the spriteContainer class can assign the variables to something and any other class is inaccessible to doing so. After creating a couple of variables I created a function that loads the content into specified variables called Load(ContentManager content). So at the moment if we invoke these variables outside the class, nothing happens. The purpose of the Load(ContentManager content) is to be able to assign these Texture2D variables to images using XNA's content.Load. In this function I begun assigning these variables to be able to load an image by doing:

player = content.Load<Texture2D>("spriteContainer/player");
enemy = content.Load<Texture2D>("spriteContainer/enemy");
block1= content.Load<Texture2D>("spriteContainer/block1");
exitTile = content.Load<Texture2D>("spriteContainer/exitTile");

  What is happening is where assigning Texture2D variables like player, enemy and or exitTile to be able to load .png files (because we're casting Texture2D) from the folder "spriteContainer" and specifying the actual file name. So now when we're outside of this class we can just do spriteContainer.player instead of doing it the long way; content.Load<Texture2D>("spriteContainer/player"); all the time. The best part about this class is considering this is a game engine... For any game speaking, we can just continuously create new variables and add them into the Load function to store them up in the system so we can use them universally. Thus finishes the spriteContainer class....Until we make a game!

  After completing the spriteContainer class I decided to tackle down the Tile class. The purpose of the Tile class is simple...It's basically just identifying something to being a Tile in a .txt file. So this tile can be a variable from spriteContainer or just a simple string name with a collision. Now thanks to actually doing a class diagram for the graphics core I know there's going to be an association with Tile and the levelEditor class. So Tile is going to have somewhat a significance in the making. The way I thought of the Tile class was to identify something being a tile and deciding what collision type it was. So to begin this I created an enumeration called collisionType.

enum collisionType{ Passable = 0, Blocked = 1, Platform = 2, Trigger = 3}  

  The enumeration is pretty straight foward; to determine what collision type a tile has. If a tile has a collision type of passable, on a .txt file the player can pass through it. If the tile is Blocked, the player cannot pass through it. If it is a platform, the player can jump on it but keeping in mind the tile does have bounds. If the tile has a collision type of Trigger then that basically means the tile can cause an event. So this could be an item event for example. After doing this I created a Texture2D object called texture and an object of collisionType called collision. Then to be able to manipulate the size of an image/tile I did

public const int Width = 32;
public const int Height = 32;
public static readonly Vector2D Size = new Vector2D(width,Height);

  I did this because in the levelEditor class I know there will be an association occuring in the Draw function where I can place Size in. So if I wanted to change the size of a tile I could always change the value of Width or Height. To continue this I created a simple constructor called;

Tile(Texture2D texture, collisionType collision)

  Inside it I basically just assign the variables to eachother:

this.texture = texture;
this.collision = collision;

  Doing this completed the Tile class. Now all that's left to complete are four classes; camera, levelEditor, Animate, and Render! Can't wait to begin on the Animate class.

Monday, November 10, 2014

Creating a Game Engine: Class Diagram and Requirements List

  So to start this off, I am currently taking GSP 420 which is a course built on creating your own game engine. I have to say, before this class I've been eager in wanting to take this course because I've always wanted to make my own game engine. Into two weeks of the course me and my group have decided to create a game engine based around a platformer where we will be building it off of C# and XNA. The group I have is divided up into three cores; Main Framework Core, Graphics Core, as well as AI and Collision Core. Currently I am a part of the Graphics Core and I'm pretty comfortable with that only because I enjoy working with graphics! So to begin with our Game Engine we made sure to do some analysis planning through creating a class diagram and requirements list specific to our core. Being able to create a class diagram as well as a requirements list is a great way to get an idea of how the core's going to be structured as far as the system goes.

Graphics Core
Graphics Core
  As you can see with the above picture we have quite a few things going on with the graphics core and that's just only the graphics core. Since we want things to be almost pretty universal my thought behind this was to create a class which holds all sprites and this class was called spriteContainer. With this class other classes can just load a texture on screen just by invoking a specific variable such as player or enemy1 such as the levelEditor class. The levelEditor's purpose is actually what the name says, it edit's the levels properties as well as reads .txt files. In this class we can grab textures and set them to be a tile that blocks the players path, or a tile which determines the sprites exit point of a level. After setting up everything as pleased we can just draw all "tiles" based on the level index read and the file streamed. The cool thing with this class is the ability to read .txt files. So let's say we set a certain sprite to have a character of "P". Placing P in a .txt file will actually tell the compiler oh hay this is a platform. As you can see with the picture above there is an association going on with levelEditor and Tile. The purpose of tile is to take in an image from spriteContainer class where you can determine if the image is a platform, has a trigger, is visible or invisible. Now since our game engine is a platformer and we do want to be able to universally have the engine create an animation based off a sprite sheet we created an animation class called Animate, which associates with the spriteContainer class. So in Animate, it will take into account any sprite sheet, create a cell which shifts left or right, as well as determining if the animation loops or not. Now just so I don't get to into detail, it all comes down to the Rendering class. The whole purpose of this class is to Draw, which will draw all tiles based on the level in level editor, as well as render and update the screen coming from ScreenManager. Thus finishes the class diagram for our Graphics Core.
Requirements List
  Now it all comes down to the requirements List! I actually enjoy doing the requirements list a lot because it's great to use as a check off sheet such in a way when you begin testing you view your requirements list and see if the system follows all of the requirements. Usually when it comes to creating a requirements list, you want to get as thorough as possible because if there's a bug in your system and it has nothing to do with your requirements then that can go on the programmers fault. So when you look at the requirements list above, it doesn't look as thorough only because this is part of only the graphics core. The way me and my partner did it was pretty organize; labeling things by a requirement I.D as well as giving each description a status so we can use it as a check off sheet. When doing the requirements list, we did try to get as detail oriented as possible so in the instance when we test the engine we can make sure everything is running the way it should.

  Overall I'd have to say when it comes to creating some sort of system, whether its a software, program and or game engine...It's probably wise to do some planning before hand rather than diving into the production phase because then you might run into more errors versus if you had plan things out. A great way to actually plan things out can come from creating Class Diagrams, Use Cases, Requirement lists, as well as a Risk Assessment Table.

Tuesday, November 4, 2014

Getting started with FX Composer 2.5

  One of the things I enjoy a lot as a programmer is being able to handle things on the Graphics end. This can come from many things such as creating a user interface for games or handling 2D and 3D graphics and implementing them through a game engine or Direct X. Staring this new course excites me because we begin to approach more of the three dimensional aspects of Direct X such as messing with Shaders. One of the things we were first introduced to was something called FX Composer and I'd have to say the professor wasn't lying, it seriously looks like a combination of 3ds Max and a programming language combine together! FX Composer is basically a tool where developers on the graphics end can create or modify shaders through the use of creating an Effect file. The Effect file is then associated with a Direct3D program where a programmer can utilize that shader on a 3D model. With the use of DirectX Standard Annotations and Semantics (DXSAS) programmers are allowed to edit values of Annotations on a "host application" where they can actually modify the shader for their own use. So in other words we can utilize a shader on two different objects and have two different looks to it through tweaking the parameters of annotations.
FX Composer
  As you can see with the picture above, this is FX Composer and it really does look like a combination of 3DS max and C++! The middle window is the Editor or where all the programming lies where as the top left window is the material window. The top right window is the propeties window which gives you the properties of a material and the bottom right is the perspective window where you can see a mesh with the shader/material applied to it. So to start this all off, looking at the Phong effect file we can see quite a few things such as Lamp0Pos, Ambient, Bump, Ect. Under these you see annotations such as UIName, UIMin, UIMax and so on. These annotations have values which can be messed with through FX Composer or even through C++ which is great because that means you can dynamically change these values!

Effect Skeleton
  So the question you may ask yourself is how do you grab these annotations in C++? Well one way you can do this is through determining the annotations data type and then create a variable with that same data type and another variable which is a handler. So for instance, in this project we worked with the Gooch Bump Shader type. The shader has things where you can change it's warm color and cool color and it's data type dealt with color. So what I did was create four variables of type D3DXCOLOR and D3DXHANDLE and named it warmColor, coolColor, hWarmColor, hCoolColor. In the function where we load the effect file of the shader I grab the two handlers and had them call getParameterByName which took in the names of the semantics. Doing so basically said... okay we're going to assign these handlers to the semantics allowing you to edit their values as you please.

Renderer
  Thus leading me to the Renderer Function where I messed with the parameters setting warmColor to D3DXCOLOR(0.7f, 0.03f, 0.01f, 1.0f) and coolColor to D3DXCOLOR(0.01f, 0.05f, 0.25f, 1.0f). After setting the colors you have to set in the values which then you take into account the handler and the variable which you stored the color. With this I did
        m_pEffect->SetValue(hWarmColor, &warmColor, sizeof(D3DXCOLOR));
m_pEffect->SetValue(hCoolColor, &coolColor, sizeof(D3DXCOLOR));

  Which gave me the picture below:

Result
  For a first assignment I'd have to say this was quite fun and I look foward to what else FX Composer brings to the table!