Viable engine?

Started by MrAdam, May 02, 2012, 05:04:46 PM

Previous topic - Next topic

EgonOlsen

#30
I just wanted to be sure that i'm not looking at some compression artifacts...really strange. Does this happen with the camera image in the background only? Can you try it on a different device that uses another gpu? I'll try to reproduce it on my device, but i don't remember seeing anything like it.

MrAdam

It happens without the camera preview as well. And appears on the Galaxy SII as well as on my Galaxy Nexus.

If you want to see it in the app, I can send you the APK.

EgonOlsen

That would be helpful.

MrAdam

#33
Another thing. When loading via: model = Loader.loadSerializedObjectArray(getAssets().open("model.ser"));
Is it possible to somehow check when the loading is done? I need to load the car in the background, as it takes a lot of time.
but the .loadSerializedObjectArray() function starts a new thread in the background when run, which means I can't just wait for the function to finish.

EDIT: Looks like from the logs that its not loading the model itself thats the problem. But its adding it to the scene.
If I load it before entering the activity, it still takes a while to show up, a while after the onSurfaceChanged have run.

EgonOlsen

The engine doesn't spawn any additional threads. When the methods in Loader return, the loading is done. The delay that you notice is caused by the engine compiling the mesh to be processed by the gpu in the most optimal way. This happens in two steps. The second one has to happen in the render thread, you can't get around that. However, the first step can be triggered from anywhere. To do this, add the objects to the world and call World.compileAllObjects. That should remove some load from the render thread.

MrAdam

#35
Quote from: EgonOlsen on May 20, 2012, 05:53:30 PM
The engine doesn't spawn any additional threads. When the methods in Loader return, the loading is done. The delay that you notice is caused by the engine compiling the mesh to be processed by the gpu in the most optimal way. This happens in two steps. The second one has to happen in the render thread, you can't get around that. However, the first step can be triggered from anywhere. To do this, add the objects to the world and call World.compileAllObjects. That should remove some load from the render thread.
Its not really the timing that matters. Its mostly so I can create a ProgressDialog and dismiss it when it is actually done.

EDIT: Is it possible to check when all the VBO's has been created for the object?

MrAdam

#36
A totally different question: I use a rotation matrix to set the position of the car in 3D.
Is it possible to set the rotation around a specific axis to 0?
Lets say I only wanted the rotation matrix to rotate pitch and roll, not yaw, of the car.

EDIT: I was thinking it might be possible to pull just the two vectors out of three from the matrix, and applying them to the model, not completely sure how to do that though.

EgonOlsen

Why don't you use the rotate?()-methods instead?

MrAdam

Quote from: EgonOlsen on May 21, 2012, 01:40:52 PM
Why don't you use the rotate?()-methods instead?
Because Im getting a rotation matrix from the phones sensors. I can only set the rotation, not get the current rotation of the car :-/

EgonOlsen

I see...you can derive the euler angles from the matrix and create a new matrix with only a sub-set, but i'm not sure if the results will be satisfying. The basic problem is that an unlimited number of cascaded transformations result in the same output. The derived angles are just one way to do it...anyway, here's some code: http://www.jpct.net/forum2/index.php/topic,1191.0.html

MrAdam

Quote from: EgonOlsen on May 21, 2012, 02:30:06 PM
I see...you can derive the euler angles from the matrix and create a new matrix with only a sub-set, but i'm not sure if the results will be satisfying. The basic problem is that an unlimited number of cascaded transformations result in the same output. The derived angles are just one way to do it...anyway, here's some code: http://www.jpct.net/forum2/index.php/topic,1191.0.html
Thanks, that helped :-)

Also, I've noticed that if there is solid objects behind transparent objects, it will render the solid objects behind as transparent as well.
We had the same issue in the iPhone version, which was solved by setting a glColorMask after drawing transparent stuff (http://stackoverflow.com/questions/10450680/isgl3d-transparency-issues)
Is it possible to somehow implement this in your engine?

EgonOlsen

Quote from: MrAdam on May 22, 2012, 10:10:39 AM
Is it possible to somehow implement this in your engine?
Yes. You can add an implementation of the IRenderHook-interface to your transparent object(s) that does this.

MrAdam

Quote from: EgonOlsen on May 22, 2012, 11:20:54 AM
Quote from: MrAdam on May 22, 2012, 10:10:39 AM
Is it possible to somehow implement this in your engine?
Yes. You can add an implementation of the IRenderHook-interface to your transparent object(s) that does this.
And what is the best way to expose the GL20 object to do raw gl calls inside the IRenderHook?

EgonOlsen

You don't. It's a static class. Just do GLES20.glColorMask(...);

MrAdam

#44
Quote from: EgonOlsen on May 22, 2012, 12:07:44 PM
You don't. It's a static class. Just do GLES20.glColorMask(...);
Thanks! Worked wonders. Although, now the transparent lines appearing are even more visible ^^

EDIT: It appears that this is not a shader-problem, as its still visible without the shader enabled: