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 - iagofg

Pages: [1]
1
Support / Re: Optimizing memory usage by duplicated or unused Object3D
« on: December 13, 2011, 11:44:17 am »
Yeah... xDDD I used serialialized loading since weeks :) is faster... and uses less memory because no importation process must be executed.

But above those advantages I believe the serialized format has one severe problem: it is very very big: by example for one of the animations I work:

  • source data: 60 .objs, animated: around 1'5 mb (.obj maybe are one of the bigger formats, very very redundant).
  • import with a java application and exported to serialized form. I discard redundant geometry with strip, and I apply some other optimizations (I do not remember now, but I readed everything weeks ago).
  • the result is that the serialized data: animated 60 frame object: around 4 mb.

I suspect that the matter is that serialized data include not only the geometry data, also include all the other properties so the objects do not need to be initialized again. Very very fast, but very very big. Probably there exists a better solution which picks advantages from both alternatives, ;) but for the moment I guess the serialized form is the best available, as long as you can zip the data inside jars or apks, so the size lowers.

Anyway :) maybe something is possible in this way

2
Support / Re: Optimizing memory usage by duplicated or unused Object3D
« on: December 12, 2011, 01:59:13 pm »
That's great!!! Thx very much :)

3
Support / Re: Optimizing memory usage by duplicated or unused Object3D
« on: December 12, 2011, 01:49:01 pm »
Quote

Quote
On the other topic (sharing data between duplicated objects)... relating cloning meshes sure that this: Object3D myRef2 = new Object3D(myRef, true); do not work to share the same mesh?

Yes, that won't make the new object use the same mesh...but i don't understand the actual question...?

Sorry, the actual question was:

Using myRef2 = new Object3D(myRef1, true) Does myRef2 share the mesh data so all the data is not duplicated in memory?
Does it share compiled data as well?
If not, How to make it happen? (How to get duplicated Object3D using the same mesh data without storing two times in memory?)

4
Support / Re: Optimizing memory usage by duplicated or unused Object3D
« on: December 12, 2011, 11:17:40 am »
So making:

world.removeObject(myRef);
myRef = null; // for all the references

Sure is enought to dispose everything, including all the underlaying compiled data? I suspected that there is something else to do to free all the resources. I've asked the question the first time because my app didn't not low the memory usage doing so... sure it can be the complexity of my app that hides some lost non-nulled references, but I looked for them everywhere and I didn't found more. Maybe I make some benchmarks with IRenderHook to confirm or discard :)

On the other topic (sharing data between duplicated objects)... relating cloning meshes sure that this: Object3D myRef2 = new Object3D(myRef, true); do not work to share the same mesh?

For animated object I suppose that is necesary 1 mesh per object so you can get different animated statuses per each Object3D? is it? do you refer this when you say animated objects can't share meshes? so if animated objects share meshes all of them will get the same animation status when rendering? maybe know this is usessful if i want more than 1 object animated identically at the same time?

Finally: I'm reading the doc searching for other posibility... maybe sound a little mad, but can I add more than one time the same Object3D to the world?? I'm thinking in optimizing with IRenderHook; it can solve my problem in some scene :)

5
Support / Optimizing memory usage by duplicated or unused Object3D
« on: December 12, 2011, 02:04:31 am »
Hello,

I'm wish to know which is the best way to dispose the unused Object3D that is no more necesary on the scene.

Also, I wish to know how should I proceed to minimize the memory usage when I have several instances of one Object3D in the scene, with different animation positions, translations and rotations.

Thank you!!

6
Support / ITextureEffect sugestion
« on: November 15, 2011, 12:43:48 am »
Hello,

This is a sugestion... I don't know where to drop it... As you know I was working in a dynamic texture plasma generator to use within the jPCT engine... I was optimizing my code a little so I finally make the code to work only per-pixel, so only one array is needed (no dest/source).

So here goes the sugestion:

in ITextureEffect why there is two arrays: dest and source in the apply method... at least in my case I only need one array... if I receive apply(int[] pixels) that would be enought... and possibly would be more efficient. Isn't??

