Demo: Green Dragon

Latest entries

Character animation: interactive eye movement

Implemented cursor-following eye movement.

Needs some constraints to prevent the eyes from going inwards, though. It'd be neat if they snap back to looking straight ahead when the cursor is detected to go outside the window. That should be easy to do.

[23/06/14 21:56]

Eyes tend to move in immediate motions, so interpolation isn't necessary, but a small amount would look nice. I also want there to be a slight lag and smoothing in the dragon's head and neck movement - the immediate cursor following doesn't look realistic.

A simple approach to this would be to smooth the target point motion - which is what the head/neck movement and the eye movement are following. It could be mapped to a normalised range which can then be put through functions for smoothing and artificial delays.

Or... better: make another point follow the target point with ...

Read More »

Character animation: adding features

Let's get an eyeball to render in DragonFeaturesNode.

[23/06/14 00:30]

OK, Got the eyeball to render. Now for the hard part: make it move with the bust.

Look into those translation matrices.

One of the morphs seems to move the whole head, making the eye shift out slightly. I HAVE NO IDEA WHY.

Could solve it by having an isMorphable array for the shader, but how would I determine which vertices are supposed to morph?

Read More »

Framework: animation clip subsystem test

Animation base complete: IK is blended with animation clips and morph targets.

Making a couple of looping "idle" animations in Blender dragon rig to make the simulated character more realistic and life-like.

A pre-rendered animation I made in Blender to show off my dragon model:

The skeletal animation works in my animation subsystem for CharSim:

Testing a crude looping "idle" animation - it works with mouse-following IK and facial morphing.:

Read More »

Framework: animation clip attributes

Time structures:

Real time:

double timer; // Time since GLFW initialisation.
float tDelta; // Time per frame (could also be considered Game Time)

Game time:

float tGame; // Time since first frame (i.e. first update-draw cycle)
float tDuration; // Game-time duration for clip, whose clipDuration will be warped to match it.
// Placeholders for time-based events. Likely entered as literals in the animation update logic.
float tStart;
float tStop;

Animation time:

float tAnim // Time taken since animation starts (Animation Time) (could include repeated clips)

Clip time (supports warping):

float tClip // Time taken since clip starts (Clip Time). Calculated by modding tAnim with tClipDuration).
float tWarp; // Ratio by which tClipDuration is warped by to match the given game-time tDuration.
float tClipDuration;

Clips are loaded onto a an array ClipArray. A call to play a clip sets its isPlaying value to 'true' and each clip is iterated through each update cycle.

struct Clip
    String clipId;       // Name ...

Read More »

Framework: animation clip sequences

So far I've been implementing the dragon in SkeletonNode for testing purposes. This needs to be abstracted into a separate DragonNode (for the dragon demonstration character) and then the SceneGraph should be implemented with ControllerNode SceneGraphs which handle broad movement. They can also receive user input and control AgencyNodes and InteractiveNodes by calling their animation sequences.

Speaking of animation sequences, they need to be turned into callable functions and be blendable together.

Animation system: how to make a trigger call an animation clip on time.

It can't be based purely on comparison with an elapsed time. For instance, if a trigger is set to play a clip after 10 s (seconds), the elapsed time is likely to be fractional in any specific frame: 9.999... 10.002..., so the trigger will be missed.

A margin of error could be used, but this creates an inaccuracy and the game ...

Read More »

Texturing: fixed the texture seams

After generating my own vertex indices and vertex weight indices, vertices can now have multiple UV attributes and so the seams are eliminated.

But morphing no longer works...

OK, by recording the indexing order of the base mesh and forcing the morph target meshes to load their vertices with that order, the distortion is largely gone - save for a few odd polys. I don't know what is going on here. Perhaps the Three.js Model format 3 exporter doesn't save the vertices in the same order for different shapes.

Idea: the face index loading order might have changed, but not the vertices. It would be worth recording the positions selected for the base mesh and applying them to the vertex list in the morph target meshes.

Face index selection (ResourceManager.cpp):

glm::vec3 tempVertex;
glm::vec3 tempNormal;
glm::vec2 tempUV;

pos = faces[i+j] * coordsPerVertex;

tempVertex.x = vertexCoords ...

Read More »

« Newer Page 2 / 14 Older »