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

Pages: [1] 2
1
Support / Re: 3ds max tips
« on: December 17, 2015, 08:02:03 am »
Here is my code.
World creation:
Code: [Select]
CurrentWorld = new World();
CurrentWorld.setAmbientLight(20, 20, 20);
CurrentWorld.setClippingPlanes(1, 100000);    //added after your recomendation

Object loading:
Code: [Select]
Object3D[] subobjects = null;
try
{
subobjects = Loader.load3DS(stream, DefaultScale);
}
catch(Exception ex)
{
LogSystem.LogException(TAG, "Loading model raised an exception", ex);
}

if(subobjects != null)
{
Object3D wholeObject  = new Object3D(0);

Object3D subobject = null;
for (int i = 0; i < subobjects.length; i++)
{
subobject = subobjects[i];
subobject.setCenter(SimpleVector.ORIGIN);
subobject.rotateX((float)( -.5 * Math.PI));
subobject.rotateMesh();
subobject.setRotationMatrix(new Matrix());
wholeObject = Object3D.mergeObjects(wholeObject, subobject);
}

        wholeObject.calcBoundingBox();
wholeObject.calcNormals();
wholeObject.setName("myself");
        wholeObject.build();
        return wholeObject;
}

Object adding to scene:
Code: [Select]
CurrentWorld.addObject(object);
object.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
object.setTransparency(-1);       //added after your recomendation

Camera setup:
Code: [Select]
float[] box = object.getMesh().getBoundingBox();
SimpleVector camPos = CurrentWorld.getCamera().getPosition();
float objectHeight = box[3] - box[2];
float newZPos = box[4] - objectHeight * 1.5f;
float halfHeightPos = box[3] - objectHeight  * 0.5f;

SimpleVector newPos = new SimpleVector(camPos.x, halfHeightPos, newZPos);  //trying to put camera at the half of objects height and in front of object by 1.5 of height
CurrentWorld.getCamera().setPosition(newPos);

SimpleVector lookPos = new SimpleVector(camPos.x, halfHeightPos, 0);
CurrentWorld.getCamera().lookAt(lookPos);            //look at object transform center also been tried

It works fine for other models. Some of them were exported from Blender and some from 3Ds Max as this one.

2
Support / Re: 3ds max tips
« on: December 16, 2015, 01:55:52 pm »
The scene has a transparent background and there is camera preview behind it.
I tried scaling. It did not help.

I asked our designer to scale down the model and now it has such properties:
bounding box : [-56.823803, 54.82773, -113.101685, -20.355627, -29.19638, 7.774193];
transformed center : (-0.74186236, -83.03801, -14.0675335);
origin : (0.0, 0.0, 0.0).

Camera position is (0.0,-66.72865,-168.31546) now ant it looks at (0.0,-66.72865,0.0).

Calling to wasVisible() returns true without any additional transformations (no scaling, no translation). And object is still invisible...

3
Support / Re: 3ds max tips
« on: December 16, 2015, 09:38:09 am »
I tried another way - make camera look at (0, 0, 0) and then translate my object to put its transformed center to (0, 0, 0). After that object.wasVisible() starts return true, but screen is still empty.

4
Support / Re: 3ds max tips
« on: December 16, 2015, 08:17:12 am »
Yes, and it has no effect.

5
Support / Re: 3ds max tips
« on: December 15, 2015, 02:44:33 pm »
It returns false. So how can I configure my camera to make it capture the object? I mean what is the general practice of camera set up to be sure that the object will be visible?

