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 6 ... 14
46
Support / Some question about the order of drawing.
« on: September 10, 2013, 09:43:12 am »
How does jPCT-AE implement the order of drawing(rendering)?   

Dose jPCT-AE use any Occlusion culling?

I need these info to help my  art  partner to design the game scene. For example, one-large-combined-mesh VS small meshes, small textures VS one-large-texture, and so on.

by depth (necessity for accurate draw order / painter's algorithm)
-by program (context changes may be costly!)
--by texture in program (that texture context changes may be costly...)
---by mesh that uses that texture
----by discrete entity transform (every entity using this mesh)


47
Support / Re: texture mismatch
« on: August 28, 2013, 02:47:02 pm »
I ran into the same problem before, and I suggest don't do like this:

Code: [Select]
TextureManager tm = TextureManager.getInstance();
    tm.addTexture("A", texture_1);
    obj.setTexture("A"); //set textureId to id_1
   
    //do other things, like adding other textures, etc...

    obj.setTexture("A");
    tm.removeAndUnload(frameBuffer, "A");
    tm.addTexture("A", texture_2); //add a new texture with the same name, and it has the id of id_2
   
    //will set to the same textureId id_1, and this may be incorrect; The correct one is id_2
    //maybe TextureManager.getTextureId(name) did some caching algorithms.
    obj.setTexture("A");
   
    //And then you will see the mismatched texture, because of the incorrect textureId.

But do like this:

Code: [Select]
    TextureManager tm = TextureManager.getInstance();
    tm.addTexture("A", texture_1);
    obj.setTexture("A"); //set textureId to id_1
   
    //do other things, like adding other textures, etc...
   
    tm.replaceTexture("A", texture_2);

48
The same code to blit a full screen transparency texture:
Code: [Select]
frameBuffer.blit(mSpeedUpTexture, 0, 0, 0, 0, 128, 64, Constant.screenWidthPx, Constant.screenHeightPx, 0xff, false);
but cause the different performance on different devices:

1,  On Tegra2, when bliting, the FPS droped from 59 to 49. Screen: 800*480

2, On Adreno305, when bliting, the FPS(62-63) nearly doesn't drop. Screen: 960*540

What's the possible reason? Is this a fill rate issue? If I FrameBuffer.resize(400*240), the fps(59-60) won't drop when bliting on Tegra2.

And how to resolve this?

49
In my game, I called Object3D.checkForCollisionEllipsoid() per frame, and I found there are some creating of new objects per call(Seems they are CollisionInfo and SimpleVector).

Is there any way to avoid this? I use the Allocation Tracker tool of Android to do the profiling, and there is the report:


50
Support / Re: How to do the profiling in jPCT-AE?
« on: August 19, 2013, 11:51:36 am »
@kiffa:
Could you tell me how you got your memory profiling values?
How do you get values like the app memory limit?

1, For memory limit, there are two ways to get it's value(I think they are the same in Android but not sure):
a,
 mActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
 memProcessLimit = mActivityManager.getMemoryClass();

b,
Runtime.getRuntime().maxMemory();

2, For VM memory:
Runtime.getRuntime().totalMemory();
Runtime.getRuntime().freeMemory();
vm_used_mem = totla_mem - free_mem;

3, For app used memory:
I simply add up: app_uesd_memory = vm_used_mem + native_used_mem;

51
Support / Re: How to do the profiling in jPCT-AE?
« on: August 15, 2013, 10:20:38 am »
7, And there are no lights in my game, so I think I needn't to upload the normals as VBO. Could I do this? (I used custom shaders which have no "attribute normal")

8, The apple-doc say:
  Avoid using the OpenGL ES GL_FIXED data type. It requires the same amount of memory as GL_FLOAT, but provides a smaller range of values. All iOS devices support hardware floating-point units, so floating point values can be processed more quickly.(http://developer.apple.com/library/ios/documentation/3ddrawing/conceptual/opengles_programmingguide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html

  I want to know how about jPCT-AE and Android?


52
Support / Re: How to do the profiling in jPCT-AE?
« on: August 15, 2013, 09:04:58 am »
Thanks, I did some work for this, see the pic below(the left is memory profiling, the right is performance profiling):



And I visited the statistics view of Unity3D(http://docs.unity3d.com/Documentation/Manual/RenderingStatistics.html, I want to print some of these but I have no idea how to do:

1,  VRAM usage:  Approximate bounds of current video memory (VRAM) usage. This also shows how much video memory your graphics card has.

2,  VBO total:   The number of unique meshes (Vertex Buffers Objects or VBOs) that are uploaded to the graphics card. Each different model will cause a new VBO to be created. In some cases scaled objects will cause additional VBOs to be created. In the case of a static batching, several different objects can potentially share the same VBO.

3,Onscreen objects(triangles\vertices).

And another questions:

4, For cloned Object3D(reuse the mesh), will object3d.getMesh().getTriangleCount() return the same number as the origin object3d?

5, Could I get the consuming time of each draw call(or sum)?

6, I have read the default shaders, and I found there is a "precision mediump float;" in defaultFragmentShader.src but a "precision highp float;" in defaultFragmentShaderTex0Amb.src. Could you explain the reason, and how much difference of performance between them will be?

53
News / Re: I'm moving...
« on: August 14, 2013, 11:23:23 am »
Congratulations on your new home! ;D

54
Support / Re: Black texture when enable mipmapping.
« on: August 14, 2013, 11:13:12 am »
Another question: Does mipmapping increase the loading time(texture file -> vm memory -> GPU)  heavily? I feel it's obvious slower than which disable mipmapping.

55
Support / Black texture when enable mipmapping.
« on: August 14, 2013, 10:22:38 am »
Some textures(Seems 2^n * 2^m, not 2^n * 2^n) will be black if i enable mipmapping, and be fine if i disable mipmapping. Codes:

OK:
Code: [Select]
Config.glTransparencyMul = 1 / 255f;
    Config.glTransparencyOffset = 0;
    Config.farPlane = 7000;
    Config.unloadImmediately = true;
    Texture.defaultToKeepPixels(false);
    Texture.defaultTo4bpp(true);

    Texture.defaultToMipmapping(false);

Black:
Code: [Select]
Config.glTransparencyMul = 1 / 255f;
    Config.glTransparencyOffset = 0;
    Config.farPlane = 7000;
    Config.unloadImmediately = true;
    Texture.defaultToKeepPixels(false);
    Texture.defaultTo4bpp(true);

    Texture.defaultToMipmapping(true);

Env:
Code: [Select]
OS: Android 2.3.3\Android 4.2\Android 2.3\Android 4.0
Devices: Tegra2\Mali 400 MP\SGX 531\Adreno 203

And if i enable ETC1 and mipmapping, app will crash on Tegra2. If i enable ETC 1, disable mipmapping, app runs fine. The crash will not happen on Mali 400\SGX 531\Adreno 203.

The crash log:

08-14 16:07:30.850: I/jPCT-AE(8233): Subobject of object 32/object34 compiled to indexed fixed point data using 30/20 vertices in 17ms!
08-14 16:07:30.850: I/jPCT-AE(8233): Object 32/object34 compiled to 1 subobjects in 18ms!
08-14 16:07:30.850: I/jPCT-AE(8233): [ 1376467650865 ] - WARNING: Texture's size is 256/128, but textures should be square for OpenGL ES2.0! This may result in a black texture!
08-14 16:07:30.860: I/jPCT-AE(8233): Creating buffers...
08-14 16:07:30.860: I/jPCT-AE(8233): [ 1376467650874 ] - ERROR: before: glError 1282
08-14 16:07:30.870: W/dalvikvm(8233): threadid=13: thread exiting with uncaught exception (group=0x401c0560)
08-14 16:07:30.870: W/System.err(8233): java.lang.RuntimeException: [ 1376467650874 ] - ERROR: before: glError 1282
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.Logger.log(Logger.java:193)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.GL20.checkError(GL20.java:147)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.GL20.glGenBuffers(GL20.java:1354)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.CompiledInstance.compileToVBO(CompiledInstance.java:1455)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:593)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2211)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.World.draw(World.java:1351)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.World.draw(World.java:1091)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.util.SkyBox.render(SkyBox.java:107)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.car.scene.Sky.update(Sky.java:90)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.car.scene.SceneRoad.beforeRender(SceneRoad.java:71)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.defaultimpl.DefaultSceneManager.beforeRender(DefaultSceneManager.java:512)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.components.GameRenderer.handleGameRender(GameRenderer.java:456)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.components.GameRenderer.onDrawFrame(GameRenderer.java:140)
08-14 16:07:30.870: W/System.err(8233):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
08-14 16:07:30.870: W/System.err(8233):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)





56
Support / How to do the profiling in jPCT-AE?
« on: August 12, 2013, 10:13:27 am »
My purpose is to do some performance profiling, and there are another questions:

1, Is there a method to print the exact numbers of draw calls per frame?

2, How to print the total numbers of triangles(vertices) in world?

3, How to print the total  numbers of triangles(vertices) which was exactly  rendering in world?(means which was not culled/in display list/in visible list ...).

4, How to print the consuming time of gpu and cpu per frame?

57
Support / Re: How to change the screen-resolution of a 3D game?
« on: July 31, 2013, 08:46:45 am »
And my purpose is to give a chance to low-end device.

If I set in AndroidManifest.xml:

  <supports-screens
        android:anyDensity="false"

The game will running in the medium-density-mode, for my device(480*800*240), it will running in the resolution of 320*533(a 320*533 frameBuffer and full screen), blurry but fast.


58
Support / How to change the screen-resolution of a 3D game?
« on: July 31, 2013, 08:36:45 am »
Many 3D games of PC have the settings of changing screen-resolution.

Could I do this in android with jPCT-AE?

E.g: My device is 480*800, i want to simulate a 320*533 screen(full screen).

If I coding like "new FrameBuffer(320, 533)", I will get a game screen of 320*533, but it's not full screen.


59
Support / Re: How to effectively implement GUI with jPCT-AE?
« on: July 31, 2013, 08:36:03 am »
Thanks, I will try blit and be back soon.

60
Support / Re: How to effectively implement GUI with jPCT-AE?
« on: July 31, 2013, 07:48:31 am »
I have made a racing game, and need update  the dash board frequently, e.g: the current speed of player, the current ranking of player, the current score of player, the current time of race and so on.

I use Android-GUI for this now,  it works fine for static views, but slowly for views which update frequently.  After measuring, the updating of GUI was one of the bottlenecks. I have controlled the rate of updating, but the performance was also not good enough.



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