Happy 2017! I know, it’s almost February, but better late than never, right?
[EDIT: I was so excited that this demo actually worked that I didn’t even realized this wasn’t the first post of the year]
Anyway, I just finished this demo and I wanted to share it with you. Simply put, I’m rendering lots of characters on screen using the impostor technique, which relies on rendering a single model in an offscreen buffer. Then, multiple quads are drawn using the output of that buffer as texture.
In order to achieve this goal, I had to make some changes in how scenes are rendered (is this the first refactor of the year? No). Since we’re using multiple cameras, we needed a way to define which one is the main one (we cannot rely on the Simulation to that for us any longer). Also, a new render pass is required to draw the model on a texture. And so the OffscreenRenderPass (were you expecting something else?) was born. But that’s pretty much it.
As usual, this is a new feature and therefore… unstable. Do not try it at home (yet).
This post is NOT about Metal. I promise.
I’ve been working on a little side project during the last couple of weeks using two of the newest Crimild’s improvements. Here, take a look:
So, what’s going on here? The game idea is pretty obvious: it’s a platform game. You walk or run and then jump to reach another platform. Or you can fall into the abyss until MAX_FLOAT happens.
But there are two mayor “new” features working together here for the first time: animations and physics.
I introduced the new scene importer earlier this year, now supporting FBX and other file formats thanks to the Assimp library. What’s different in this demo is the use of a new Animator component, allowing us to set states and transitions between poses based on predefined rules.
For example, you can transition from idle to walk animation by linking them with the current horizontal speed. Or, you gan go from any given state to jump if the vertical speed changes. All this is combined with a character controller that reacts to user input.
On the other hand, the Physics system has been improved by supporting different colliders (like box, capsule or mesh). The RigidBodyComponent has been greatly enhanced, too. And all physical objects can now be created from Lua scripts as well.
At the moment, both features are in the “experimental” phase but I’m assuming they’ll be production ready before the end of this year.
That’s it. Let’s go back to Metal…
In the past few weeks I’ve been working on improving Crimild’s scene importing mechanisms with two goals in mind: provide support for more file formats and implement skeletal animation (hopefully, in the right way this time). Since I dropped support for COLLADA some time ago (yes, I did that), the only official importer was the one for OBJ, a great model format for sharing assets, but with a lot of constraints and no animation support.
, an open source model importer library with support for a wide number of standard file formats like 3DS, FBX, Blender, COLLADA, etc. Assimp turned out to be extremely simple to use and integrate into Crimild. The hardest part was to understand how its animation structures can be transformed into something that Crimild can process. Except for some noticeable artifacts, progress so far looks good:
In the center of the new additions there’s the new Import module, including the SceneImporter class implementing the conversion from Assimp internal format to Crimild’s one. I preferred to keep it as an independent module (much as scripting or physics) in order to maintain the core classes free of external dependencies. That has been one of the best decision I made early in the project and it has paid off really well. In addition, new components has been added to the core module in order to work with skeletal animation, updating bones and applying them to the rendered vertices.
At the moment, animation support is still in the experimental phase, but expect to hear more in the not-so-distant future.