As the engine should not break compatibility API signatures, I have other sugestion: you can put a flag somewhere to make ITextureEffect.apply(int[] pixels, int[] pixels); use the same array or ITextureEffect.apply(int[] pixels, null); use one array only maybe in Texture.applyEffect or in Texture.setEffect

7
Support / What is the best way to mirror an animated object?
« on: October 03, 2011, 12:25:37 am »
Hello,

I want to mirror an animated object in the axis X, but it is there no scale(x,y,z) (with three parameters) function.

I saw I can change the rotation matrix so I'll try that way, but I'd like to ask anyway because the object is animated so I don't know if there is some better-way to do it :D

If I understood ok the rotation matrix is applied to the object and then the transformation one... is this correct?

Thx a lot!

P.D.: Soon we will post the project information :D

8
Support / Re: Loading big models (memory issues)
« on: September 11, 2011, 04:14:51 am »
I've workaround yet my own InputStream child class that loads model form splitted file successfully.

It is a minefield test-only yet, but works and perhaps helps someone (I tried with BufferedInputStream but Loader seems not to be compatible):

   //zp = Loader.loadSerializedObject(res.openRawResource(R.raw.zpmodel));
   zp = Loader.loadSerializedObject(new MyModelStream());
   
   [...]
   
   class MyModelStream extends java.io.InputStream {
      private int i = 0;
      private java.io.InputStream s = null;
      private void changestream() {
         ++i;
         //Log.v(TAG, "MyModelStream reading resource file no. " + i);
         if (i == 1) s = getResources().openRawResource(R.raw.zpmodel_aa);
         if (i == 2) s = getResources().openRawResource(R.raw.zpmodel_ab);
         if (i == 3) s = getResources().openRawResource(R.raw.zpmodel_ac);
         if (i == 4) s = getResources().openRawResource(R.raw.zpmodel_ad);
      }
      public int available() throws IOException {
         if (s == null) changestream();
         if (s == null) return 0;
         int v = s.available();
         if (v <= 0) { // needs to change stream here also for Loader compat
            //Log.v(TAG, "MyModelStream.available returns <= 0, next block and requesting again...");
            changestream();
            v = s.available();
         }
         //Log.v(TAG, "MyModelStream.available returns " + v);
         return v;
      }
      public void close() throws IOException {
         if (s == null) changestream();
         if (s == null) return;
         //Log.v(TAG, "MyModelStream.close has been called");
         s.close();
      }
      public void mark(int readlimit) {
         //Log.v(TAG, "MyModelStream.mark has been called");
         return;
      }
      public boolean markSupported() {
         boolean v = false;
         //Log.v(TAG, "MyModelStream.markSupported returns " + v);
         return v;
      }
      public int read() throws IOException {
         if (s == null) changestream();
         if (s == null) return -1;
         int v = s.read();
         if (v < 0) {
            //Log.v(TAG, "MyModelStream.read returns < 0, next block and reading again...");
            changestream();
            v = s.read();
         }
         //Log.v(TAG, "MyModelStream.read returns " + v + " bytes");
         return v;
      }
      public int read(byte[] b) throws IOException, NullPointerException {
         if (s == null) changestream();
         if (s == null) return -1;
         int v = s.read(b);
         if (v < 0) {
            //Log.v(TAG, "MyModelStream.read returns < 0, next block and reading again...");
            changestream();
            v = s.read(b);
         }
         //Log.v(TAG, "MyModelStream.read returns " + v + " bytes");
         return v;
      }
      public int read(byte[] b, int off, int len) throws IOException, NullPointerException {
         if (s == null) changestream();
         if (s == null) return -1;
         int v = s.read(b, off, len);
         if (v < 0) {
            //Log.v(TAG, "MyModelStream.read returns < 0, next block and reading again...");
            changestream();
            v = s.read(b, off, len);
         }
         //Log.v(TAG, "MyModelStream.read returns " + v + " bytes");
         return v;
      }
      public void reset() throws IOException {
         //Log.v(TAG, "MyModelStream.reset has been called");
         throw new IOException();
      }
      public long skip(long n) throws IOException {
         if (s == null) changestream();
         if (s == null) return 0;
         long v = s.skip(n);
         //Log.v(TAG, "MyModelStream.skip returns " + v);
         return v;
      }
   }

