University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

mapping the facial expression from file | General SmartBody Discussion | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
mapping the facial expression from file
May 5, 2016
10:17 am
Avatar
Member
Members
Forum Posts: 5
Member Since:
May 5, 2016
sp_UserOfflineSmall Offline

Hi Admin,

I have a file recording all the facial markers position with world coordinate system about every frames of an animation. I know maybe I can use the relative position and map to a standard facial map to use the data. But how can I map those data to virtual human in smartbody? Do I need to set every point in smartbody like:

 q = SrVec()
                             q.setData(0, 1)
                             q.setData(1, 1)
                             q.setData(2, 1)
 
                          
                             self.setChannelPos('nose',q)
like this?
Thanks. 
May 5, 2016
10:59 am
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

You can set the data in that way, but that assumes that the joints in your data set match perfectly against the joints on the skeleton in SmartBody. If they are the same, then, yes, that will work. If they are different, you will need to do some kind of facial retargeting to put them on the SmartBody character. That retargetting will do something like:

1) Identify the matching points between the data and the SmartBody face

2) Translate data from the file to the SmartBody face (i.e. in data file, left eyebrow went up 50%, so lift the left eyebrow on the SmartBody face by 50%)

 

Ari

May 5, 2016
1:12 pm
Avatar
Member
Members
Forum Posts: 5
Member Since:
May 5, 2016
sp_UserOfflineSmall Offline

I tried this, but there is no change at all in the already character. Do you know what's the problem is?

Thanks. 

 

class MyController (PythonController):

def init(self, pawn):
print "Initializing… "

# load your data from a file, put it into some variable like ‘data’

def evaluate(self):

# get the data from the file
# ….
#for
q = SrVec()
q.setData(0, 1)
q.setData(1, 10)
q.setData(2, 0.25880)

# set the value of some joint to the data

self.setChannelPos('brow01_right',q)

myc = MyController()
# get the character
character = scene.getCharacter('ChrBrad')
# run this controller in position 20 in the controller stack
character.addController(20, myc)

May 13, 2016
1:05 pm
Avatar
Admin
Forum Posts: 52
Member Since:
August 8, 2012
sp_UserOfflineSmall Offline

I tried your script and it works fine. The only thing that needs to be changed is the joint name at "self.setChannelPos('brow01_right',q)" line.

You need to make sure 'brow01_right' joint actually exists in the rig. For example, I used 'JtEyebrow01Rt' for ChrBrad.sk instead. 

Andrew

May 16, 2016
9:36 am
Avatar
Member
Members
Forum Posts: 5
Member Since:
May 5, 2016
sp_UserOfflineSmall Offline

Hi,

Thank you, I know. But how can I get one character's all joints and their corresponding positions in his or her body?

 

Raina

May 25, 2016
3:51 pm
Avatar
Member
Members
Forum Posts: 5
Member Since:
May 5, 2016
sp_UserOfflineSmall Offline

Hi,

Ari Shapiro said
You can set the data in that way, but that assumes that the joints in your data set match perfectly against the joints on the skeleton in SmartBody. If they are the same, then, yes, that will work. If they are different, you will need to do some kind of facial retargeting to put them on the SmartBody character. That retargetting will do something like:

1) Identify the matching points between the data and the SmartBody face

2) Translate data from the file to the SmartBody face (i.e. in data file, left eyebrow went up 50%, so lift the left eyebrow on the SmartBody face by 50%)

 

Ari  

How can I set the changes by percentage is it related to the scale of the character's face? How can I get the original position of the character's face skeleton's positions?

Thank you very much!

Best,

Raina

May 25, 2016
6:38 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

There is an SBJoint object where you can query the position of the joints/bones. 

c = scene.getCharacter("mycharacter")
sk = c.getSkeleton()

j = sk.getJointByName("left_eyeball")

 

Ari

May 26, 2016
8:38 am
Avatar
Member
Members
Forum Posts: 5
Member Since:
May 5, 2016
sp_UserOfflineSmall Offline

Ari Shapiro said
There is an SBJoint object where you can query the position of the joints/bones. 

<br /> <br /> c = scene.getCharacter("mycharacter")<br /> sk = c.getSkeleton()<br /> <br /> j = sk.getJointByName("left_eyeball")<br />

 

Ari  

Hi, I did this, but I got different values for one joint. What does the value mean?

~ ad = bradSkeleton.getJointByName("JtEyebrow01Lf")
~ print ad
<SmartBody.SBJoint object at 0x178109D0>

~ ad = bradSkeleton.getJointByName("JtEyebrow01Lf")
~ print ad
<SmartBody.SBJoint object at 0x17810A08>

~ ac = bradSkeleton.getJointByName("JtEyebrow01Rt")
~ print ac
<SmartBody.SBJoint object at 0x178109D0>

~ ac = bradSkeleton.getJointByName("JtEyebrow01Rt")
~ print ac
<SmartBody.SBJoint object at 0x17810AB0>

 

Thank you.

src=
May 31, 2016
4:00 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

You have the joint object, and now you can query information from it:

 

getName
getParent
getNumChildren
getChild
getSkeleton
getOffset
getIndex
getPosition
getQuat
getMatrixGlobal
getMatrixLocal
getUseRotation
isUsePosition
getMass
getPrerotation
getPostrotation
getJointType

You can get a list of all the Python functions in SmartBody from sbgui if you run Help->Create Python API which will output a bunch of HTML pages with the entire API.

 

Ari

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 733

Currently Online: anton.1988dmon, hastingswiggins7, MyraRoberso52, Nasreen Zamir, jeff345qs, ledretrofitlights, subduedcorps4964, JaimePatrick54, Herbertnes, OliveSantos53
59 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

jwwalker: 80

jyambao: 51

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 67

Members: 55092

Moderators: 3

Admins: 4

Forum Stats:

Groups: 1

Forums: 5

Topics: 429

Posts: 2348