First alpha version released

Started by EgonOlsen, March 03, 2010, 10:33:54 PM

Previous topic - Next topic

EgonOlsen

Works fine in my test case, i.e. the optimization is used when using an IVertexController. Maybe your controller is just that slow? It's easy to slow something down at a crawl on Dalvik...

raft

#16
messages appear, but only the remapping part. here is the relevant part of output:

I/jPCT-AE (  716): OpenGL vendor:     Android
I/jPCT-AE (  716): OpenGL renderer:   Android PixelFlinger 1.0
I/jPCT-AE (  716): OpenGL version:    OpenGL ES-CM 1.0
I/jPCT-AE (  716): OpenGL renderer initialized (using 2 texture stages)
I/jPCT-AE (  716): Remapping 720 animation indices!
I/jPCT-AE (  716): Subobject of object 1/object3 compiled using 720 vertices in 69ms!
I/jPCT-AE (  716): Object 1/object3 compiled to 1 subobjects in 97ms!
I/jPCT-AE (  716): Remapping 348 animation indices!
I/jPCT-AE (  716): Subobject of object 2/object4 compiled using 348 vertices in 34ms!
I/jPCT-AE (  716): Object 2/object4 compiled to 1 subobjects in 48ms!
I/jPCT-AE (  716): Remapping 822 animation indices!
I/jPCT-AE (  716): Subobject of object 3/object5 compiled using 822 vertices in 82ms!
I/jPCT-AE (  716): Object 3/object5 compiled to 1 subobjects in 108ms!
I/jPCT-AE (  716): Remapping 2706 animation indices!
I/jPCT-AE (  716): Subobject of object 4/object6 compiled using 2706 vertices in 264ms!
I/jPCT-AE (  716): Object 4/object6 compiled to 1 subobjects in 365ms!
I/jPCT-AE (  716): Remapping 4416 animation indices!
I/jPCT-AE (  716): Subobject of object 5/object7 compiled using 4416 vertices in 681ms!
I/jPCT-AE (  716): Object 5/object7 compiled to 1 subobjects in 851ms!


i would expect skeletal animation to be slow but not this one. skeletal animation makes many matrix multplications but this one basicly multiplies a vector with a scalar and adds it to mesh vertices. skelatal anim is applied to each mesh vertice but this one is applied to only relevant vertices.

here is the application if you want to see it yourself. center button enables/disables animation

edit: changed controls to enable/disable animation

EgonOlsen

Stupid question...how do i press 0 and 1 on a phone without a real keyboard?

raft

mm, it's not the question but my app which is stupid ::) i will update it to use some other key..

EgonOlsen

#19
The log output makes no sense to me...unless your objects all include Animation instances which aren't used but state that they don't want the cache. I've uploaded an AE version with that has a more detailed logging and that doesn't use the "if" at that stage, so that everything that is dynamic (which this thing obviously is, because the remapping-output is there) will use it. Please give it a try and post the results as well as that part of the log.

raft

this definitely performs better while animating. ~6-7 fps. i must have messed up versions last time. the link is updated (center button enables/disables animation)

here is the log:

