Skip to main content

Library for character animation and rendering based on ogre3d

Project description

how to run example codes below.

You need to copy or create a symbolic link to the work folder from the following repository into the current directory that contains the Python main files.

https://github.com/taesoobear/IPCDNNwalk

example code 1 (fbx rendering using timeline).

import os,sys,pdb,math
from libcalab_ogre3d import *
import numpy as np


def onFrameChanged(iframe):
    global skin1, skin2
    print(iframe)
    skin1.setPose(fbx.loader.mMotion.pose(iframe))
    skin2.setPose(fbx.loader.mMotion.pose(iframe))


            

this=RE.createMainWin(sys.argv)
skelFile='../../Mixamo/fbx_withSkin/bigvegas_Walking.fbx' 
skinScale=1

fbx=RE.FBXloader(skelFile, skinScale=skinScale, useTexture=True, simplifyMesh=False)

# draw skeleton
skin1=RE.createSkin(fbx.loader)
skin1.setScale(skinScale, skinScale, skinScale)

# draw mesh
skin2=RE.createFBXskin(fbx)
skin2.setScale(skinScale, skinScale, skinScale)


g_motion2=fbx.loader.mMotion
mTimeline=RE.Timeline("Timeline", g_motion2.numFrames(), 1/g_motion2.frameRate())
m.startMainLoop() # this finishes when program finishes

example code 2 (bvh loading without using timeline).

import os, sys, pdb, math, random
from libcalab_ogre3d import *
import numpy as np

elapsedTime=0
            
def frameMove(fElapsedTime):
    global elapsedTime, mLoader, mMotion,mSkin

    elapsedTime=elapsedTime+fElapsedTime
    currFrame=round(elapsedTime*30) # assuming 120hz

    if currFrame>=mMotion.numFrames():
        return
    mLoader.setPose(mMotion.pose(currFrame))
    leftwristpos=mLoader.getBoneByName('LeftHand').getFrame().translation
    RE.draw("Sphere", leftwristpos*100, "wrist1", "red", 6)

    mSkin.setPose(mMotion.pose(currFrame))

def onCallback(w, uid):
    print(w.id())


this=RE.createMainWin(sys.argv)

this.addButton('hihi')
this.updateLayout()

mLoader=RE.createMotionLoaderExt('../Resource/motion/woody/wd2_2foot_walk_turn2.bvh')
mMotion=mLoader.mMotion

mSkin= RE.createSkin(mLoader);    # to create character
mSkin.scale(1,1,1);                    # this motion data is in cm unit 
mSkin.setPose(mMotion.pose(0));

RE.viewpoint().vpos.set(0, 50, 300)
RE.viewpoint().vat.set(0,40,0)
RE.viewpoint().update()

while True:
    if not RE.renderOneFrame(True):
        break

other examples

https://github.com/taesoobear/IPCDNNwalk

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

libcalab_ogre3d-0.1.3-cp312-cp312-win_arm64.whl (20.6 MB view details)

Uploaded CPython 3.12Windows ARM64

libcalab_ogre3d-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl (59.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

libcalab_ogre3d-0.1.3-cp312-cp312-macosx_13_0_arm64.whl (15.1 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

File details

Details for the file libcalab_ogre3d-0.1.3-cp312-cp312-win_arm64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.3-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 70d03fac01d95ac2094678e187289b7e1ec1eff070df1ccfdf939c340044b359
MD5 37f878170bc74928d76422e78d27ddbc
BLAKE2b-256 2eb47b5c62aa1ae123ab643015424cb93203b93ed0eb1b0decf4109cdabefb6f

See more details on using hashes here.

File details

Details for the file libcalab_ogre3d-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.3-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 d8a7a9330db46e026c8fe0010e88bafd6a8bcbbac4dc51e26640cede0792433e
MD5 de806e0403ba61a5f28af8fb976db314
BLAKE2b-256 44b3561fa14eeb6accb9b5cb8d8e46d455134bebe1e8e727bc6c5a0214d412b6

See more details on using hashes here.

File details

Details for the file libcalab_ogre3d-0.1.3-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.3-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 a0080e93ffde02aba6de2fd82e63b973e87aa4b98bcdd23b82d00367e95906bb
MD5 dad8e752e40ee48add57c0117586473e
BLAKE2b-256 bc35d65742d0501aae60fdb2098f1e9f98522992fa5b497fe81414d08328a626

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page