The MASM Forum

General => The Workshop => Topic started by: Farabi on December 22, 2013, 02:53:38 PM

Title: [Advanced]BVH problems.
Post by: Farabi on December 22, 2013, 02:53:38 PM
I was wondering, why at the bvh file it writen someting like this for the euler angle -2.55 -4.82 -16.27 but on blender the right euler angle value is -5 -16 -1.104 . Anyone experienced with this? I uploaded the bvh parser file. I've recheck the parser many time and all of the loaded value was just fine, I was just wondering why the value at the file is different at the final result value, what am I missed.
Title: Re: [Advanced]BVH problems.
Post by: dedndave on December 22, 2013, 11:06:33 PM
that's a lot of material to read through - lol

maybe you are not reading the correct file offsets - or it could be your bvh file
best i can do without spending a lot of time on it is give you a couple links to check against

http://research.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html (http://research.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/BVH.html)
http://www-scf.usc.edu/~amahajan/mocap/code.html (http://www-scf.usc.edu/~amahajan/mocap/code.html)

that first link has an example bvh file
Title: Re: [Advanced]BVH problems.
Post by: Farabi on December 22, 2013, 11:24:38 PM
Ive checked all the value loaded and Its right. I loaded it based on the file provided it. problem is, the value written on blender is isnot on the file. i might missed some calculation.
Title: Re: [Advanced]BVH problems.
Post by: Farabi on December 22, 2013, 11:29:15 PM
here is how you draw the bvh node


.data

invoke glPushMatrix
invoke glTranslatef,FP4(0.),FP4(1.),FP4(0.)
invoke fBVHDrawNode,addr hm2,0
invoke glPopMatrix


put this on initialization code and call it once

; here is where all node is processed
xor ecx,ecx
loop_frame:
push ecx
invoke fBVHProcessNode,addr hm2,ecx
pop ecx
inc ecx
cmp ecx,hm2.nFrameCount
jl loop_frame


fBVHProcessNode will rotate all the node based on the value given provided on the file, the problem is, the rotation from the file is different than yielded by blender, I must be miss some calculation in there. I opened my old project and found this code and my curiousity suddenly reawaken, if Im not mistaken I've abandon this since 2008.
Title: Re: [Advanced]BVH problems.
Post by: Farabi on December 23, 2013, 02:04:42 AM
https://www.asuswebstorage.com/navigate/s/DF7D1ECB7FFE490F8388A9EA16A52C25Y

I think I done it.
Looks right for me. I never though rotating it from X-Y-Z order is different than -Z-X-Y order. I need to build a matrix following that order.
Title: Re: [Advanced]BVH problems.
Post by: Farabi on December 23, 2013, 08:03:22 PM
Yep it worked. Now I go to the next step, skinning. This should be easier than before. I've been studying this for 3 years but never understand it, after I understood the matrix and how 3D math worked, suddenly I understand everything. Now I've understand everything even I confident i can make a 3D graphic engine from scracth. Maybe if someday I have a programable GPU I will make my own 3D graphic engine. OpenGL is really usefull and easy to understand, I think I understand everything because of using OpenGL. OpenGL is a lowlevel of 3D programming concept.
Title: Re: [Advanced]BVH problems.
Post by: xanatose on December 28, 2013, 03:28:41 PM
Not sure if you are already doing it, but:

Try using quaternions for interpolation.
http://en.wikipedia.org/wiki/Quaternion
http://www.gamasutra.com/view/feature/3278/rotating_objects_using_quaternions.php

This will avoid gimbal locks http://en.wikipedia.org/wiki/Gimbal_lock

Look also for fast quaternion slerp (Sperical Linear Interpolation). They can be quicker than real slerp with no noticeable difference on the outcome.

Title: Re: [Advanced]BVH problems.
Post by: Farabi on December 29, 2013, 04:45:24 PM
I never heard bvh file processed using quaternion. Beside the rotation data is euler angle. But thanks for the link. I just need to do the skinning process.