9
Support / Re: Loading big models (memory issues)
« on: September 11, 2011, 01:03:36 am »
I'm also getting that problem relating this, appears that the apk access allows only to objects bellow 1MB in size... here is my exception:

09-10 22:17:48.435: INFO/jPCT-AE(373): Loading Texture...
09-10 22:17:48.465: INFO/jPCT-AE(373): Loading Texture...
09-10 22:17:48.465: INFO/jPCT-AE(373): onSurfaceChanged
09-10 22:17:48.508: INFO/jPCT-AE(373): OpenGL vendor:     Android
09-10 22:17:48.508: INFO/jPCT-AE(373): OpenGL renderer:   Android PixelFlinger 1.3
09-10 22:17:48.508: INFO/jPCT-AE(373): OpenGL version:    OpenGL ES-CM 1.0
09-10 22:17:48.508: INFO/jPCT-AE(373): OpenGL renderer initialized (using 2 texture stages)
09-10 22:17:48.948: INFO/ARMAssembler(373): generated scanline__00000077:03545444_00009501_00000000 [142 ipp] (195 ins) at [0x284ad8:0x284de4] in 49500022 ns
09-10 22:17:49.015: INFO/ActivityManager(59): Displayed activity com.gargore.zpunch/.ZPunchActivity: 5059 ms (total 5059 ms)
09-10 22:17:49.025: WARN/KeyCharacterMap(373): No keyboard for id 0
09-10 22:17:49.106: WARN/KeyCharacterMap(373): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
09-10 22:17:52.855: WARN/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@450e4058
09-10 22:17:57.666: WARN/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44fe6750
09-10 22:17:57.676: DEBUG/asset(373): Data exceeds UNCOMPRESS_DATA_MAX (4071780 vs 1048576)
09-10 22:17:57.676: WARN/System.err(373): java.io.IOException
09-10 22:17:57.925: WARN/System.err(373):     at android.content.res.AssetManager.readAsset(Native Method)
09-10 22:17:57.995: WARN/System.err(373):     at android.content.res.AssetManager.access$700(AssetManager.java:36)
09-10 22:17:57.995: WARN/System.err(373):     at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:574)
09-10 22:17:57.995: WARN/System.err(373):     at com.threed.jpct.DeSerializer.read(DeSerializer.java:439)
09-10 22:17:57.995: WARN/System.err(373):     at com.threed.jpct.DeSerializer.readInt(DeSerializer.java:423)
09-10 22:17:57.995: WARN/System.err(373):     at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:29)
09-10 22:17:57.995: WARN/System.err(373):     at com.threed.jpct.Loader.loadSerializedObject(Loader.java:97)
09-10 22:17:57.995: WARN/System.err(373):     at com.gargore.zpunch.ZPunchActivity$2.run(ZPunchActivity.java:412)
09-10 22:17:57.995: INFO/jPCT-AE(373): [ 1315693078000 ] - ERROR: Can't deserialize object: null
09-10 22:17:57.995: WARN/System.err(373): java.lang.RuntimeException: [ 1315693078000 ] - ERROR: Can't deserialize object: null
09-10 22:17:58.025: WARN/System.err(373):     at com.threed.jpct.Logger.log(Logger.java:189)
09-10 22:17:58.025: WARN/System.err(373):     at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:201)
09-10 22:17:58.025: WARN/System.err(373):     at com.threed.jpct.Loader.loadSerializedObject(Loader.java:97)
09-10 22:17:58.025: WARN/System.err(373):     at com.gargore.zpunch.ZPunchActivity$2.run(ZPunchActivity.java:412)
09-10 22:17:58.035: WARN/dalvikvm(373): threadid=8: thread exiting with uncaught exception (group=0x4001d800)
09-10 22:17:58.085: ERROR/AndroidRuntime(373): FATAL EXCEPTION: Thread-9
09-10 22:17:58.085: ERROR/AndroidRuntime(373): java.lang.RuntimeException: java.lang.RuntimeException: [ 1315693078000 ] - ERROR: Can't deserialize object: null
09-10 22:17:58.085: ERROR/AndroidRuntime(373):     at com.gargore.zpunch.ZPunchActivity$2.run(ZPunchActivity.java:418)
09-10 22:17:58.085: ERROR/AndroidRuntime(373): Caused by: java.lang.RuntimeException: [ 1315693078000 ] - ERROR: Can't deserialize object: null
09-10 22:17:58.085: ERROR/AndroidRuntime(373):     at com.threed.jpct.Logger.log(Logger.java:189)
09-10 22:17:58.085: ERROR/AndroidRuntime(373):     at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:201)
09-10 22:17:58.085: ERROR/AndroidRuntime(373):     at com.threed.jpct.Loader.loadSerializedObject(Loader.java:97)
09-10 22:17:58.085: ERROR/AndroidRuntime(373):     at com.gargore.zpunch.ZPunchActivity$2.run(ZPunchActivity.java:412)
09-10 22:17:58.266: WARN/ActivityManager(59):   Force finishing activity com.gargore.zpunch/.ZPunchActivity
09-10 22:17:58.326: INFO/jPCT-AE(373): onPause
09-10 22:18:00.135: INFO/jPCT-AE(373): onStop
09-10 22:18:01.295: DEBUG/dalvikvm(302): GC_EXPLICIT freed 905 objects / 60472 bytes in 4548ms
09-10 22:18:01.845: INFO/Process(373): Sending signal. PID: 373 SIG: 9
09-10 22:18:02.782: INFO/ActivityManager(59): Process com.gargore.zpunch (pid 373) has died.

