Facial animation
Re: Facial animation
Note that fixing your normals is the better solution.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Facial animation
I can't seem to make my .x animation work. I pasted the code for importing the object and animating it from various tutorials, and I must have made some critical error, but I can't seem to find it. If anyone can tell me what the problem is, I would be grateful. Maybe the entire approach is wrong?
Code: Select all
#include "stdafx.h"
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"test!");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
IAnimatedMesh* mesh = smgr->getMesh("../../media/model.X");
if (!mesh)
{
device->drop();
return 1;
}
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialTexture( 0, driver->getTexture("../../media/texture.jpg") );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 100);
node->setAnimationSpeed(15);
node->setPosition(core::vector3df(0,-2,4));
node->setMaterialFlag(irr::video::EMF_BACK_FACE_CULLING, false);
}
smgr->addCameraSceneNode(0, vector3df(80,80,0), vector3df(50,1000,0));
smgr->addCameraSceneNodeFPS();
device->getCursorControl()->setVisible(false);
int lastFPS = -1;
u32 then = device->getTimer()->getTime();
const f32 MOVEMENT_SPEED = 5.f;
while(device->run())
{
const u32 now = device->getTimer()->getTime();
const f32 frameDeltaTime = (f32)(now - then) / 1000.f; // Time in seconds
then = now;
driver->beginScene(true, true, SColor(255,100,101,140));
core::vector3df nodePosition = node->getPosition();
node->setPosition(nodePosition);
driver->beginScene(true, true, video::SColor(255,113,113,133));
smgr->drawAll();
device->getGUIEnvironment()->drawAll();
driver->endScene();
int fps = driver->getFPS();
}
device->drop();
return 0;
}
Re: Facial animation
Well, it may be that the model is not animated. Try replacing model.x with dwarf.x.
By the way, you have no GUI, yet you are rendering it!
By the way, you have no GUI, yet you are rendering it!
Re: Facial animation
Ah! I can't believe I didn't check the dwarf model! It works, and so do simple animation exported with kW X-port. However, when I create a rigged character in 3ds max and export it, the animation doesn't work in Irrlicht. The character is there, but it's not moving. When I try exporting with Panda DirectX and then running the Irrlicht program, I get this error:
An unhandled exception of type 'System.AccessViolationException' occurred. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
An unhandled exception of type 'System.AccessViolationException' occurred. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Re: Facial animation
Someone recently explained about exporting from 3DS. Maybe try and find that post and see if it is relevant. (I know nothing about 3DS.)