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.


Topics - MSL

Pages: [1]
1
Support / Augmented Reality for Desktop
« on: February 07, 2015, 08:30:18 am »
Hi,

Can anyone point me to best AR solution(preferably free) which can be used with JPCT? (for desktop)

or Can anyone point me how can I replace the JPCT canvas with Live camera feed so that when I render 3D objects the objects will be rendered inside Camera feed?

Thanks in advance
MSL

2
Support / Dynamic Light placing and control
« on: January 17, 2014, 09:19:04 am »
Hi,
My augmented reality app is supposed to load different architectural models. One of the feature in my wish list is to place lights and user should be able to control the lights(on touch toggle on and off).
The tricky part is different models will have lights in different places. Now, how can I add lights in a particular place at the run time and bind them to onTouch events.

For simplicity, lets say I have 2 model; bed room and living room. When I load bed room model bed lamp and other lights should be placed at respective places. Similarly, when I load living room it should place lights in respective area.

3
Support / getting Object Size and Units
« on: November 26, 2013, 02:55:56 pm »
Hi,

When I integrated with Vuforia, the CUBE was usually lying behind the marker. Hence, it had a odd rotating feeling when we moved camera around it. This was solved by translating CUBE by its SIZE in the z-axis. If I need to display any model, now I have to do the same adjustment i.e translate the model by its SIZE in the z-axis. (Since my model will lay on the marker I think I need height of the model to use in translation)
How can I achieve this?
What method I need to use which will get me the SIZE(or height) of the model?

Above questions resulted me in getting few basic questions. They may be trivial or may be answered. I checked few posts here on this topic I was unable to get satisfactory answers. Here are the questions:

1- What does model units mean when we load them in jpct(i.e any relation between units used while creating the model in a 3D software and jpct)?
2- What are the steps that need to be taken care before loading models in jpct which will ensure "proper" sizing(and probably orientation) during rendering? (in 3D software and in jpct)
3- Is there any way of getting the size (in some units) of the model at run time (apart from getScale)?
4- What is the basis for scaling?
5- One question regarding the object position after scaling which I didnt know how to ask, so I have attached an image. If you refer the image, if the "Dist" need to be constant then on every scaling operation, I have to calculate the distance and translate the object with that distance. Is there any easy of doing this?

If anyone can answer taking consideration of model with only 1 object and model with multiple objects will be great.
For modelling I use 3DS Max.

Thanks


[attachment deleted by admin]

4
Support / Jpct-AE Vuforia integration Portrait mode
« on: November 21, 2013, 09:39:41 am »
HI..
I was able to integrate jpct and vuforia following the wiki article. Everything works fine in landscape mode. However, in portrait mode the model is not positioned properly(model not sticking to marker) also model moves when the camera is moved.
if camera moves UP, model moves RIGHT
if camera moves DOWN, model moves LEFT
if camera moves LEFT, model moves UP
if camera moves RIGHT, model moves DOWN

In many posts people talk about this problem but no one has provided proper solution for this or may be I am missing something.
Can anyone help me by pointing out the changes that is required to be done to the wiki article on Integration so that portrait mode can be handled?

5
Support / Can't deserialize object Error
« on: November 15, 2013, 11:42:32 am »
Hi,

I am trying to load a serialized file but I am getting Can't deserialize object error.

Code used to load serialized object:
----------------------------------------------------------------------------------------------------------------------------
ZipInputStream zis = new ZipInputStream(mContext.getResources().openRawResource(R.raw.teapot));
try {
   zis.getNextEntry();
} catch (IOException e) {throw new RuntimeException(e);}
cube = Loader.loadSerializedObject(zis);
-----------------------------------------------------------------------------------------------------------------------------
Error:
11-15 15:56:08.478: E/Trace(11279): error opening trace file: No such file or directory (2)
11-15 15:56:08.828: E/AndroidRuntime(11279): FATAL EXCEPTION: GLThread 6828
11-15 15:56:08.828: E/AndroidRuntime(11279): java.lang.RuntimeException: [ 1384511168803 ] - ERROR: Can't deserialize object: length=256; regionStart=-1; regionLength=257
11-15 15:56:08.828: E/AndroidRuntime(11279):    at com.threed.jpct.Logger.log(Logger.java:189)
11-15 15:56:08.828: E/AndroidRuntime(11279):    at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:244)
11-15 15:56:08.828: E/AndroidRuntime(11279):    at com.threed.jpct.Loader.loadSerializedObject(Loader.java:93)
11-15 15:56:08.828: E/AndroidRuntime(11279):    at com.threed.jpct.example.HelloWorld$MyRenderer.onSurfaceChanged(HelloWorld.java:204)
11-15 15:56:08.828: E/AndroidRuntime(11279):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
11-15 15:56:08.828: E/AndroidRuntime(11279):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1266)

-----------------------------------------------------------------------------------------------------------------------------

If I use following code to load:
cube = Loader.loadSerializedObject(mContext.getResources().openRawResource(R.raw.teapot));

Error:
11-15 15:53:34.603: E/Trace(11063): error opening trace file: No such file or directory (2)
11-15 15:53:34.945: E/AndroidRuntime(11063): FATAL EXCEPTION: GLThread 6816
11-15 15:53:34.945: E/AndroidRuntime(11063): java.lang.RuntimeException: [ 1384511014916 ] - ERROR: Can't deserialize object: [ 1384511014915 ] - ERROR: Unsupported version: 6
11-15 15:53:34.945: E/AndroidRuntime(11063):    at com.threed.jpct.Logger.log(Logger.java:189)
11-15 15:53:34.945: E/AndroidRuntime(11063):    at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:244)
11-15 15:53:34.945: E/AndroidRuntime(11063):    at com.threed.jpct.Loader.loadSerializedObject(Loader.java:93)
11-15 15:53:34.945: E/AndroidRuntime(11063):    at com.threed.jpct.example.HelloWorld$MyRenderer.onSurfaceChanged(HelloWorld.java:204)
11-15 15:53:34.945: E/AndroidRuntime(11063):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
11-15 15:53:34.945: E/AndroidRuntime(11063):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1266)

----------------------------------------------------------------------------------------------------------------------------

Code used to serialize an object in Desktop JPCT (object is basic Teapot):
----------------------------------------------------------------------------------------------------------------------------
        box = loadModel("models/"+thingName+".obj","models/"+thingName+".mtl", 100);
        try {
            new DeSerializer().serialize(box, new FileOutputStream("models/teapot.ser"), true);
         } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }

   private Object3D loadModel(String filename, String filemtl, float scale) throws IOException {
         InputStream streamModel = getResources().getAssets().open(filename);
         InputStream streamMtl = getResources().getAssets().open(filemtl);

           Object3D[] model = Loader.loadOBJ(streamModel, stearmMtl, scale);
           Object3D o3d = new Object3D(0);
           Object3D temp = null;
           for (int i = 0; i < model.length; i++) {
               temp = model;
               temp.setCenter(SimpleVector.ORIGIN);
               temp.rotateX((float)( -.5*Math.PI));
               temp.rotateMesh();
               temp.setRotationMatrix(new Matrix());
               o3d = Object3D.mergeObjects(o3d, temp);
               o3d.build();
           }
           return o3d;
    }
--------------------------------------------------------------------------------------------------------------------

Any help would be appreciated.

Pages: [1]