Main Menu
Menu

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.

Show posts Menu

Topics - kiffa

#1
Support / Could you add some useful math functions?
March 19, 2014, 07:05:19 AM
1, To optimize the comparing of the length of vector:
    SimpleVector.length()^2; SimpleVector.distance()^2

2, For animation、camera moving 、physic simulation and so on:
   Interpolation - linear、sin、pow、slerp and so on.

3, For animation、rotation Interpolation:
   Quaternion
 
#2
My purpose is for reduce memory usage\texture bandwith.

Which one is better?(for performance\memory usage\generation time\visual quality\compatibility and so on). - Assume the texture doesn't have alpha.

#3
The shaders exist in 2 locations, one is jpct_shaders.zip, the other is jPCT-AE.jar, I found some of them are not the same: defaultFragmentShaderTex1.src、defaultFragmentShader.src.
#4
Support / Got black texture when using mulit textures
February 13, 2014, 01:14:55 PM
code:

//first use 1 texture
car.setTexture("car_1");

//after a while, use 2 to blending
int id = TextureManager.getInstance().getTextureID("car_1");
int id2 = TextureManager.getInstance().getTextureID("car_2");
TextureInfo info = new TextureInfo(id);
info.add(id2, TextureInfo.MODE_MODULATE);
car.setTexture(info);

#5
Support / glError 1280 on Android 4.2
December 12, 2013, 08:05:12 AM
My game crashes on Android 4.2(test with only one device who has a heavily customized system based on Android 4.2), but runs well on other versions(2.3 - 4.4).

First, seems the engine can't find the default shader-files in jar, so I push all sharder-files into a zip named "jpct_shaders.zip", and put it in "assets" of project, then call

GLSLShader.setShaderLocator(new ShaderLocator(getAssets()));


When I run game again, the engine found shader-files, but crashed when gen VBO, logs:


12-12 14:40:07.394: W/dalvikvm(10293): threadid=15: thread exiting with uncaught exception (group=0x41578930)
12-12 14:40:07.416: W/System.err(10293): java.lang.RuntimeException: [ 1386830407375 ] - ERROR: before: glError 1280
12-12 14:40:07.416: W/System.err(10293): at com.threed.jpct.Logger.log(Logger.java:193)
12-12 14:40:07.416: W/System.err(10293): at com.threed.jpct.GL20.checkError(GL20.java:147)
12-12 14:40:07.416: W/System.err(10293): at com.threed.jpct.GL20.glGenBuffers(GL20.java:1354)
12-12 14:40:07.416: W/System.err(10293): at com.threed.jpct.CompiledInstanceFP.compileToVBO(CompiledInstanceFP.java:1199)
12-12 14:40:07.417: W/System.err(10293): at com.threed.jpct.CompiledInstanceFP.render(CompiledInstanceFP.java:74)
12-12 14:40:07.417: W/System.err(10293): at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2211)
12-12 14:40:07.417: W/System.err(10293): at com.threed.jpct.World.draw(World.java:1351)
12-12 14:40:07.417: W/System.err(10293): at com.threed.jpct.World.draw(World.java:1091)
12-12 14:40:07.417: W/System.err(10293): at com.zwenyu.woo3d.components.GameRenderer.renderWorld(GameRenderer.java:596)
12-12 14:40:07.417: W/System.err(10293): at com.zwenyu.woo3d.components.GameRenderer.handleGameRender(GameRenderer.java:516)
12-12 14:40:07.417: W/System.err(10293): at com.zwenyu.woo3d.components.GameRenderer.onDrawFrame(GameRenderer.java:171)
12-12 14:40:07.418: W/System.err(10293): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
12-12 14:40:07.418: W/System.err(10293): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)



#6
My game runs in 55+ fps normally, but sometimes could suddenly drop to 10- fps, and  resume to normal(55+fps) after several seconds(8 - 20s).

First I doubt other processes kill too many cpu load, but when the fps-dropping occur, I watched the total usage of cpu with android's tool(system information), seems the cpu load is normal(without a suddenly increase, and there is enough idle load).

Then I doubt the GC and incorrect Thread.Sleep() in game loop(there is a mechanism to limit the fps to save power). But I have not check this due to the hard reappearing.

All above is about cpu, my question is:

