Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - kiffa

Pages: 1 2 [3] 4 5 ... 14
Support / Screwy Object3D.
« on: October 22, 2013, 02:46:26 pm »
In my racing game, the scene is correct first, but after a minute(driving on the road, arriving the position of about 3/4 length of the road), the scene become screwy(hard to describe the look, seems some objects mix together).

The model are exported as .objs and converted to .sers. All looks fine if importing the .objs into MAYA.

What may be the reason?

Support / Re: How to upload an Object3D?
« on: October 19, 2013, 09:51:58 am »
I called World.compileAllObjects, but seems none VBOs created immediately, log:

Code: [Select]
10-21 15:44:53.330: I/jPCT-AE(2547): Subobject of object 38/3_bar_6 compiled to indexed fixed point data using 2466/1644 vertices in 32ms!
10-21 15:44:53.330: I/jPCT-AE(2547): Object 38/3_bar_6 compiled to 1 subobjects in 38ms!
10-21 15:44:53.330: I/jPCT-AE(2547): Object '3_bar_6' uses one texture set!

And the VBOs are created when rendering, log:

Code: [Select]
10-21 15:44:59.220: I/jPCT-AE(2547): Creating buffers...
10-21 15:44:59.220: I/jPCT-AE(2547): VBO created for object '3_bar_6'
10-21 15:44:59.240: I/jPCT-AE(2547): Stored buffer of type 1 on disk (19728 bytes / _vir_0_1085156536_vertices_ib_.dat)!
10-21 15:44:59.250: I/jPCT-AE(2547): Stored buffer of type 1 on disk (19728 bytes / _vir_0_1085156536_normals_ib_.dat)!
10-21 15:44:59.250: I/jPCT-AE(2547): Stored buffer of type 3 on disk (4932 bytes / _vir_0_1085156536_indices_sb_.dat)!
10-21 15:44:59.270: I/jPCT-AE(2547): Stored buffer of type 1 on disk (13152 bytes / _vir_0_1085156536_multiTextures0_ib_.dat)!

Support / How to upload an Object3D?
« on: October 17, 2013, 04:15:19 am »
I want to load models -> compile -> build -> strip -> upload-> virtualize one by one.

But I don't know how to upload an Object3D(as VBO). Is there a  method like TextureManager.prewarm for Object3D?

Support / Can not clone a striped Object3D
« on: October 17, 2013, 03:34:03 am »
Code: [Select]
Object3D src;;
Object3D obj = src.cloneObject(); // will throw a NullPointerException

Should this behavior be legal?

Support / Re: How to do the runtime texture compression in jPCT-AE?
« on: October 16, 2013, 01:15:58 pm »
Could you support the common texture compression or add interfaces to do the extension by third party, please.

Support / How to do the runtime texture compression in jPCT-AE?
« on: October 16, 2013, 11:37:55 am »
Just like the engine doing for ETC1, I want to support S3TC\DXT... . The textures are stored as .jpg\.png, and will be dynamic compressed to specific format rely to GL-extension in runtime.

Is there any hook\method to do this ?

OK, I can accept that. Another question:

If I don't call shareCompiledData(), will the cloned obj share the VBO with the source obj? Or the engine will create new VBOs for each cloned obj?

Support / Re: How could I decrease the peak of vm memory?
« on: October 12, 2013, 04:53:42 am »
4 largest textures of 512X512, 1 texture of 256X128, plus 10-15 textures of 64X64, and a few(1-3) textures of 128X64.

My scene has about 90000+ vertices.

And my lowest target is the device of 24M-memory limit & Android 2.3.

I can reduce the size of asserts, but I think there are some optimizing methods beyond that such like what you saying above. I will try World.compileAllObjects, thanks.

Support / How could I decrease the peak of vm memory?
« on: October 11, 2013, 02:29:19 pm »
As I know, android used a non-compacting GC before 3.0(!topic/android-developers/7VeEnvcF1CE),  which will not return the vm memory to system for external memory(non-vm-memory) using, but the external memory can be returned to system for vm memory using. For example:

Code: [Select]
// Assuming the memory limit of process is 24M, and the usage of memory of a app now is 1M/2M(vm),  1M/2M(external)
byte [] tmp = new byte[1024*1024*20];  // 21M/22M, 1M/2M
tmp = null;
system.gc();//1M/22M, 1M/2M, there are 22M vm-memory allocated, 1M used, 21M free;
//trying to allocate 3M-external memory will cause an OOM, because the heap don't shrink for external memory.
new Bitmap(xx); //before android 3.0, bitmap alloacate in external memory.

So if I want to avoid OOM, I must control the  peak of vm memory.