Seems the cause is on:
09-10 22:17:57.676: DEBUG/asset(373): Data exceeds UNCOMPRESS_DATA_MAX (4071780 vs 1048576)

What I don't understand is why the serialized file is so big (I yet put it on reduced mode and the source .obj files total size are less than 2mb, with all the geometry and wavefront files waste a lot of space, I also merged the geometry for generate animation like in http://www.jpct.net/wiki/index.php/Loading_3ds_Keyframes_from_Blender but with obj files.

Maybe there is something else to do? (the model is yet reduced).

I'm thinking on implement my own stream filter to store in parts the big serialized file...

10
Feedback / jPCT access to underlying OpenGL
« on: July 15, 2011, 02:03:32 am »
I really like jPCT. In fact seems to suit most of my needings, but...

Did you have think in adding functions to get/set OpenGL (or other) internal ids or handlers and access to the underlying OpenGL (or other) calls?

In that way we could call native OpenGL if it is really needed to make an effect. In that way if the engine lacks of a feature, while it is not embeded in the mainstream projects can still going on using workarounds.

Of course I've to say that I've seen that jpct interfaces can make a lot, but for sure are limited on some cases. On most cases using natives should be discouraged, but on some cases it can be a last chance until the engine is updated :D (use on your own risk xDDD).

Don't you think so?

In fact is possible on some casses that you could add the native calls as improvements directly to the engine chain later if we send you back :)

11
Support / Re: Procedural textures
« on: July 14, 2011, 07:29:11 pm »
Yes, for example Plasmas, water, patches to textures, and so on.

I've seen after posting ITextureEffect. Maybe I can use that?? Is it the best choice?

The effect is applied every frame automatically? or Must I call to applyEffect every frame I want to redraw it?

Danke schön!

refs.
http://www.jpct.net/jpct-ae/doc/com/threed/jpct/ITextureEffect.html
http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Texture.html#applyEffect()

12
Support / Procedural textures
« on: July 13, 2011, 08:57:55 pm »
I'm trying to make procedural textures. Can I made it in jPCT-AE?

Pages: [1]