Search Results

Search found 2528 results on 102 pages for 'animation'.

Page 17/102 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • How do you deal with transitions in animating walking?

    - by Aerovistae
    I'm pretty new to this whole animating models thing. Just learning the ropes. I got a nice walking animation going, which I can loop while a character is walking, but what about when they stop walking? I mean, they could be at any point in the animation at the time the player stops walking. How do I get them to smoothly return to a standing still position without having them snap into that position? The same goes for starting walking from a standing still position. Do you need a separate animation? How is this dealt with?

    Read the article

  • Android: how to hide and then show View with animation effect?

    - by tomash
    I have similar question like this one: http://stackoverflow.com/questions/2079074/update-layout-with-the-animation Basically: I have one vertical LinearLayout View with edittext, button and then list. I'd like to hide exittext after pressing button to make more space for list (button will go up). On second press edittext should be visible again. Edittext and button have "wrap_content" height. I'd like to hide and show edittext with animation. I succeeded to animate hiding by overloading Animation's applyTransformation: final float edittextheight= edittext.getHeight(); [....] @Override protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); android.view.ViewGroup.LayoutParams lp = edittext.getLayoutParams(); lp.height = (int)(edittextheight*(1.0-interpolatedTime)); edittext.setLayoutParams(lp); } Problem: I don't know how to calculate height to animate showing - edittext.getHeight(); returns 0 when widget is hidden and in layout definition I'm using "wrap_content". Help?

    Read the article

  • Cocos2D SpriteSheet animation problem, my number of frames is much larger.

    - by vaibhav-tekam
    Hello, I am trying to use SpriteSheet to run an animation. My frames are of 320x480 in size each, So I am able to put max 6 frames on the texture image. But my animation consists of frame number ranging from 50 to 200 sometimes, and all are of size 320x480. But this much number of frames cannot be added on the Texture image as the size is restricted to 1024x1024. Is there any other approach I can try out. Can I play one animation after the other.And won't it be hampering the performance. Please, I need suggestions. Best, Vaibhav Tekam.

    Read the article

  • How to transform (rotate) a already exist CALayer/animation?

    - by Flocked
    Hello, I have added a CALayer to the UIView of my app: CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:0.35]; [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; animation.type = @"pageCurl"; animation.fillMode = kCAFillModeForwards; animation.endProgress = 0.58; [animation setRemovedOnCompletion:NO]; [[self.view layer] addAnimation:animation forKey:@"pageCurlAnimation"]; Now when the user rotates the device, the layer always stays in the same position on the screen (in line to the homescreen button). Is it possible to rotate the animation/layer? I tried self.view.layer.transform = CGAffineTransformMakeRotation (angle); but this code just rotates the UIView and not the animation/layer I set.

    Read the article

  • Browser performance when combining image resizing with animated movement

    - by Steve Reichgut
    I have been tasked with the job of converting a Flash animation into HTML. The animation is rather complex and requires the need to move multiple images (9) from location (x,y) to location (x2,y2) while simultaneously increasing the image size from 215px wide to 930px wide. While doing some initial testing of this animation with just 1-2 images, I noticed a lot of choppiness in FF handling of this animation. To try and isolate the problem, I removed the dynamic resizing of the animation and just moved it from point A to point B. What was interesting was that I saw the same behavior when simply moving a 930px image that was resized down to 215px (via the CSS width or inline width properties). When I try the same animation with a different image that is actually 215px wide, it performed smoothly. I then tried the same animation with the original 930px wide image (with no resizing) and it performed well also. This makes me wonder if the browser is having to "resize" the image down to 215px each time it is moved which is causing the choppiness. Is this a correct assumption? If so, is there any other way to optimize the animation to allow for simultaneous image resizing and image movement? Notes: 1) One optimization I have done is to position the images absolutely in order to minimize the reflow process. 2) I have tested the animation using both jQuery and the fX animation framework.

    Read the article

  • How to render consistence and smooth moving animation on iphone / ipod / iphone simulator.

    - by shakthi
    I am trying render a simple animation(object movement animations) on iphone. I used opengl for object rendering. Movements appears to be smooth on the simulator. But if I used same code in the ipod, object movement is slower. In the iphone it is still slower. I googled a bit and found 'frame rate independent rendering method', which taught me the concept of 'time interval' and object movement based on it. However result is very unpleasant. There is a lot of jerk in the animation even when fps remains above 20. Following code fragment is used for calculation of time interval between successive frames and I am using that to move my animation. NSTimeInterval GetTimeIntervals(NSTimeInterval * inLastElapsedTime ) { NSTimeInterval intervalTime = 0; NSTimeInterval currentTime = [NSDate timeIntervalSinceReferenceDate]; if(*inLastElapsedTime != 0 ) { intervalTime = currentTime - *inLastElapsedTime; } *inLastElapsedTime = currentTime; return intervalTime; }

    Read the article

  • How do I trigger a closing animation for a WPF ContextMenu?

    - by Ashley Davis
    Does anyone know if it is possible to trigger an animation when a WPF ContextMenu closes? I have code that triggers an animation when the ContextMenu is opened. The animation makes the context menu fade into view. I also want an animation when the ContextMenu is closed that makes it fade out. The code that starts the opened fade-in animation looks something like this: var animation = new DoubleAnimation(); animation.From = 0; animation.To = 1; animation.Duration = TimeSpan.FromSeconds(0.2); animation.Freeze(); menu.BeginAnimation(ContextMenu.OpacityProperty, animation); The fade-in animation also runs on sub-menu items. Note that I also want to run other animations besides fade in and fade out. Eg I want the context menu to scale up from nothing so that it sort of 'bounces' into view.

    Read the article

  • Weird Animation when inserting a row in UITableView

    - by svveet
    I have tableview which holds a list of data, when users press "Edit" i add an extra row at the bottom saying "add new" - (void)setEditing:(BOOL)editing animated:(BOOL)animated { [super setEditing:editing animated:animated]; NSArray *paths = [NSArray arrayWithObject: [NSIndexPath indexPathForRow:1 inSection:0]]; if (editing) { [[self tableView] insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationTop]; } else { [[self tableView] deleteRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationTop]; } } and of course the UITableView transform with animation, but weird thing is the row before the row that i just added, has different animation than all others. all rows perform "slides in" animation, but that 2nd last one did a "fade in" animation. and i didnt set any animation on the 2nd last row (or any other row), and if i didnt add the new row in, the animation slides in as normal when i switch to editing mode. somehow i cant find an answer, i check with contact app on my phone, it didnt have that weird animation as i have, when they adding a new row on editing mode. Any help would be appreciated. Thanks

    Read the article

  • Adobe edge animation fails to load first time in Opera, Crome but works in Firefox and Safari

    - by user3721777
    I have quite a serous problem here since I work on this animation for a while, I have a Adobe Edge Animation (done in CC) that fails to load the first time in Opera and Crome but does work in Firefox and Safari. It fail to load every time coming from another page. Only work if you reload. The problem persist both locally and online. It does work in preview every single time. I you can push me in the right direction, that would be great. Thanks! Here you can see the animation: http://tierraburritos.com/test/laCarta.html

    Read the article

  • Website displays in chrome perfectly, but not in mozilla or IE

    - by Atharul Khan
    here are the code snippets for the html and css. It works finds in Google chrome, but when I try to display it in mozilla or IE, it shows something completely different. I cannot attach images as I do not have the required reputation. I really appreciate the help. Thank you! HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="shortcut icon" href="ak.png"> <title>Home</title> </head> <body> <div class="Nav"> <nav> <ul class="navigation fade-in2"> <li><a href="#home">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#portfolio">Portfolio</a></li> <li><a href="#shop">Shop</a></li> <li><a href="#blog">Blog</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav> </div> <div class="logo"><a href="#home"><img class="ak fade-in2" src="ak.png"></a></div> <div class="background"><img class="beauty" src="beauty.jpg"></div> <div class="header"> <h1 class="headerName fade-in">DESIGN | DEVELOP | BRAND</h1> <h4 class="service fade-in3"><a href="#portfolio">VIEW PORTFOLIO</a></h4> <h4 class="service fade-in3"><a href="#services">VIEW SERVICES</a></h4> </div> <!--<div class="mainbody"><p>safsdaf</p></div>--> </body> </html> CSS @-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } } @-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } } @keyframes fadeIn { from { opacity:0; } to { opacity:1; } } * { padding: 0; margin: 0; } li { display: inline; font-size: 15px; font-family: verdana; } nav { width: 100%; text-align: right; background-color: #222222; padding: 0; margin: 0px; line-height: 47px; position: fixed; z-index: 100; } .ak{ width: 90px; height: 55px; z-index: 101; position: fixed; background: transparent; color: transparent; background-color: transparent; } .Nav a{ text-decoration: none; padding: 15px; } .Nav a:link{ color: #A7A7A7; } .Nav a:visited{ color: #A7A7A7; } .Nav a:hover{ color: #DBDBDB; transition: all 0.3s ease-out 0s; transition-property: all; transition-duration: 0.3s; transition-timing-function: ease-out; transition-delay: 0s; } .header { background-color: rgba(0,0,0, 0.25); width: 100%; height: 626px; text-align: center; position: fixed; z-index: 10; } .background { position: fixed; z-index: 8; } .beauty { width: 100%; height: 626px; } .headerName { font-size: 2.5em; text-align: center; color: #D3D3D3; padding: 180px; padding-bottom: 50px; margin: 0px; letter-spacing: 4px; font-weight: 100; font-family: 'Lato', sans-serif; } .fade-in { opacity:0; /* make things invisible upon start */ -webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time */ -moz-animation:fadeIn ease-in 1; animation:fadeIn ease-in 1; -webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/ -moz-animation-fill-mode:forwards; animation-fill-mode:forwards; -webkit-animation-duration:1s; -moz-animation-duration:1s; animation-duration:1s; -webkit-animation-delay: 0.3s; -moz-animation-delay:0.3s; animation-delay: 0.3s; } .fade-in2 { opacity:0; /* make things invisible upon start */ -webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time */ -moz-animation:fadeIn ease-in 1; animation:fadeIn ease-in 1; -webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/ -moz-animation-fill-mode:forwards; animation-fill-mode:forwards; -webkit-animation-duration:1s; -moz-animation-duration:1s; animation-duration:1s; -webkit-animation-delay: 0.6s; -moz-animation-delay:0.6s; animation-delay: 0.6s; } .fade-in3 { opacity:0; /* make things invisible upon start */ -webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animation ease-in and repeat it only 1 time */ -moz-animation:fadeIn ease-in 1; animation:fadeIn ease-in 1; -webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/ -moz-animation-fill-mode:forwards; animation-fill-mode:forwards; -webkit-animation-duration:1s; -moz-animation-duration:1s; animation-duration:1s; -webkit-animation-delay: 0.9s; -moz-animation-delay:0.9s; animation-delay: 0.9s; } .service{ font-size: 14px; width: 190px; text-align: center; font-family: 'Lato', sans-serif; color: #D3D3D3; border: 2px #A7A7A7 solid; border-color: rgba(255, 255, 255, 0.5); display: inline-block; border-radius: 5px; background-color: transparent; letter-spacing: 2px; } .service a{ text-decoration: none; display: block; padding: 15px 20px; } .service a:link{ color: #D3D3D3; } .service a:visited{ color: #D3D3D3; } .service a:hover{ background-color: rgba(255, 255, 255, 0.15); transition: background-color .15s ease-in; -webkit-transition: background-color .15s ease-in; -moz-transition: background-color .15s ease-in; -o-transition: background-color .15s ease-in; } UPDATE 1: I updated both browsers and it seems the css3 animations work perfectly fine on both browsers. What seems to be the problem is the positioning of the pages UPDATE 2: Here are the links to the different browser screen shots Chrome: https://www.dropbox.com/s/jlpa4vu51kdnews/Chrome.JPG InternetExplorer: https://www.dropbox.com/s/zbchs3su9ahxr0n/IE.JPG Mozilla Firefox: dropbox(.)com/s/fyalnhsha9ktadz/Mozilla.JPG (I can't post the third link because I don't have enough reputation)

    Read the article

  • libgdx draw issue and animation

    - by johnny-b
    it seems as though i cannot get the draw method to work??? it seems as though the bullet.draw(batcher) does not work and i cannot understand why as the bullet is a sprite. i have made a Sprite[] and added them as animation. could that be it? i tried batcher.draw(AssetLoader.bulletAnimation.getKeyFrame(runTime), bullet.getX(), bullet.getY(), bullet.getOriginX() / 2, bullet.getOriginY() / 2, bullet.getWidth(), bullet.getHeight(), 1, 1, bullet.getRotation()); but that dont work, the only way it draws is this batcher.draw(AssetLoader.bulletAnimation.getKeyFrame(runTime), bullet.getX(), bullet.getY()); below is the code. // this is in a Asset Class texture = new Texture(Gdx.files.internal("SpriteN1.png")); texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); bullet1 = new Sprite(texture, 380, 350, 45, 20); bullet1.flip(false, true); bullet2 = new Sprite(texture, 425, 350, 45, 20); bullet2.flip(false, true); Sprite[] bullets = { bullet1, bullet2 }; bulletAnimation = new Animation(0.06f, bullets); bulletAnimation.setPlayMode(Animation.PlayMode.LOOP); // this is the GameRender class public class GameRender() { private Bullet bullet; private Ball ball; public GameRenderer(GameWorld world) { myWorld = world; cam = new OrthographicCamera(); cam.setToOrtho(true, 480, 320); batcher = new SpriteBatch(); // Attach batcher to camera batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); // Call helper methods to initialize instance variables initGameObjects(); initAssets(); } private void initGameObjects() { ball = GameWorld.getBall(); bullet = myWorld.getBullet(); scroller = myWorld.getScroller(); } private void initAssets() { ballAnimation = AssetLoader.ballAnimation; bulletAnimation = AssetLoader.bulletAnimation; } public void render(float runTime) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); batcher.begin(); // Disable transparency // This is good for performance when drawing images that do not require // transparency. batcher.disableBlending(); // The ball needs transparency, so we enable that again. batcher.enableBlending(); batcher.draw(AssetLoader.ballAnimation.getKeyFrame(runTime), ball.getX(), ball.getY(), ball.getWidth(), ball.getHeight()); batcher.draw(AssetLoader.bulletAnimation.getKeyFrame(runTime), bullet.getX(), bullet.getY()); // End SpriteBatch batcher.end(); } } // this is the gameworld class public class GameWorld { public static Ball ball; private Bullet bullet; private ScrollHandler scroller; public GameWorld() { ball = new Ball(480, 273, 32, 32); bullet = new Bullet(10, 10); scroller = new ScrollHandler(0); } public void update(float delta) { ball.update(delta); bullet.update(delta); scroller.update(delta); } public static Ball getBall() { return ball; } public ScrollHandler getScroller() { return scroller; } public Bullet getBullet() { return bullet; } } is there anyway so make the sprite work?

    Read the article

  • Flash like animation editing and container format for OpenGL environment?

    - by tbarbe
    Are there ANY tools that lets an animator / designer create scripted animations that can export to an OpenGL compatible format -- that are similar to the timeline editing in Flash or After Effects? Does OpenGL ES have some kind of animation playback or container format? ( is there something similar to .swf for OpenGL? ) Im looking for something that lets a designer / animator do his work with a timeline and in a traditional animation environment... meanwhile still having integration with OpenGL.

    Read the article

  • Is Core Animation causing my subviews to call -drawRect for every single frame?

    - by mystify
    I made a nice UIView subclass which paints all its stuff in -drawRect:, because people said that's good. That view is a subview of another. This another view is beeing animated with Core Animation: It's scaled down, rotated and moved. However, I encountered this: -drawRect seems to get called trillion of times during animation, and performance sucks. Is that normal or did I do something wrong, probably?

    Read the article

  • Fastest approach to 3D animation

    - by HappyFerret
    I'm currently tasked with designing a small HTML5 game. Having done everything by myself so far (3D models, codebase, game design, etc) I'm now at a point where I'm running out of time. I've less than a day to animate and bind everything together. However, that's exactly my problem. I was under the naive impression that everything would be easier if I went with pre-rendered 3D models. However, I didn't consider the most difficult part. Animation. After having spent over an hour trying to figure out messiahStudio, I figured it's time to ask for outside help. Is there any easier solution to 3D animation than 3D rigging? What I'm basically looking for is some sort of tool that allows me to simply grab and move/deform select polygons. It doesn't have to be as life-like and accurate as rigging, just efficient enough. Were the circumstances any different, I might just learn how to rig. But that's sorely out of scope right now. PS:The models were created in Sculptris but are fairly low-poly.

    Read the article

  • Keyboard Animation Issues When Calling becomeFirstResponder within a Modal View Controller

    - by LucasTizma
    I've been having some issues with calling -becomeFirstResponder on a UITextField contained with a view controller that is presented modally. I call this method in the modal view controller's -viewDidLoad method so that the keyboard is immediately displayed. What I expected is for both the keyboard and the modal view controller to animate from up the bottom of the screen at the same time. However, what I'm observing is the following: There is a ~0.2 second UI lag between clicking the button that calls the -presentModalViewController:animated: method on the parent view controller and when the child view controller begins to animate modally. The keyboard is immediately presented with absolutely no animation about half-way through the modal view controller's animation. Once the modal view controller's animation is complete, everything else seems to operate smoothly. Dismissing the modal view controller results in it being smoothly animated off screen (along with the keyboard, coincidentally). It's as if the keyboard's animation and the modal view controller's animation are both competing for some lower-level Core Animation resource at the same time, but I don't see why this should be happening. What further seems to corroborate this hunch is if I don't ask the UITextField to become the first responder (i.e., if I don't ask the keyboard to present itself), then there is absolutely no UI lag, and the modal view controller animates instantly. Interestingly, if I do something like [self.textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0001]; then the animation of the keyboard happens nearly at the same time as the modal view controller's animation -- it's extremely difficult to tell that they aren't both being animated at the exact same time. Furthermore, there's no more UI lag. Has anyone experienced anything similar to this?

    Read the article

  • I would like to flip my app's splash screen - how can I mimic the flipside controller's animation?

    - by Andy
    I've finally gotten a working "alpha" version of my first app installed and (mostly) working on my iPhone 3G. So excited I came into the house and danced a little jig while my wife rolled her eyes at me. Don't care - totally stoked that I figured it out on my own (with lots of help here - thanks again, guys). I've never really dabbled with or cared about animation; I'm more into utility-type apps. However, I've decided that I'd like to animate my app's opening image / default.png / splash screen similar to the flipside view controller animation - where the image spins from a view on the front to a different view on the back. I've found code for animating between views using the flipside animation, but how would I go about animating from a static *.png image to my navigation-based table view? I'm just not even sure where to start with this one - literally the first time I've ever even searched for anything graphics-related in the documentation. Any help will be appreciated. As usual, thanks in advance!

    Read the article

  • SVG Animation in Python? - Any options other than Things! 0.4?

    - by ThantiK
    I recently gave my daughter some time on the computer, and she really likes a program called 'BabySmash!', and I also have another program that came with a keyboard attachment called 'Laugh, Smile & Learn' from playschool I think. I'm not a python guru by any stretch of the imagination and I kind of have it in my head that I want to create some sort of program in the spirit of these two, with vector animation and sounds. Thing is, it doesn't look like there are many options for vector animation in python. I found a library called Things! 0.4, but it's lacking in-depth documentation and seems to be more of an experiment in vector animation rather than a full blown solution. Are there any options that I'm not immediately finding? What other animation-libraries do you recommend? Even if the library isn't vector-based, ease of use is probably the strongest factor in my use.

    Read the article

  • Exporting 3DS Max animated biped character into Assimp

    - by Doug Kavendek
    I've been having some trouble with MD5 meshes exported from 3DS Max into my C++ program, using Assimp to import the model and its skeletal animation. If the models were rigged manually with bones, the export and animations work perfectly, but if they were rigged as a biped character, the animation hits a "deadly import error" and all the bones appear to get smooshed together into a big pile. This seems like it might just be a limitation of the MD5 exporter (we're currently using the one found here. Our plan is to try out a different MD5 exporter (this one), and if that still has problems, then try switching from MD5 to COLLADA. Our modeler won't be able to make time to try out these other exporters for a few days, so in the meantime I wanted to see if there were any better methods out there for getting biped rigged models from 3DS Max into our app via Assimp. Out of Assimp's supported formats, I need to figure out which will support the following: Skeletal animations Exportable from 3DS Max biped rigged models Failing that, an alternative would be a way to convert a biped character to its corresponding bones before exporting. We did find one script to do that, but it only seems meant as a starting point for modeling -- it doesn't carry over any hierarchy, skinning, or animation -- so it can't be used solely during export.

    Read the article

  • exporting bind and keyframe bone poses from blender to use in OpenGL

    - by SaldaVonSchwartz
    I'm having a hard time trying to understand how exactly Blender's concept of bone transforms maps to the usual math of skinning (which I'm implementing in an OpenGL-based engine of sorts). Or I'm missing out something in the math.. It's gonna be long, but here's as much background as I can think of. First, a few notes and assumptions: I'm using column-major order and multiply from right to left. So for instance, vertex v transformed by matrix A and then further transformed by matrix B would be: v' = BAv. This also means whenever I export a matrix from blender through python, I export it (in text format) in 4 lines, each representing a column. This is so I can then I can read them back into my engine like this: if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[0], &skeleton.joints[currentJointIndex].inverseBindTransform.m[1], &skeleton.joints[currentJointIndex].inverseBindTransform.m[2], &skeleton.joints[currentJointIndex].inverseBindTransform.m[3])) { if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[4], &skeleton.joints[currentJointIndex].inverseBindTransform.m[5], &skeleton.joints[currentJointIndex].inverseBindTransform.m[6], &skeleton.joints[currentJointIndex].inverseBindTransform.m[7])) { if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[8], &skeleton.joints[currentJointIndex].inverseBindTransform.m[9], &skeleton.joints[currentJointIndex].inverseBindTransform.m[10], &skeleton.joints[currentJointIndex].inverseBindTransform.m[11])) { if (fscanf(fileHandle, "%f %f %f %f", &skeleton.joints[currentJointIndex].inverseBindTransform.m[12], &skeleton.joints[currentJointIndex].inverseBindTransform.m[13], &skeleton.joints[currentJointIndex].inverseBindTransform.m[14], &skeleton.joints[currentJointIndex].inverseBindTransform.m[15])) { I'm simplifying the code I show because otherwise it would make things unnecessarily harder (in the context of my question) to explain / follow. Please refrain from making remarks related to optimizations. This is not final code. Having said that, if I understand correctly, the basic idea of skinning/animation is: I have a a mesh made up of vertices I have the mesh model-world transform W I have my joints, which are really just transforms from each joint's space to its parent's space. I'll call these transforms Bj meaning matrix which takes from joint j's bind pose to joint j-1's bind pose. For each of these, I actually import their inverse to the engine, Bj^-1. I have keyframes each containing a set of current poses Cj for each joint J. These are initially imported to my engine in TQS format but after (S)LERPING them I compose them into Cj matrices which are equivalent to the Bjs (not the Bj^-1 ones) only that for the current spacial configurations of each joint at that frame. Given the above, the "skeletal animation algorithm is" On each frame: check how much time has elpased and compute the resulting current time in the animation, from 0 meaning frame 0 to 1, meaning the end of the animation. (Oh and I'm looping forever so the time is mod(total duration)) for each joint: 1 -calculate its world inverse bind pose, that is Bj_w^-1 = Bj^-1 Bj-1^-1 ... B0^-1 2 -use the current animation time to LERP the componets of the TQS and come up with an interpolated current pose matrix Cj which should transform from the joints current configuration space to world space. Similar to what I did to get the world version of the inverse bind poses, I come up with the joint's world current pose, Cj_w = C0 C1 ... Cj 3 -now that I have world versions of Bj and Cj, I store this joint's world- skinning matrix K_wj = Cj_w Bj_w^-1. The above is roughly implemented like so: - (void)update:(NSTimeInterval)elapsedTime { static double time = 0; time = fmod((time + elapsedTime),1.); uint16_t LERPKeyframeNumber = 60 * time; uint16_t lkeyframeNumber = 0; uint16_t lkeyframeIndex = 0; uint16_t rkeyframeNumber = 0; uint16_t rkeyframeIndex = 0; for (int i = 0; i < aClip.keyframesCount; i++) { uint16_t keyframeNumber = aClip.keyframes[i].number; if (keyframeNumber <= LERPKeyframeNumber) { lkeyframeIndex = i; lkeyframeNumber = keyframeNumber; } else { rkeyframeIndex = i; rkeyframeNumber = keyframeNumber; break; } } double lTime = lkeyframeNumber / 60.; double rTime = rkeyframeNumber / 60.; double blendFactor = (time - lTime) / (rTime - lTime); GLKMatrix4 bindPosePalette[aSkeleton.jointsCount]; GLKMatrix4 currentPosePalette[aSkeleton.jointsCount]; for (int i = 0; i < aSkeleton.jointsCount; i++) { F3DETQSType& lPose = aClip.keyframes[lkeyframeIndex].skeletonPose.jointPoses[i]; F3DETQSType& rPose = aClip.keyframes[rkeyframeIndex].skeletonPose.jointPoses[i]; GLKVector3 LERPTranslation = GLKVector3Lerp(lPose.t, rPose.t, blendFactor); GLKQuaternion SLERPRotation = GLKQuaternionSlerp(lPose.q, rPose.q, blendFactor); GLKVector3 LERPScaling = GLKVector3Lerp(lPose.s, rPose.s, blendFactor); GLKMatrix4 currentTransform = GLKMatrix4MakeWithQuaternion(SLERPRotation); currentTransform = GLKMatrix4Multiply(currentTransform, GLKMatrix4MakeTranslation(LERPTranslation.x, LERPTranslation.y, LERPTranslation.z)); currentTransform = GLKMatrix4Multiply(currentTransform, GLKMatrix4MakeScale(LERPScaling.x, LERPScaling.y, LERPScaling.z)); if (aSkeleton.joints[i].parentIndex == -1) { bindPosePalette[i] = aSkeleton.joints[i].inverseBindTransform; currentPosePalette[i] = currentTransform; } else { bindPosePalette[i] = GLKMatrix4Multiply(aSkeleton.joints[i].inverseBindTransform, bindPosePalette[aSkeleton.joints[i].parentIndex]); currentPosePalette[i] = GLKMatrix4Multiply(currentPosePalette[aSkeleton.joints[i].parentIndex], currentTransform); } aSkeleton.skinningPalette[i] = GLKMatrix4Multiply(currentPosePalette[i], bindPosePalette[i]); } } At this point, I should have my skinning palette. So on each frame in my vertex shader, I do: uniform mat4 modelMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix; uniform mat4 skinningPalette[6]; attribute vec4 position; attribute vec3 normal; attribute vec2 tCoordinates; attribute vec4 jointsWeights; attribute vec4 jointsIndices; varying highp vec2 tCoordinatesVarying; varying highp float lIntensity; void main() { vec3 eyeNormal = normalize(normalMatrix * normal); vec3 lightPosition = vec3(0., 0., 2.); lIntensity = max(0.0, dot(eyeNormal, normalize(lightPosition))); tCoordinatesVarying = tCoordinates; vec4 skinnedVertexPosition = vec4(0.); for (int i = 0; i < 4; i++) { skinnedVertexPosition += jointsWeights[i] * skinningPalette[int(jointsIndices[i])] * position; } gl_Position = projectionMatrix * modelMatrix * skinnedVertexPosition; } The result: The mesh parts that are supposed to animate do animate and follow the expected motion, however, the rotations are messed up in terms of orientations. That is, the mesh is not translated somewhere else or scaled in any way, but the orientations of rotations seem to be off. So a few observations: In the above shader notice I actually did not multiply the vertices by the mesh modelMatrix (the one which would take them to model or world or global space, whichever you prefer, since there is no parent to the mesh itself other than "the world") until after skinning. This is contrary to what I implied in the theory: if my skinning matrix takes vertices from model to joint and back to model space, I'd think the vertices should already be premultiplied by the mesh transform. But if I do so, I just get a black screen. As far as exporting the joints from Blender, my python script exports for each armature bone in bind pose, it's matrix in this way: def DFSJointTraversal(file, skeleton, jointList): for joint in jointList: poseJoint = skeleton.pose.bones[joint.name] jointTransform = poseJoint.matrix.inverted() file.write('Joint ' + joint.name + ' Transform {\n') for col in jointTransform.col: file.write('{:9f} {:9f} {:9f} {:9f}\n'.format(col[0], col[1], col[2], col[3])) DFSJointTraversal(file, skeleton, joint.children) file.write('}\n') And for current / keyframe poses (assuming I'm in the right keyframe): def exportAnimations(filepath): # Only one skeleton per scene objList = [object for object in bpy.context.scene.objects if object.type == 'ARMATURE'] if len(objList) == 0: return elif len(objList) > 1: return #raise exception? dialog box? skeleton = objList[0] jointNames = [bone.name for bone in skeleton.data.bones] for action in bpy.data.actions: # One animation clip per action in Blender, named as the action animationClipFilePath = filepath[0 : filepath.rindex('/') + 1] + action.name + ".aClip" file = open(animationClipFilePath, 'w') file.write('target skeleton: ' + skeleton.name + '\n') file.write('joints count: {:d}'.format(len(jointNames)) + '\n') skeleton.animation_data.action = action keyframeNum = max([len(fcurve.keyframe_points) for fcurve in action.fcurves]) keyframes = [] for fcurve in action.fcurves: for keyframe in fcurve.keyframe_points: keyframes.append(keyframe.co[0]) keyframes = set(keyframes) keyframes = [kf for kf in keyframes] keyframes.sort() file.write('keyframes count: {:d}'.format(len(keyframes)) + '\n') for kfIndex in keyframes: bpy.context.scene.frame_set(kfIndex) file.write('keyframe: {:d}\n'.format(int(kfIndex))) for i in range(0, len(skeleton.data.bones)): file.write('joint: {:d}\n'.format(i)) joint = skeleton.pose.bones[i] jointCurrentPoseTransform = joint.matrix translationV = jointCurrentPoseTransform.to_translation() rotationQ = jointCurrentPoseTransform.to_3x3().to_quaternion() scaleV = jointCurrentPoseTransform.to_scale() file.write('T {:9f} {:9f} {:9f}\n'.format(translationV[0], translationV[1], translationV[2])) file.write('Q {:9f} {:9f} {:9f} {:9f}\n'.format(rotationQ[1], rotationQ[2], rotationQ[3], rotationQ[0])) file.write('S {:9f} {:9f} {:9f}\n'.format(scaleV[0], scaleV[1], scaleV[2])) file.write('\n') file.close() Which I believe follow the theory explained at the beginning of my question. But then I checked out Blender's directX .x exporter for reference.. and what threw me off was that in the .x script they are exporting bind poses like so (transcribed using the same variable names I used so you can compare): if joint.parent: jointTransform = poseJoint.parent.matrix.inverted() else: jointTransform = Matrix() jointTransform *= poseJoint.matrix and exporting current keyframe poses like this: if joint.parent: jointCurrentPoseTransform = joint.parent.matrix.inverted() else: jointCurrentPoseTransform = Matrix() jointCurrentPoseTransform *= joint.matrix why are they using the parent's transform instead of the joint in question's? isn't the join transform assumed to exist in the context of a parent transform since after all it transforms from this joint's space to its parent's? Why are they concatenating in the same order for both bind poses and keyframe poses? If these two are then supposed to be concatenated with each other to cancel out the change of basis? Anyway, any ideas are appreciated.

    Read the article

  • How to Best Optimize up Model Transforms, Import 3DS Animations Into XNA 4.0?

    - by Jason R. Mick
    Relative beginner to XNA, but trying to build a multi-purpose (3D) game frameworking in XNA 4. Been using the Reed (O'Reilly) and Cawood/McGee (McGraw Hill) guides. My question is multi-faceted and involves how to most efficiently handle models. I'm using 3DS Max 2010 with kw-Xport to ship out my models as .X files. Solved an early problem by using my depth stencil state. My models are now loading properly (yay!) and I have basic bounding working, I just want to optimize transforming models and get animations working as a next step. My questions on models are: 1. Do you have any suggestions for good resources on exporting 3DS animations to XNA? I've seen some resources on how to handle animations in XNA, but most skimp on basic topics of how to convert multi-animation 3DS files. For example how do I take one big long string of keyframed animations (say running, frame 5-20, climbing frames 25-45, etc.) and turned them into named XNA animations. To my understanding every XNA animation has to have a name, but I haven't seen any tutorials on creating a new named animation from a subset of frames. 2. Is it faster to load a model once and animate/transform that base model on the fly @ draw time, or to load multiple models? My game will have multiple enemies, and I've already seen some lagginess in XNA, so II want to make my code efficient... 3. I've heard people on app hub talking about making custom content processors for models-- what is the benefit of this? Does it speed up transforming or animating the models? If so, can you point me towards any good (model-centric) tutorials? (I've built a custom height map content processor to generate terrain, following Cawood's examples, I'm just a bit confused as to how a model content processor would be implemented.)

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >