Q3D V-2.4 [3D Physics + Skeletal Animation UPDATE]

  • Edit:

    Sorry, I mistook the "Q3D" models as Quake 3 MD3 files for some reason.

    This looks like a great project. Thanks for sharing it with us

  • As i explained, you need to create one of each model at least once, either by swapping to it with change model when the model is finally loaded, or by creating and destroying instances with that model (again the model has to be loaded first, or Q3D will "wait" for the load to finish and it wont initialize in the same way). It's kind of difficult to explain but Q3D models use complex internal pooling, so that things work efficiently if you create and destroy a lot of objects. "Change model" isn't really meant to be used the way you're using it without hiccups, so it makes things a bit more complicated to initialize.

    Normally Q3D expects one model file for each Q3DModel in the scene, so it just initializes everything at the beginning, and as you dynamically load in things that it's never seen before it has to do the setup work on the spot. Since you're basically always changing to things it's never seen before, it has to take that time the first time it sees it. You have to force it to see it earlier to get around that.

  • Understood. I will give this early loading a try. Also I hope you were able to reproduce the error I mentioned above...Thanks!

  • Edit:

    Sorry, I mistook the "Q3D" models as Quake 3 MD3 files for some reason.

    This looks like a great project. Thanks for sharing it with us

    Ah, i can see the confusion

    Q3D loads .obj files and three.js json files, which can be converted to from most common formats. Supporting fbx/etc. internally is a bit of a pain since they're proprietary, and it's not a trivial task to write complicated loaders for these file types. The three.js community has written various tools that do the conversion already anyway, and I think modeling software should be used to handle the conversion anyway, rather than an event sheet. Importing 3D models is always a dirty process in every engine, but i'll do my best to integrate more loaders in the future.

  • Understood. I will give this early loading a try. Also I hope you were able to reproduce the error I mentioned above...Thanks!

    It's late so i'll give it a try another day, thanks for the walk-through though!

  • QuaziGNRLnose, few updates from my side -

    1. I have followed what you said about initialization ( "created model, loaded .js file, destroy on model created" sequence for each .js file) and it worked pretty well without any lags! Though it looked funny just to create and destroy Q3Dobjects in the C2 code, I think it made sense from a threejs perspective...However, a neater way could be to have such stuff abstracted from the user, if possible...Anyway, thanks a lot for that tip.

    2. I also happened to figure out that one of my .js model file was quite big ( something like 5 MB) that was causing the FPS drop...When I optimized this .js model file, I was able to get it working on iPad!

    The js error with switching layouts still remains if I dont take care of that in the C2 code...

  • kmsravindra

    Yea its a bit wonky but its also how you initialize other objects in C2 (even the official plugins).

    When i have the time ill fix that interlayout bug. But as i suggested try making q3d master global and having only one instance instead of having multiple. This will make your application faster, because each Q3D master carries out an expensive initialization step on create/destroy

  • Sure. Thanks!

  • QuaziGNRLnose, When I am use morph animation "DO loop and do ping pong" mode - then I see that the animation once it reaches the last frame momentarily jumps back to first frame ( seen like a flicker) before it starts going back from last frame to first frame. The same DOES NOT happen when I use "DON'T loop and do ping pong". If you want to verify this, you can verify it in the .capx file that I shared with you.

  • where is manual how to use this plugin? i would like to read it before getting it, thank you

  • QuaziGNRLnose, When I am use morph animation "DO loop and do ping pong" mode - then I see that the animation once it reaches the last frame momentarily jumps back to first frame ( seen like a flicker) before it starts going back from last frame to first frame. The same DOES NOT happen when I use "DON'T loop and do ping pong". If you want to verify this, you can verify it in the .capx file that I shared with you.

    strange, i noticed that. I'll fix it. It's due to me only testing with animations that loop cyclically so i didn't notice the issue

    if you want to fix it before the next update it'll be really quick.

    look for the block of code around line 163 in the Q3D Morph Controller Behaviour runtime.js file that looks like this

    				if (a.pingpong){
    				
    					a.t = a.t+a.speed*(dt)
    					if(a.t > Ma.animlen){
    					a.t = Ma.animlen
    					a.speed = a.speed*-1
    					a.pong = -1;
    					}else if( a.t < 0){
    					a.t = 0
    					a.speed = a.speed*-1
    					};
    				
    				}[/code:36xuh9iu]
    
    and change it to this:
    
    [code:36xuh9iu]				if (a.pingpong){
    				
    					a.t = a.t+a.speed*(dt)
    					if(a.t > Ma.animlen-1){
    					a.t = Ma.animlen-1
    					a.speed = a.speed*-1
    					a.pong = -1;
    					}else if( a.t < 0){
    					a.t = 0
    					a.speed = a.speed*-1
    					};
    				
    				}[/code:36xuh9iu]
    
    i had forgotten the "-1" after Ma.animlen
    
    also a suggestion: you could store the multiple animations for the cube in a single file, and use different animation names.
    
    EDIT:
    
    I also think i know why your ipad performance is extra low. Your exported models have skinning/bones information, which they never use. When you export morph targets, you don't need to check skinning/bones/skeletal animation in blender, or else you'll get both morph targets AND bones. Bones are loaded even though they aren't properly used, and they also waste a lot of memory if you're not using them. You don't need to check that stuff if you made your animation using bones, you only need it if you want to actually use the bones with the model in real time, which isn't supported yet in Q3D anyway (it will eventually).
    
    I managed to fix both the bugs you reported so they'll be gone in the next update
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • where is manual how to use this plugin? i would like to read it before getting it, thank you

    I don't have one made yet, as the plugin is still undergoing lots of changes. a manual will likely be out in a few months after physics and skinned animation using bones are implemented.

  • QuaziGNRLnose, thanks a lot. I will change the code as you mentioned in the behavior runtime.js as I am overdue to submit the app to app store. Also thanks for the tips on performance. If any of this performance improvements help it to run smoother on iPad, I want to put "lights on" in my app for that extra effect.

  • I see many people are using this plugin without problem. How about mobile performance with lights? anyone tested it?

  • In addition to the performance suggestions from QuaziGNRLnose in the above posts, here is the summary of performance optimization findings with whatever limited features (and with my limited knowledge of the plugin) I have used so far...These could be helpful to optimize the performance for someone trying build such apps, especially for mobile.

    -----

    • A balancing act : If I create and destroy too many models upfront, then the FPS dips to pretty low rates. Rather, I saw optimized performance, understandably, when I create/destroy a group of them at different times OR you could even consider dynamic loading if the .js model files are very small.
    • Optimization when using morph animations: The morph animations seems to account for major percentage of "kb" in the .js files. So if I try to consolidate many morph animations of the same model with different animation names into a single .js file, then the size of the .js file becomes too large when loading for the first time to cause a enough pause/dip in FPS. Rather a dynamic loading of each small file seemed better from user experience perspective.
    • Beware of Transparent objects : Making a model transparent ( with draw sides of front and back) makes the model appear patchy...probably a threejs limitation but definitely brings the user experience down when this feature is used. I also noticed that having the transparency on, made the performance little bit lower, for valid rendering reasons, ofcourse! With such limitation, the user experience is still a compromise if you want to show transparent objects.
    • Lights on mobile? : With addition of even a single light, the performance on iPad2 ( I haven't tested on other mobile platforms) is pretty low. So need to get rid of all lights if you plan to launch it on iPad2 ( and probably true for many mobile platforms as well!).
    • .js model file size: if the .js file to be loaded is very big ( lets say more than 2Mb or so), then there is quite a good chance that the model will not load on iPad2. So try to have smaller .js model files. Not sure if .obj files are smaller in size and load faster than .js files? If some experts could comment, please welcome.

    ----

    Not sure if its related to performance but I observed that the navigation seemed slightly jittery in iPad in-app browser ( when launched as an app) compared to running the same app on the iPad safari browser when in online preview mode. Again, could be a limitation from Apple to support such stuff...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)