I found when loading/uploading asserts(models and textures), the engine will cause a high peak of memory usage, when all things done(after uploading/virtualizing), the peak will drop down much(but the vm memory won't return as saying before). So when I finished 3D-scene, return to 2D view activity(with many bitmaps\external memory), the OOM happens frequently. There is enough memory, but the peak is unreasonable.

Could I decrease the peak of vm memory when loading/uploading assets? For example:

Decreasing the tmp buffer for uploading(for 16-depth bitmap, using short[] instead of int[]);

Converting-uploading-freeing memory of asserts one at a time, instead of converting all -> uploading all -> freeing all

In my test, when using Object3D.shareCompiledData , the usage of memory will decrease for some Object3Ds but increase for another Object3Ds. I don't know if the format of models will affect this(I use 2 formats: .obj and .ser). I got the result by android's log:
Code: [Select]
10-13 18:24:54.970: D/dalvikvm(7816): GC_CONCURRENT freed 700K, 47% free 3582K/6727K, external 5000K/5097K, paused 2ms+2ms
And the decreased\increased memory is external memory.

My code:
Code: [Select]
public static Object3D clone(Object3D src, boolean shareVBO, boolean shareTexture){
    Object3D ret = src.cloneObject();
    return ret;

for(int i = 0; i < num; ++i){
  clone[i] = clone(srcObj, true, true);

I have tried to increase this value(to a rather large value),  but seems useless. :(

Support / Could I release the mesh after uploading it as VBO?
« on: October 10, 2013, 10:58:41 am »
There are some static BackGround Object3Ds in my game which are only used for rendering,  so I think their meshes could be released after uploading.

And my purpose is to free some main memory. I tried Object3D.decoupleMesh(), but got an incorrect result.

Support / How to render a batch of similar object3D effectively?
« on: September 29, 2013, 10:38:32 am »
For example, many trees which share the same mesh and the same texture, but have different translations and rotations and need be checked collision dividually(which means I can collide with only one of these trees and don't affect others).

Now I'm doing this like:
Code: [Select]

Object3D tree;
for(int i = 0; i < treeNum; ++i){
  trees[i] = tree.cloneObject();

But when the treeNum going large, the performance will drop down heavily. Each tree has about 20 tris, there are about 10 - 80 trees on screen.

1, Generally, is this(rendering 10 - 80 objects of 20-tiris ) a problem(with other objects of the scene)?

2, Could I render these trees once(like merging them to one large object3D)but check collision dividually?

In my car-racing game, I need calc the distance between "rear\front" and road. But the result seems incorrect.

The car and road:

 |       |
|                        |
rear               front
----------------------------------------  road

Code: [Select]
    mCar.Translate(0, 50, 0); // move up
    SimpleVector d = new SimpleVector(0, -1, 0);
    float frontHeight = mRoad.calcMinDistance(front, d, 4 * 30);
    float rearHeight = mRoad.calcMinDistance(rear, d, 4 * 30);
    WLog.d("front: " + front);
    WLog.d("rear: " + rear);
    WLog.d("frontHeight: " + frontHeight);
    WLog.d("rearHeight: " + rearHeight);


Code: [Select]
09-15 16:30:56.680: D/Woo3d(4707): frontHeight: 50.03162
09-15 16:30:56.680: D/Woo3d(4707): rearHeight: 1.0E12
09-15 16:30:56.690: D/Woo3d(4707): front: (-2172.8433,50.031296,-1480.5132)
09-15 16:30:56.690: D/Woo3d(4707): rear: (-2172.3599,50.031296,-1543.8423)
09-15 16:30:56.690: D/Woo3d(4707): frontHeight: 50.03162
09-15 16:30:56.690: D/Woo3d(4707): rearHeight: 1.0E12
09-15 16:30:56.710: D/Woo3d(4707): front: (-2172.8623,50.031296,-1477.4586)
09-15 16:30:56.710: D/Woo3d(4707): rear: (-2172.379,50.031296,-1540.7877)
09-15 16:30:56.710: D/Woo3d(4707): frontHeight: 50.03162
09-15 16:30:56.710: D/Woo3d(4707): rearHeight: 50.03162

But there shouldn't be the result of COLLISION_NONE(1.0E12).  What's the possible reason?

Support / Re: Some question about the order of drawing.
« on: September 10, 2013, 11:04:08 am »

So, for opaque objects, the engine doesn't do any rough depth-sorting(front-to-back or back-to-front, like sorting by the distance between obj and camera), right?

And where do you get the information of Mobile GPU?  Do you have personal blog? Please recommend some books\forum\blog\wiki\... to study Graphic\Game technology.

Pages: 1 2 [3] 4 5 ... 14