Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

Working with COLLADA or FBX #734

Open QKnows opened 8 years ago

QKnows commented 8 years ago

Hello, I try to import some complex scene (gvrContext.loadModel("scene.fbx")) and I have no so much success. What's the best way to work with GVRModelSceneObject, which fbx or COLLADA format is supported, is there some specification available? Some tip which application should be used, to work with fbx or Collada files? All formats I tried have some issue with shader or something else, each scene doesn't look nice as it should. So I would be really thankful for some idea...

NolaDonato commented 8 years ago

We do support Collada and FBX but not everything in those file formats. Would it be possible for you to send us a test asset showing the problem? Maybe we can figure out what is in your file that does not import correctly.

liaxim commented 8 years ago

@QKnows Attaching some logs might help us identify the problem.

QKnows commented 8 years ago

Hello, I attached a log from my application, try to load an fbx file, which have converted with the autodesk converter, I read about the converter in another issue.

The FBX file has the following header: ; FBX 7.3.0 project file ; Copyright (C) 1997-2010 Autodesk Inc. and/or its licensors. ; All rights reserved. ; ----------------------------------------------------

I can't provide that scene file, because it has some copyright issues.

I tried many exports from DAZ 3D, and the most scenes [just simple scene, sphere with a mapped texture works] doesn't work because of some shader problems.

So any (complex-)scene which has been created with DAZ 3D and some lights will be shown wrong in GearVR, I am not sure about copyright of provided DAZ 3D stuff - so I am afraid to share it here...

http://www.daz3d.com

load_scene.txt

liaxim commented 8 years ago

Ok, I see couple of these which is abnormal:

07-21 17:01:49.883 718-772/com.test.app.scene.player I/gvrf: !! 0xd7e0c640 Prog Id -- -1 
07-21 17:01:49.883 718-772/com.test.app.scene.player I/gvrf: after renderMesh::renderMaterialShader() glError (0x501)

We will look into it. Thank you for letting us know.

QKnows commented 8 years ago

Hello @liaxim - are you still working on that isseu? Or should I try to find another way to use 3D scenes?

liaxim commented 8 years ago

We have been fixing model loading bugs. I will have somebody double-check the current status when trying to import models from DAZ 3D.

QKnows commented 8 years ago

Thank you @liaxim for still working on that issue...

deepak-rawat commented 8 years ago

Hi All,

I used the already provided 3D model of Dragon from DAZ studio and exported as FBX 2011 and try to load using GearVRf. The result is crash:

08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115] local reference table dump:
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]   Last 10 entries (of 511):
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       510: 0x137a4790 float[] (16 elements)
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       509: 0x137a39e0 org.gearvrf.jassimp2.AiNode
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       508: 0x137a4740 float[] (16 elements)
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       507: 0x12ed5be0 java.lang.String "tail16_$AssimpFb... (33 chars)
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       506: 0x137a46f0 float[] (16 elements)
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       505: 0x13793f40 int[]
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       504: 0x137a39a0 org.gearvrf.jassimp2.AiNode
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       503: 0x137a46a0 float[] (16 elements)
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       502: 0x137a3980 java.lang.String "tail15"
08-09 11:38:23.017 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       501: 0x137a4650 float[] (16 elements)
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]   Summary:
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]       367 of org.gearvrf.jassimp2.AiNode (367 unique instances)
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.gearvrf.jassimp2.AiScene
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]        35 of java.lang.String (35 unique instances)
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]        35 of int[] (35 unique instances)
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]        72 of float[] (16 elements) (72 unique instances)
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115]         1 of android.os.HandlerThread
08-09 11:38:23.027 544-1228/org.gearvrf.jassimpmodelloader A/art: art/runtime/indirect_reference_table.cc:115] 

Will look into the crash.

deepak-rawat commented 8 years ago

Exported to obj file format and got the below error:

08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader E/Threads.ThreadLimiter.ThreadManager: org.gearvrf.utility.RuntimeAssertion: Not expecting this to be called in thread 6313
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err: org.gearvrf.utility.RuntimeAssertion: Not expecting this to be called
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at org.gearvrf.asynchronous.Throttler$PendingRequests$PendingRequest.failed(Throttler.java:450)
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::texture:add variable: heightTexture key: heightTexture
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::texture:add variable: specularTexture key: specularTexture
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::texture:add variable: diffuseTexture key: diffuseTexture
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::uniform:add variable: ambient_color key: ambient_color
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::uniform:add variable: diffuse_color key: diffuse_color
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::uniform:add variable: specular_color key: specular_color
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::uniform:add variable: emissive_color key: emissive_color
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader V/gvrf: CustomShader::uniform:add variable: specular_exponent key: specular_exponent
08-09 14:59:48.177 27415-27461/org.gearvrf.jassimpmodelloader D/SplashScreen: close()
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at org.gearvrf.asynchronous.Throttler$AsyncLoader.run(Throttler.java:201)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at org.gearvrf.asynchronous.Throttler$PendingRequests$PendingRequest.run(Throttler.java:469)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at org.gearvrf.utility.Threads$ThreadLimiter$ThreadManager.run(Threads.java:521)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at org.gearvrf.utility.Threads$1.run(Threads.java:108)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
08-09 14:59:48.177 27415-27510/org.gearvrf.jassimpmodelloader W/System.err:     at java.lang.Thread.run(Thread.java:818)
deepak-rawat commented 8 years ago

In case of model exported as OBJ file removing bump map images will load the model.

deepak-rawat commented 8 years ago

@QKnows you can export the scene in OBJ file format with supported texture format (tif is not supported) and GearVRf will load those models. Meanwhile we will look into FBX and COLLADA. Let us know if you face any other issue.

deepak-rawat commented 8 years ago

@QKnows You can use FBX file. I tested with 2012 ASCII format. For now the limitations are bone numbers must be less than 60 and textures exported to folder (no embedded texture). Let us know if you face any issue.

QKnows commented 8 years ago

@deepakrawat22 I still have problems loading a model, is it right to load the model like that:

GVRModelSceneObject so = gvrContext.loadModel("model.fbx");

The RenderData is always null

so.getRenderData() is that correct?

NolaDonato commented 8 years ago

The GVRModelSceneObject returned by loadModel will not have a GVRRenderData component but on of its children may. If you want to access all the GVRRenderData components you can do this:

ArrayList renderDatas = sceneObj.getAllComponents(GVRRenderData.getComponentType())

This will give you all of the GVRRenderData components in the entire model.

roshanch commented 8 years ago

@QKnows have you tried the above approach? Can we close this issue?

QKnows commented 8 years ago

I have tried to load scenes without success - I planned to make a Framework update and test again, but since the last update my app isn't not working anymore (issue #850)

roshanch commented 8 years ago

@liaxim can help you with this.

deepak-rawat commented 8 years ago

@roshanch I was able to import few models from DAZ studio. Will check other models as well. Also a lot of models are imported with unsupported texture file so not able to render them.