I/jPCT-AE (  719): OpenGL vendor:     Android
I/jPCT-AE (  719): OpenGL renderer:   Android PixelFlinger 1.0
I/jPCT-AE (  719): OpenGL version:    OpenGL ES-CM 1.0
I/jPCT-AE (  719): OpenGL renderer initialized (using 2 texture stages)
I/jPCT-AE (  719): Remapping 130 vertex indices!
I/jPCT-AE (  719): Dynamic: true
I/jPCT-AE (  719): Animation: null
I/jPCT-AE (  719): Cache usage: No animation present
I/jPCT-AE (  719): Creating vertex cache (3120 bytes)!
I/jPCT-AE (  719): Subobject of object 1/object3 compiled using 720 vertices in 55ms!
I/jPCT-AE (  719): Object 1/object3 compiled to 1 subobjects in 82ms!
I/jPCT-AE (  719): Remapping 72 vertex indices!
I/jPCT-AE (  719): Dynamic: true
I/jPCT-AE (  719): Animation: null
I/jPCT-AE (  719): Cache usage: No animation present
I/jPCT-AE (  719): Creating vertex cache (1728 bytes)!
I/jPCT-AE (  719): Subobject of object 2/object4 compiled using 348 vertices in 31ms!
I/jPCT-AE (  719): Object 2/object4 compiled to 1 subobjects in 46ms!
I/jPCT-AE (  719): Remapping 184 vertex indices!
I/jPCT-AE (  719): Dynamic: true
I/jPCT-AE (  719): Animation: null
I/jPCT-AE (  719): Cache usage: No animation present
I/jPCT-AE (  719): Creating vertex cache (4416 bytes)!
I/jPCT-AE (  719): Subobject of object 3/object5 compiled using 822 vertices in 66ms!
I/jPCT-AE (  719): Object 3/object5 compiled to 1 subobjects in 94ms!
I/jPCT-AE (  719): Remapping 473 vertex indices!
I/jPCT-AE (  719): Dynamic: true
I/jPCT-AE (  719): Animation: null
I/jPCT-AE (  719): Cache usage: No animation present
I/jPCT-AE (  719): Creating vertex cache (11352 bytes)!
I/jPCT-AE (  719): Subobject of object 4/object6 compiled using 2706 vertices in 197ms!
I/jPCT-AE (  719): Object 4/object6 compiled to 1 subobjects in 285ms!
D/dalvikvm(  619): GC freed 3940 objects / 223760 bytes in 120ms
I/jPCT-AE (  719): Remapping 752 vertex indices!
I/jPCT-AE (  719): Dynamic: true
I/jPCT-AE (  719): Animation: null
I/jPCT-AE (  719): Cache usage: No animation present
I/jPCT-AE (  719): Creating vertex cache (18048 bytes)!
I/jPCT-AE (  719): Subobject of object 5/object7 compiled using 4416 vertices in 415ms!
I/jPCT-AE (  719): Object 5/object7 compiled to 1 subobjects in 582ms!


i dont get what exactly is happening here. you said your optimization depends on leaving unchanged vertices alone. you can know this for built-in mesh animator, but for a vertex controller ? do you compare them with original values ?

EgonOlsen

No, it doesn't leave unchanged vertices alone, it simply changes less vertices by using indexed geometry for rendering. The geometry in jPCT is always indexed, i.e. if a vertex in a mesh is referenced by four triangles, it's only stored once and all triangles just hold an index to that one instance. However, when compiling a mesh this isn't always the case. Depending on the object (and in desktop jPCT depending on the compile()-call, which happens automagically in AE), it may either be compiled to indexed or plain mode (i.e. multiplying a vertex by the number of triangles that uses it). Plain mode is faster on Android (i don't understand why, but anyway...), so it's default. For animations, the most time is spend at the "transfer the changed vertices to the GPU"-stage, which is why plain mode sucks here. However, to use indexed mode for animations, i need some additional data structures...which are one part of the optimization. Those structures consume a little more memory, which is why i made them optional. And in the former version, this wasn't implemented correctly, which is why your test case sucked performance wise.


raft


raft

Quote from: raft
here is the application if you want to see it yourself. center button enables/disables animation

egon, have you run this app on your phone ? it throws an OutOfMemory in G1 ::)

and this is another application with skeletal animation, the ninja demo. it replaces the other one. it has a menu to start/stop animation. it runs ok on G1 with same performance on my emulator. ~30 fps without animation, ~10 fps with animation. i will be glad if you run them and post results..

EgonOlsen

#24
Both work fine on my phone. The head @ ~8fps, the ninja @ ~29/9. The APK for the ninja seems a bit strange as it downloads as S1, but installs as A1 overwriting the head installation!? But you can't start A1 after that from the menu. It says that it isn't installed...strange.

raft

they are exported from same application in Eclipse, only different activities. that's why they install over each other. removing one first before installing other may help launch problem.

yesterday i read something about memory, not sure if it applies to Nexus One or all Andoid devices: as a measure against software piracy, applications are installed on main memory not on SD card. meaning install more apps and have less memory. i guess that may be the reason my friend is getting an OutOfMemory. google announced that behaviour will vanish but god knows when

EgonOlsen

I've updated the AE-jar with a version that includes some micro optimizations for animations. I don't think that it'll increase performance much (if any), but maybe you can test it to see, if i haven't broken anything.

raft

it seems ok. both face and ninja demos worked fine

EgonOlsen

I've uploaded a new jar with much higher initialization performance and 100 times faster calcTextureWrapXXX()-methods. The suckiness of these methods never hurt on the desktop, but it did on AE, so i finally fixed this.

dl.zerocool

#29
Hello !
First of all, thanks for porting jPCT to AE.

I'm studying software engineer at the moment in Switzerland, and I would like to use jPCT-AE inside a school project.
But at moment I'm quite annoyed, I tried by many ways to run the demo (compiled from source) in my nexus one
but I only get a black screen. I tried with a friend spica samsung who's based on 1.5 and I did not success either.

