Hi, I am still quite new to using blender and JME3. I have loaded plenty models successfully for android and desktop versions before. I used the guide/tutorials on the forum to learn more.
I have two material file’s content in one file, because it worked for me on the desktop version. It does not work the same way on android. This importing is importing via the assetmanager during runtime.
-When I run the application/game on Desktop, it loads the model with its material file successfully.
-When running on android it seems as if the material file has been ignored and the mesh is completely black.
Please let me know if you require more information regarding this.
@meeshter: I did some research on the issue I thought was causing it but I found out I was wrong. Can you show how you’re applying the material manually?
Is that a j3o model? And what material settings? Lighted material?
I created this basic example:
[java]
material walls.002
{
receive_shadows on
technique
{
pass
{
cull_hardware none
ambient 0.800000011920929 0.800000011920929 0.800000011920929 1.0
diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0
specular 0.5 0.5 0.5 1.0 12.5
emissive 0.0 0.0 0.0 1.0
scene_blend one zero
texture_unit
{
texture Free Cobblestone Texture 04_11_2010 004.preview.jpg
tex_address_mode wrap
scale 1.0 1.0
env_map planar
colour_op_ex blend_manual src_current src_texture 0.0
}
}
}
}
material roof
{
receive_shadows on
technique
{
pass
{
cull_hardware none
ambient 0.800000011920929 0.800000011920929 0.800000011920929 1.0
diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0
specular 0.5 0.5 0.5 1.0 12.5
emissive 0.0 0.0 0.0 1.0
scene_blend one zero
texture_unit
{
texture Free Tile Texture 20_10_2010 006.preview.jpg
tex_address_mode wrap
scale 1.0 1.0
env_map planar
colour_op_ex blend_manual src_current src_texture 0.0
}
}
}
}
[/java]
This is from a Cylinder.001.material for Cylinder.001.mesh.xml
I did not import it to get the j3o files. Using straight from OgreXML export.
Using it in android does not exhibit the same behaviour as in desktop version.
you need to convert them to .j3o, as .mesh.xml are not copied over to the assets.jar when you compile your game. If you try the game from the /dist folder on your desktop you will find the same result.
Thanks I will quickly try this and revert
When importing the model into JME-SDK I get this error even though the model shows perfectly in the JME editor, when loading the j3o instead of the mesh.xml I get no textures - only a weird red-with dots texture:
java.io.SyncFailedException: /home/meeshter/jmeGame_Models/example/export/+Cylinder.001.material
at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.createData(FolderObj.java:350)
at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.createDataImpl(FolderObj.java:297)
at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj$1.call(FolderObj.java:264)
at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj$1.call(FolderObj.java:262)
at org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem.runAsInconsistent(FileBasedFileSystem.java:118)
at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.createData(FolderObj.java:267)
at org.openide.filesystems.FileUtil.copyFileImpl(FileUtil.java:722)
at org.openide.filesystems.FileObject.copy(FileObject.java:129)
at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.copy(BaseFileObj.java:242)
[catch] at com.jme3.gde.ogrexml.OgreXMLDataObject.loadAsset(OgreXMLDataObject.java:91)
at com.jme3.gde.ogrexml.OgreXMLDataObject.loadAsset(OgreXMLDataObject.java:58)
at com.jme3.gde.core.assets.AssetData.loadAsset(AssetData.java:84)
at com.jme3.gde.modelimporter.ModelImporterVisualPanel1.loadModel(ModelImporterVisualPanel1.java:95)
at com.jme3.gde.modelimporter.ModelImporterVisualPanel1.loadModel(ModelImporterVisualPanel1.java:74)
at com.jme3.gde.modelimporter.ModelImporterVisualPanel1$8.run(ModelImporterVisualPanel1.java:305)
at java.lang.Thread.run(Thread.java:662)
Hi I have now made some progress I have used importer.load(file); instead of the usual way of using assetmanager for importing, now the item appears in scene textured.
Let me make changes to my own project and revert if all was successful
I have realised working outside of the JME netbeans is giving me some troubles, and by working on JME netbeans solves these issues for me.
Thanks for your guidance, it has already helped me realise a few mistakes I have made.
All the best
Do you use a network drive for assets ?
or A Antivirus taht blocks for multiple seconds?
Cause taht is probably the reason for the sync errors.
Yeah, don’t use importer.load(), you break platform independence
@normen said:
Yeah, don't use importer.load(), you break platform independence
@Normen: The SyncFailedException happens in jMP, correct? Then shouldn't this bug be fixed?
@Momoko_Fan said:
@Normen: The SyncFailedException happens in jMP, correct? Then shouldn't this bug be fixed?
Yeah that one never had any consequences and is also fixed now.
Hi all, I have now installed JME as it is intended to be used (I believe), updated it up to nightly build and got exactly the same inconsistency as before with the mesh.xml - but now only with the j3o file.
The textures/material is displayed when I run it on the desktop version, but shows a black material/texture on the android device. My material (as described above) and j3o files are used for the model. On Desktop full texture is displayed and mapped correctly. - on android the objects are turned black unless I set the material using code.
Also - all the sounds are very jittery, the version of my project which I converted to use in JME platform uses Audio nodes to pay wav files. This happens with play() and playInstance(). Very brief parts of the correct sounds are played - all sounds are affected in this way. - android not playing any sound in this version.
Oh and I’m back to using assetMng.loadModel()
@Empire Phoenix, nope am running Ubuntu - do not have antivirus running atm. Only standard firewall.
rootNode has a white colored ambient light attached.
Since my nightly build update today the sounds are fixed on Desktop - Sounds not working on android.
The model still remains black on android.
The sound issue have something to do with filenotfound - works perfectly on Desktop version though.
Everything exactly the same vs my old setup which worked perfectly on both desktop and android except for the black models.
Some of the weirder logs I have had, Please Check if of any particular use:
Texturing:
06-12 12:08:41.955: W/TextureUtil(12787): WARNING TextureUtil 12:08:41 PM - Image is not POT, so scaling it to new resolution: 256x128
06-12 12:08:41.960: I/AndroidImageInfo(12787): Bitmap was deleted.
06-12 12:08:41.970: W/TextureUtil(12787): WARNING TextureUtil 12:08:41 PM - Image is not POT, so scaling it to new resolution: 256x128
06-12 12:08:41.975: I/AndroidImageInfo(12787): Bitmap was deleted.
06-12 12:08:41.980: I/AndroidImageInfo(12787): Bitmap was deleted.
06-12 12:08:41.985: I/AndroidImageInfo(12787): Bitmap was deleted.
For sound:
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): SEVERE AndroidAudioRenderer 12:19:22 PM Failed to load sound Sounds/Effects/spark03.wav
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): java.io.FileNotFoundException: Sounds/Effects/spark03.wav
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at android.content.res.AssetManager.openAssetFd(Native Method)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at android.content.res.AssetManager.openFd(AssetManager.java:331)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at com.jme3.audio.android.AndroidAudioRenderer.playSourceInstance(AndroidAudioRenderer.java:333)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at com.jme3.audio.AudioNode.playInstance(AudioNode.java:198)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.frontend.modules.ResourcesModule.playRandomSparkSound(ResourcesModule.java:219)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.frontend.effects.weapons.SparkEffectNode.startEffect(SparkEffectNode.java:85)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.frontend.effects.weapons.EffectNode.start(EffectNode.java:22)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.frontend.objects.actors.GuardianActorNode.onActorAttack(GuardianActorNode.java:118)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.frontend.PlayView.onActorAttack(PlayView.java:897)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.model.gameinstance.survival.DefaultSurvivalGameInstanceV2.runGuardianActivityStrategy(DefaultSurvivalGameInstanceV2.java:162)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.model.gameinstance.survival.DefaultSurvivalGameInstanceV2.runAliveHumanoidManagementStrategy(DefaultSurvivalGameInstanceV2.java:80)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.model.gameinstance.survival.DefaultSurvivalGameInstanceV2.updateGameState(DefaultSurvivalGameInstanceV2.java:62)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.model.gameinstance.GameInstance.updateGame(GameInstance.java:45)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.model.GameModel.updateGame(GameModel.java:123)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at org.somegame.frontend.PlayView.simpleUpdate(PlayView.java:504)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at com.jme3.app.SimpleApplication.update(SimpleApplication.java:241)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at com.jme3.app.AndroidHarness.update(AndroidHarness.java:411)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:309)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
06-12 12:19:22.865: E/AndroidAudioRenderer(13971): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
And lots of these:
06-12 12:19:21.370: W/OGLESShaderRenderer(13971): value is not set yet.
06-12 12:19:21.375: W/OGLESShaderRenderer(13971): value is not set yet.
Hope my comments help.
Actually those logs are very useful. I know what the issue is now. It will be fixed soon.
Thanks for the feedback - I will report all anomalies I find
The sound issue cannot be fixed with the android sound player as it cannot read streams from a jar file, it has to be an android asset or stored on the android disk directly. We’ll need to switch to another sound library for android.
A workaround is to copy your sounds assets in the android asset folder when building your apk