I am Working with Rajawali 3D Framework and trying to Load .obj files from SDcard. I am able to upload and parse the obj file when I put these files (.obj, .mtl, texture.png (drawable folder)) on raw folder but when I try to parse it from sdcard it says:
[org.rajawali3d.materials.Material] Could not compile fragmentshader:
Shader log: Fragment shader compilation failed.
Here is my code for uploading .obj files from Sdcard:
private Object3D Object;
LoaderOBJ objParser = new LoaderOBJ(this,"Load/1c_obj");
try {
objParser.parse();
Object = objParser.getParsedObject();
getCurrentScene().addChild(Object);
} catch (ParsingException e) {
e.printStackTrace();
}
Logcat:
D/Rajawali﹕ Parsing: /storage/emulated/0/Load/1c_obj
D/LoaderOBJ﹕ Found Material Lib: 1c_mtl
D/LoaderOBJ$MaterialLib﹕ Parsing material: Texture0
D/LoaderOBJ$MaterialLib﹕ Parsing material: Texture1
9578-9612/com.example.loadobj D/LoadModelFragment$LoadModelRenderer﹕ startRendering()
E/Rajawali﹕ [org.rajawali3d.materials.Material] Could not compile fragment shader:
9578-9612/com.example.loadobj E/Rajawali﹕ Shader log: Fragment shader compilation failed.
ERROR: 0:13: '.' : Syntax error: syntax error
ERROR: 1 compilation errors. No code generated.
If your are able to read obj files from your raw folder which is
and not from your sdcard you have to do following changes in your files: In your obj file that must be saved as
_obj
in your sdcard (so for _jpg and _mtl in same location)in your case:
Following by mtl file
Remember to rename your texture jpg to
_jpg
Where you are getting Error:After this follow your code for parsing:
And The Error you are getting
Its unable to read your texture file from your material file, For that you can do the above changes in your material file.
For more details on custom material or vertex shader follow the Rajawail Document and sample