Busy Week!

By Jordan Calderwood

This week was extremely busy. I put an unholy amount of hours in on the project. There were some nagging tasks that I have been putting on the back burner that I wanted to get done this week so that we can have a good month-long development cycle. Here is the list of things I wanted to accomplish:

1. Add support for Direct2D to our engine so we can render text, HUD information, etc. 
2. Implement character animations to our player and enemies.
3. Add a post-process pipeline to our engine so we can incorporate bloom, depth-of-field, and other custom post processes. 
4. Handle all of the window resize events, including recreation of all Direct2D objects, and post process pipeline textures. 
5. Create a custom geometry shader to render a world-space ball flight path aiming arrow. 

NONE OF THESE TASK WENT DOWN WITHOUT A FIGHT.

Working my way through setting up D2D1 was the easiest of the challenges I faced. I made a ID2D1Factory object and used the CreateDxgiSurfaceRenderTarget() method to allow me to render to the ID3D11 back buffer used by the rest of the graphics system. 

Next, I wracked by brains trying to debug the animation system. I went through every component of the system, checking for any clues as to why the animations were displaying incorrectly. I then expanded my search to the art pipeline, checking my custom FBX exporter for any irregularities. The problem turned out to be a problem with how I was exporting the animations from Maya, and not an actual coding error. Big waste of my time! But, the animations are working correctly and I am working hard getting the different animations implemented. 

After that, I turned my attention to setting up a post-process pipeline. This was fairly straightforward, but involved quite a few steps and some slight tweaks to the structure of the graphics systems to make it more flexible. I created the screen-space quad to render to, and several render targets and shader resource views for the various passes of a basic bloom post process effect. The effect looks okay, but it needs to be improved. I will keep looking into ways to optimize the post process pipeline, as our framerate takes a SIGNIFICANT hit when it is enabled.

Next, I went through the whole graphics pipeline to make sure our system could handle window resize, maximize, minimize, and fullscreen events. I was running into some errors early on with the setup, but I reorganized our UIManager class to accommodate our engine's window resize events. This included having to recreate the render target and any brushes used by that surface. 

Lastly, I was tasked with creating a heads up representation of our player aiming a ball. The flight path calculates the future flight of the ball based on its velocity and curve force. I wanted to create the arrow in world space using a geometry shader so that we could see the arrow intersecting with targets and get a better feeling for the position of the ball in space as it flies. This turned out to be quite challenging. I decided to send a list of lines to the geometry shader and create a quad out of each line. This was pretty straight forward as I just used the vector between the two points and the y-axis to construct two triangles. The difficult part was getting the arrow to rotate correctly around the axis of the ball's velocity when the user moved the joystick. After trying several combinations of vector operations, I ended up calculating the cross product of the of the normalized velocity vector with the normalized vector between the two points of the passed in line. I then used the resultant vector's components as an offset to the triangle vertices' positions. This worked like a charm! (Somehow)

Overall it was a very successful week. Definitely a confidence booster!

Comments

Popular Posts