So im new to JME, been doing java a while now (just finishing comp programming 2 last semester, and ive been using netbeans so all is familiar) and im okay with it.
And I wanted to put “my own” model in the scene (a random one that wasnt provided to me by the JME samples was the point)
so i went here
http://www.turbosquid.com/FullPreview/Index.cfm/ID/261604
Found this free model, installed blender, put in the plugin using the SDK (with some trouble but I think I got it working). Converted it in blender. Adding it using import model in the SDK. It gave me 5 files. with weird names. I renamed all to guy and had guy.material, +guy.material, guy.mesh.xml, guy.bmp, and guy. scene. They were all in the model folder so I sorted the materials into the materials, texture into the texture, and scene into the scene folders.
i used the code in tutorial 3 for inserting the teapot
[java]Spatial teapot = assetManager.loadModel(“Models/Teapot/Teapot.obj”);
Material mat_default = new Material(
assetManager, “Common/MatDefs/Misc/ShowNormals.j3md”);
teapot.setMaterial(mat_default);
rootNode.attachChild(teapot);[/java]
and mine was this
[java]Spatial man = assetManager.loadModel(“Models/guy.mesh.xml”);
Material mat_default = new Material(
assetManager, “Materials/+guy.material”);
mat_default.setTexture(“ColorMap”,
assetManager.loadTexture(“Textures/guy.bmp”));
man.setMaterial(mat_default);
rootNode.attachChild(man);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
rootNode.addLight(sun);[/java]
I run it, get the jme opening video settings screen, click ok, get the jme window thats black for about 3 seconds, then it closes. What is the problem. Where did I go wrong. I dont know much about 3d modeling or formats. Also I dont have the best mastery of java and i make mistakes but I havent really changed anything here except the file paths and copies a few more lines for the texture and for the light source. and I have imported all the correct things, no problems there.
Thanks for the help, im sorry I have to ask such beginner questions but that’s what I am, trying to get some experience in programming and using this engine.
@jmanelson said:I run it, get the jme opening video settings screen, click ok, get the jme window thats black for about 3 seconds, then it closes.
*crashes. What is in the stack trace (Output view in NetBeans)?
run:
Jan 13, 2012 9:12:03 PM com.jme3.system.JmeSystem initialize
INFO: Running on jMonkeyEngine 3.0.0 Beta
Jan 13, 2012 9:12:03 PM com.jme3.system.Natives extractNativeLibs
INFO: Extraction Directory: C:UsersJmanDocumentsJME3 ProjectsLantern Glow
Jan 13, 2012 9:12:03 PM com.jme3.system.lwjgl.LwjglAbstractDisplay run
INFO: Using LWJGL 2.8.2
Jan 13, 2012 9:12:03 PM com.jme3.system.lwjgl.LwjglDisplay createContext
INFO: Selected display mode: 1280 x 720 x 0 @0Hz
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Adapter: nvd3dumx,nvwgf2umx,nvwgf2umx
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Driver Version: 8.17.12.7533
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Vendor: NVIDIA Corporation
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: OpenGL Version: 3.3.0
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Renderer: GeForce GTX 260/PCI/SSE2
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: GLSL Ver: 3.30 NVIDIA via Cg compiler
Jan 13, 2012 9:12:04 PM com.jme3.system.lwjgl.LwjglTimer
INFO: Timer resolution: 1,000 ticks per second
Jan 13, 2012 9:12:04 PM com.jme3.renderer.lwjgl.LwjglRenderer initialize
INFO: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, TextureMultisample, OpenGL20, OpenGL21, OpenGL30, OpenGL31, OpenGL32, ARBprogram, GLSL100, GLSL110, GLSL120, GLSL130, GLSL140, GLSL150, VertexTextureFetch, TextureArray, TextureBuffer, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, TextureCompressionLATC, NonPowerOfTwoTextures, MeshInstancing, VertexBufferArray]
Jan 13, 2012 9:12:04 PM com.jme3.asset.DesktopAssetManager
INFO: DesktopAssetManager created.
Jan 13, 2012 9:12:04 PM com.jme3.renderer.Camera
INFO: Camera created (W: 1,280, H: 720)
Jan 13, 2012 9:12:04 PM com.jme3.renderer.Camera
INFO: Camera created (W: 1,280, H: 720)
Jan 13, 2012 9:12:04 PM com.jme3.input.lwjgl.LwjglMouseInput initialize
INFO: Mouse created.
Jan 13, 2012 9:12:04 PM com.jme3.input.lwjgl.LwjglKeyInput initialize
INFO: Keyboard created.
Jan 13, 2012 9:12:04 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: AudioRenderer supports 64 channels
Jan 13, 2012 9:12:04 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio effect extension version: 1.0
Jan 13, 2012 9:12:04 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio max auxilary sends: 4
Jan 13, 2012 9:12:04 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Unshaded
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Gui Node)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Statistics View)
Jan 13, 2012 9:12:04 PM com.jme3.scene.Node attachChild
INFO: Child (Statistics View) attached to this node (Gui Node)
Jan 13, 2012 9:12:04 PM com.jme3.scene.plugins.ogre.MeshLoader load
WARNING: Cannot locate Models/guy.material for model Models/guy.mesh.xml
Jan 13, 2012 9:12:05 PM com.jme3.scene.plugins.ogre.MeshLoader applyMaterial
WARNING: Cannot locate Material01 for model Models/guy.mesh.xml
Jan 13, 2012 9:12:05 PM com.jme3.scene.Node attachChild
INFO: Child (guy-geom-1) attached to this node (guy-ogremesh)
Jan 13, 2012 9:12:05 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureImage
WARNING: Cannot locate Materials/Male1kop.bmp (Mipmaped) for material Material01
Jan 13, 2012 9:12:05 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: scale
Jan 13, 2012 9:12:05 PM com.jme3.scene.plugins.ogre.MaterialLoader readTextureUnitStatement
WARNING: Unsupported texture_unit directive: colour_op_ex
Jan 13, 2012 9:12:05 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Phong Lighting
Jan 13, 2012 9:12:05 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.ClassCastException: com.jme3.material.MaterialList cannot be cast to com.jme3.material.MaterialDef
at com.jme3.material.Material.(Material.java:133)
at mygame.Main.simpleInitApp(Main.java:40)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:231)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:722)
Jan 13, 2012 9:12:05 PM com.jme3.renderer.lwjgl.LwjglRenderer cleanup
INFO: Deleting objects and invalidating state
Jan 13, 2012 9:12:05 PM com.jme3.input.lwjgl.LwjglMouseInput destroy
INFO: Mouse destroyed.
Jan 13, 2012 9:12:05 PM com.jme3.input.lwjgl.LwjglKeyInput destroy
INFO: Keyboard destroyed.
Jan 13, 2012 9:12:05 PM com.jme3.system.lwjgl.LwjglAbstractDisplay deinitInThread
INFO: Display destroyed.
BUILD SUCCESSFUL (total time: 4 seconds)
well, think positive, at least at the end you got:
“BUILD SUCCESSFUL (total time: 4 seconds)” xD
i know this may sound harsh, but the best way to stop being a beginner and start learning is to try to figure it out by yourself
try to give it more time and keep at it, if you cant figure it out, try smaller and simpler and work your way slower up…
all that being said, everyone needs a helping hand from time to time, and i think i spot an error, regarding how the light is handled:
Material mat_default = new Material(assetManager, “Materials/+guy.material”);
look carefully at this line and compare it with the one in the tutorial…
(i really dont want to say what i think should go there to give you more time with the code… try to figure it out)
cheers mate…
PD: i could be wrong about my guess though
edit: oh, and do read this tutorial:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:light_and_shadow
kicks ass and might solve your problem too.
(ill take this time to thank again to the great JME3 team for the great tutorials, they really make all the difference :))
@dixel said:
well, think positive, at least at the end you got:
"BUILD SUCCESSFUL (total time: 4 seconds)" xD
i know this may sound harsh, but the best way to stop being a beginner and start learning is to try to figure it out by yourself :)
try to give it more time and keep at it, if you cant figure it out, try smaller and simpler and work your way slower up...
all that being said, everyone needs a helping hand from time to time, and i think i spot an error, regarding how the light is handled:
Material mat_default = new Material(assetManager, "Materials/+guy.material");
look carefully at this line and compare it with the one in the tutorial... ;)
(i really dont want to say what i think should go there to give you more time with the code.... try to figure it out)
cheers mate...
PD: i could be wrong about my guess though :)
edit: oh, and do read this tutorial:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:light_and_shadow
kicks ass :) and might solve your problem too.
(ill take this time to thank again to the great JME3 team for the great tutorials, they really make all the difference :))
Dixel, thanks a bunch. Truly thanks, I appreciate it. and sbook as well, I will work at this. I have tried with the non + material also and no luck but I will give it more time. I know its different because the teapot example uses an .obj and has a mat that's .j3md. Also there's a different code for doing with the mesh.xml that doesnt even have a texture code in it but it still has texture (its the ninja). And I think this is because if i am using the ogre format directly I need to use a separate folder for this model. But I would like to convert to j3o and j3md and i got the j3o but not the j3md (material). Ill try using the folder method and see how it goes and see if i can figure out the jme3 formats after.
thats the spirit
on the advanced tutorials, theres materials tutorials and i think i saw something about convertion somewhere too…
if you get stuck, i really suggest starting from somewhere simple and making smaller modifications till you get where you want…
cheers…