Is there any issue with gpu(code\driver) could result in this problem? Please give your options, I will check them, thanks.
#7
Support / How to use renderTarget?
December 05, 2013, 07:19:38 AM
My purpose is to render the scene 2 times with different camera per frame, the first rendering will render to full screen, the second rendering will render to a smaller(1/4w、1/4h of the screen). But my code seems useless(the result seems like which don't do the second rendering).



  private void init(){
    mTexture = new Texture(256, 128);
    mTexture.setMipmap(false);
    TextureManager.getInstance().addTexture("rt", mTexture);
  }
 
  private void update(World world, FrameBuffer frameBuffer){
    int screenWidth = 800;
    int screenHeight = 480;
   
    //first rendering
    world.renderScene(frameBuffer);
    world.draw(frameBuffer);
   
    //second rendering
    frameBuffer.setRenderTarget(mTexture);
    world.renderScene(frameBuffer);
    world.draw(frameBuffer);
    frameBuffer.blit(mTexture, 0, 0, 0, 0, screenWidth/4, screenHeight/4, false);
    frameBuffer.removeRenderTarget();
   
  }
#8
Could you add some info of the incorrect texture name in the exception? Which like "Tried to set an undefined texture: textureName". This may help to debug, thanks!
#9
Support / Does mobile GPU(s) support the Early-Z culling?
November 30, 2013, 08:35:06 AM
And another question:

PowerVR SGX uses TBDR, so sorting objs front-to-back makes no sense on such device.

But for Tegra(IMR)、Adreno(TBR)、Mali(TBR), will "Config.stateOrientedSorting = false" gain better performace?
#10
Support / Some questions about CollisionEvent
November 07, 2013, 05:48:43 AM

CollisionEvent event;
int[] ids = event.getPolygonIDs();
Object3D[] objs = event.getTargets();


When objs.length > 1, how to judge which PolygonID(ids[j]) belongs to which Object3D(objs[j])? For example, to calc:


SimpleVector normal = objs[i].getPolygonManager().getTransformedNormal(ids[i]);
#11
I found there is only a Object3D.scale(); Are there some methods like scaleX()\scaleY()\scaleZ()... etc?
#12
Support / Does scale affect the Ray-detection?
November 05, 2013, 04:32:51 AM

mRoad.scale(5);
SimpleVector d = new SimpleVector(0, -1, 0);
float frontHeight = mRoad.calcMinDistance(front, d, 100 * 30);
mRoad.setScale(1);



SimpleVector d = new SimpleVector(0, -1, 0);
float frontHeight = mRoad.calcMinDistance(front, d, 100 * 30);


Are the 2 codes above equal or not?  What's the situation when invoking mRoad.enableLazyTransformations()?
#13
NEON is ARM's Single Input Multiple Data (SIMD) architecture available on most Android ARM powered devices. It is a powerful engine for accelerating processing of media, augmented reality, gaming graphics and physics engines, DSP, etc.

And there is an  open source project of NEON targeting Android and Linux apps. Project Ne10 has been set up to provide a set of common, useful functions which have been heavily optimized for the ARM Architecture and provide consistent well tested behavior that can be easily incorporated into applications.

Maybe jPCT-AE can benefit form this.

ARM's introduce:
http://www.arm.com/community/software-enablement/google/solution-center-android/advanced-app-dev.php

Project Ne10:
http://projectne10.github.io/Ne10/

#14
Support / Screwy Object3D.
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?
#15
Support / How to upload an Object3D?
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?
#16
Support / Can not clone a striped Object3D
October 17, 2013, 03:34:03 AM

Object3D src;
src.build();
src.strip();
Object3D obj = src.cloneObject(); // will throw a NullPointerException


Should this behavior be legal?
#17
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 ?
#18
Support / How could I decrease the peak of vm memory?
October 11, 2013, 02:29:19 PM
As I know, android used a non-compacting GC before 3.0(https://groups.google.com/forum/#!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:


// 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.
//or
ByteBuffer.allocateDirect(3*1024*1024);


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
#19
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:

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:
public static Object3D clone(Object3D src, boolean shareVBO, boolean shareTexture){
    Object3D ret = src.cloneObject();
    if(shareVBO)
      ret.shareCompiledData(src);
    if(shareTexture)
      ret.shareTextureData(src);
    return ret;
  }

for(int i = 0; i < num; ++i){
  clone[i] = clone(srcObj, true, true);
  world.addObject(clone[i]);
}
#20
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.