Tuesday, February 25, 2014

Model Loader Success

This past week (on thurs?) I finally got the ThreeJS Collada model loader to work.  Not that Mr Doob's model loader is hard to use, I'm just a newbie who had a hard time with a couple things.

First; deciding whether to use the JSON or Collada formats.  JSON is the preferred format of ThreeJS programmers importing Blender models, however, Collada is the default (nicely supported) Blender exporter so... I decided to with Collada because I'm an artist at heart.

Second; learning how to "bake/pack" my textures properly in Blender BEFORE exporting to ThreeJS.

Part two had been giving me no small amount of difficulty getting the texture maps to export to ThreeJS with the models.  The model part of the loader worked from the word "go" but the textures had eluded me for several weeks.

Sidenote:  the cool thing about the JSON format is that it turns your model into a .js file that you can open and manipulate vertices, animations, etc...   which has it's obvious advantages.

So with the models now in the game and dressed for success I am putting animation on the back burner.

I have a new set of issues to work through around the fact that the Collada loader seems to have difficulty loading several files.  The ColladaLoader object itself apparently only wants to load 1 super model (pun intended) that is then parsed into a "model array" (or insert your favorite data structure here).  Stack overflow has several great parser snippets with interesting work arounds for partitioning this super model DAE object.

Once I get a handle on parsing the super model it's a fairly simple matter to manipulate the individual models in 3D space with ThreeJS.

Oh, I also got the screen-panning working (standard to every RTS) with only a few kinks that are Javascript specific.  For instance, the keyboard input won't work until you "mouse click" in the canvas/browser window.  This confused me for about 10 solid minutes until trial and error eventually prevailed.

Aside from minor issues like that panning and such this week has been very successful.

Finally I also got some REALLY basic picking working which should help pave the way for getting the marquee selection working (standard group/area select for RTS).

To wrap up;  this past week I created the foundations for the screen movement, mouse picking/selecting, and asset loading.

With Zach's success in getting rudimentary message passing working we are now one step closer to piping our model and view/controller together.

Thanks for reading,
Clay Francisco

No comments:

Post a Comment