Monday, July 31, 2017

Almost There...


Demo Time

I really don't have much to say for this post.  Time is wearing down to the wire, and I've yet to come anywhere close to where I thought I'd be by now.  Nonetheless, here's a summary of my past week.

Wavefront OBJ File Loader

The cornerstone of any nutritious breakfast.  Want a model on the screen quickly?  Wavefront OBJ.  I wrote the loader using my existing geometry pipeline and it worked as expected.  The screenshot above shows the ubiquitous Utah teapot as a loaded OBJ; I plan to have this be the first "character" I animate.  Well, not really animate but... move.  Yes, since a good chunk of my material will be on locomotion, I need static objects that can move about using player control.  For the more advanced characters that may also need skinning, I added the option to add skin weights and bone indices to the OBJ-loaded mesh using Maya's XML weights format.  The loader just reads that file as well and stuffs weights and indices into the vertex buffer.  To top it all off, the loader will use the loaded model's positions, normals and texture coordinates to generate tangents and bitangents.

Geometry Asset Streaming

Since one of the main goals of this task list was to do some cool stuff for myself, this next bit was done just for fun.  I noticed that generating procedural geometry and loading OBJ files took several seconds, which is several seconds too many.  So I made a little system that allows for asset streaming: after an asset is loaded or created, it can be stored to either a binary file or simple byte array before being deleted.  The byte array method allows multiple data sets to be stored in the same stream, which can then be saved all at once to a file and loaded back in.  In the demo setup code, a file load is attempted first; if it is successful, the data is read directly from the file; otherwise, the data is created from scratch and then saved for the next run.  It's quite handy because load times go from several seconds to maybe a tenth to a quarter of a second, which is barely noticeable.

The Demos Begin

I have managed to start working on the animation samples, luckily.  So far I have a custom format for storing animation clip information that can be loaded in.  Right now I'm building a "keyframe controller" that will basically behave as an "animation player" or "channel" so that future static keyframe or blended frame tasks become super quick and easy.  Considering I want to do things like skeletal animation blending, this will help with the notion of frame blending and, later, blend trees.  I figure I'll start off with something that uses static keyframes, but still requires some sort of time controller: sprites.  I have some test sprite sheets for this reason, and have decked out a sample keyframes file to organize its frames.  Rendering sprites will be next up.

One more week...

Like I said, not much to discuss.  Sorry this one is not as juicy as the last post... maybe all the stuff that happened that week is why I consider myself behind this week... oh well, it is what it is, and at least I'll have something usable for the course.  Hopefully by the next (and final) post I will have at least one kick-ass demo of something advanced to show.  I'm hoping for IK.  But until then...

No comments:

Post a Comment