So I decided to rewrite it a little bit to understand how things work and I got stuck in the same place... A black screen at start.
(It does work inside the emulator)

I attached my modified version of your demo.

ps: I know that your demo is just a simple example.
And what you can do with jPCT is really awesome, I take a look at all the lib and it's quite impressive.
It's a pleasure to see JavaDoc use etc.
So thank you ! :P

I'm not saying that you don't know it or something like that, I hope you don't take it bad (I don't explain myself very well in English, excuse me).
But what I would like to say is that all member of a class are set to null if they are pointers to object,
0 if they are primitive types like int,float etc. and all booleans are set to false.
If you do it by yourself, the vm will do twice the work settings all the members to your settings.
exemple  private boolean abool = false;
will be set 2 times, a default to false then false again forced by the =.

I saw that you use floats and arrays in your demo.
I'm not an expert but what I read is that float operations are not well managed by this kind of devices.
-> http://developer.android.com/guide/practices/design/performance.html#avoidfloat

I saw that you are having trouble with animations (low framerate)
I don't know how you register/store all the informations but perhaps hashmaps,
arraylist or linkedlist.
Do a better work than simple arrays, for example to search something in an array if you have not the exact position
you can have a search algorithm in O(n²) which is not great hashmaps will find the information in O(n) or very close too which is really faster.

Here is some tips from android to improve performance : http://developer.android.com/guide/practices/design/performance.html

Of course I'm not saying that you don't know this things, perhaps it will help someone else :)
I was so happy when I found that jPCT was ported ! :P

But well I think I'm doing something wrong so It cannot be displayed on phone.

If someone have a little time to spare in this, thanks in advance !

Best regards.

Here is the DDMS LogCat
03-17 23:05:58.742: ERROR/AndroidRuntime(1125): ERROR: thread attach failed
03-17 23:05:58.932: INFO/jPCT-AE(1065): Loading Texture...
03-17 23:05:58.943: INFO/jPCT-AE(1065): Loading Texture...
03-17 23:05:58.962: INFO/jPCT-AE(1065): Loading Texture...
03-17 23:05:58.983: INFO/jPCT-AE(1065): Loading Texture...
03-17 23:05:58.993: INFO/jPCT-AE(1065): Loading Texture...
03-17 23:05:59.082: INFO/jPCT-AE(1065): Loading Texture...
03-17 23:05:59.162: INFO/jPCT-AE(1065): Adding Lightsource: 0
03-17 23:05:59.162: INFO/jPCT-AE(1065): OpenGL vendor:     Qualcomm
03-17 23:05:59.162: INFO/jPCT-AE(1065): OpenGL renderer:   Adreno
03-17 23:05:59.162: INFO/jPCT-AE(1065): OpenGL version:    OpenGL ES-CM 1.1
03-17 23:05:59.162: INFO/jPCT-AE(1065): OpenGL renderer initialized (using 2 texture stages)
03-17 23:05:59.243: INFO/jPCT-AE(1065): Subobject of object 7/plane compiled using 2400 vertices in 50ms!
03-17 23:05:59.243: INFO/jPCT-AE(1065): Object 7/plane compiled to 1 subobjects in 73ms!
03-17 23:05:59.263: INFO/jPCT-AE(1065): Subobject of object 9/tree1 compiled using 690 vertices in 15ms!
03-17 23:05:59.263: INFO/jPCT-AE(1065): Object 9/tree1 compiled to 1 subobjects in 21ms!
03-17 23:05:59.282: INFO/jPCT-AE(1065): Subobject of object 10/tree2 compiled using 690 vertices in 14ms!
03-17 23:05:59.282: INFO/jPCT-AE(1065): Object 10/tree2 compiled to 1 subobjects in 21ms!
03-17 23:05:59.292: INFO/jPCT-AE(1065): Subobject of object 11/grass compiled using 264 vertices in 7ms!
03-17 23:05:59.292: INFO/jPCT-AE(1065): Object 11/grass compiled to 1 subobjects in 10ms!
03-17 23:05:59.302: INFO/jPCT-AE(1065): Subobject of object 8/rock compiled using 84 vertices in 2ms!
03-17 23:05:59.302: INFO/jPCT-AE(1065): Object 8/rock compiled to 1 subobjects in 3ms!
03-17 23:05:59.602: INFO/ActivityManager(113): Displayed activity com.demo.jpctae/.jpctae: 885 ms (total 885 ms)
03-17 23:06:10.182: INFO/jPCT-AE(1065): Visibility lists disposed!



[attachment deleted by admin]