6
Support / Re: 3ds max tips
« on: December 15, 2015, 01:17:36 pm »
The object is still invisible(

7
Support / Re: 3ds max tips
« on: December 15, 2015, 11:25:20 am »
Hello!
Its me again. I need a little advice. I faced with the same problem: model has successfully loaded but not visible on the scene.

Model parameters are:
Origin : (0.0,0.0,0.0)
Center (Transformed center) : (-0.38567856,-2007.5032,-570.4014)
Bounding box : [-1455.0249, 1380.9241, -2979.1418, 174.60309, -944.2183, 26.167683]

Camera position is (0.0,-1402.2693,-5674.8354) and it looks at model's transformed center.

I supposed that model should be in camera's scope.
May the problem be not in model location? Some wrong materials or something else?
(I've attached the model file if you need to try to load it.)

8
Support / Re: Loader.readTextureNames3DS raise an exception
« on: December 04, 2015, 07:52:23 am »
I've tried a new version and it works! No exceptions and even texture names was loaded.
Thank you for reply and attention!

9
Support / Loader.readTextureNames3DS raise an exception
« on: December 03, 2015, 01:43:37 pm »
Hello!
I using Loader.readTextureNames3DS method to load texture names from model 3ds file. It works fine. But recently I tryed to load a new model (attached) and Loader.readTextureNames3DS falled down with exception. Here is a part of log:
Quote
12-03 05:01:10.417: E/AndroidRuntime(1201): FATAL EXCEPTION: main
12-03 05:01:10.417: E/AndroidRuntime(1201): Process: ru.orientiryug.tofar, PID: 1201
12-03 05:01:10.417: E/AndroidRuntime(1201): java.lang.ArrayIndexOutOfBoundsException: length=12189; index=-1486432958
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.getShortInt(Loader.java:1094)
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.getChunkHeader(Loader.java:2159)
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.readTextureNames3DS(Loader.java:1427)
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.readTextureNames3DS(Loader.java:176)

I can use another approach to retrieve texture names as it described in thread http://www.jpct.net/forum2/index.php/topic,1644.msg12249.html#msg12249
But just for know is the model incorrect and cannot be used with readTextureNames3DS method? (Loading model with Loader.load3DS works fine.)
The model file was exported from 3Ds Max. Is there any rules how to export textured models from 3Ds Max to make it compatible for readTextureNames3DS?

10
Support / Re: Fatal signal while operationg with model
« on: November 26, 2015, 02:54:43 pm »
Also I'm not sure about my implementation of animation. Should Object3D.animate(...) be called in separate thread or in main thread where the whole scene renders?

11
Support / Re: Fatal signal while operationg with model
« on: November 26, 2015, 02:47:35 pm »
Yes, there is some part of native code but it has no relation to rendering and works properly in the rest time.

12
Support / Re: Fatal signal while operationg with model
« on: November 26, 2015, 12:44:57 pm »
TofAR is a name of our app where I should add 3D support.  It means Technology of Augmented Reality.
I have an access to that device and can debug on it. But dont know how to find the exact place where crash is happens. It occurs somewhere during drawing frames and applying an animation. I added detailed log and it always shows a different stage before fatal signal.

13
Support / Fatal signal while operationg with model
« on: November 26, 2015, 08:57:53 am »
Hello for everybody!
I continue to learning jPCT engine and write a simple code for testing. It loads animated model from 3ds files (using key frames) and shows it to user. User can zoom-in and zoom-out using corresponding scale gesture and rotate the model around its x and y axes by pick it and drag. Everything works fine but on some devices app crashes with fatal signal while user rotates the object. Here is a part of log:
Quote
11-26 09:29:44.293: I/KERNEL(8683): [  893.215881] ientiryug.tofar (8683): undefined instruction: pc=75671754
11-26 09:29:44.293: I/KERNEL(8683): [  893.216015] Code: db76 ee3a fb4d ec40 (fb18) ed85
11-26 09:29:44.293: A/libc(8683): Fatal signal 4 (SIGILL) at 0x75671754 (code=1), thread 8683 (ientiryug.tofar)
11-26 09:29:44.343: I/KERNEL(8683): [  893.266745] ientiryug.tofar (8683): undefined instruction: pc=75671754
11-26 09:29:44.343: I/KERNEL(8683): [  893.266897] Code: db76 ee3a fb4d ec40 (fb18) ed85
11-26 09:29:44.723: I/KERNEL(8683): [  893.651359] ientiryug.tofar (8683): undefined instruction: pc=75671754
11-26 09:29:44.723: I/KERNEL(8683): [  893.651495] Code: db76 ee3a fb4d ec40 (fb18) ed85
As I said it happens not on all devices. On Samsung S4 Mini I have no problem but on ZTE Grand S2 it occures very often.
Has anybody deal with similar cases?

14
Support / Re: FrameBuffer creation time
« on: November 24, 2015, 10:47:57 am »
Thank you Egon for response!
The main reason  why I should recreate buffer is surface size changing. An activity where GlSurface is used is fullscreen while other application activities not. So surface is created a little less and than stretched on full screen size. It leads to call onSurfaceChanged several times with different width and height.
As I can conclude from your explanation there is no way to improve this situation(

15
Support / FrameBuffer creation time
« on: November 24, 2015, 09:16:03 am »
Hello.
I have a question about FrameBuffer creation. As I noticed it takes about 2-4 seconds on my test device (Samsung S4 mini) and makes the UI hangs. Is it possible to create it on separate thread or some other way to avoid such effects?

Pages: [1] 2