Loading .obj and .mtl in JME3

@pspeed could you please help me out with the texture mapping? Ive tried everything and nothing works :frowning: :cry:

@HITman said: @pspeed could you please help me out with the texture mapping? Ive tried everything and nothing works :( :cry:

Well, either your object has texture coordinates or it doesn’t. If it doesn’t then there’s nothing any of us can do.

Either way, stop setting a light map that isn’t a light map.

Blender tutorials: @abies said it for me, too. I’m a 3DS Max guy trying to learn Blender (among other things), so not the best one to recommend blender tutes, though I do highly recommend Andrew Price’s YouTube channel.

@HITman said: also i updated the code to include the texture loading. and switched to the pawn. but all i see is a white silhouette of it. [java]assetManager.registerLocator("D:\Files\LUMS\Spring 2014\AP\Blender Files",FileLocator.class); Spatial pawn = assetManager.loadModel("Pawn.obj"); pawn.setLocalTranslation(0.0f, -5.0f, -2.0f); Material mat_default = new Material( assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // mat_default.setTexture( "ColorMap", assetManager.loadTexture("" )); mat_default.setTexture("ColorMap", assetManager.loadTexture("Carrara-White-Marble.jpg")); mat_default.setBoolean("SeparateTexCoord",true); mat_default.setTexture("LightMap", assetManager.loadTexture("Carrara-White-Marble.jpg")); pawn.setMaterial(mat_default);[/java]
Try getting rid of your LightMap line, as @pspeed suggests.

Also, I’m not sure why you need the SeparateTexCoord set. Try it with and without.

If you look at the “Hello Material” tutorial you can see that all they add is the ColorMap:

[java] /** A simple textured cube – in good MIP map quality. */
Box cube1Mesh = new Box( 1f,1f,1f);
Geometry cube1Geo = new Geometry(“My Textured Box”, cube1Mesh);
cube1Geo.setLocalTranslation(new Vector3f(-3f,1.1f,0f));
Material cube1Mat = new Material(assetManager,
“Common/MatDefs/Misc/Unshaded.j3md”);
Texture cube1Tex = assetManager.loadTexture(
“Interface/Logo/Monkey.jpg”);
cube1Mat.setTexture(“ColorMap”, cube1Tex);
cube1Geo.setMaterial(cube1Mat);
rootNode.attachChild(cube1Geo);[/java]

I really liked this series of blender basics tutorials for getting started with blender, when starting from scratch:

1 Like

@loopies, thanks for that :slight_smile:

I missed that one and BlenderForNoobs (which I found exploring BornCG :slight_smile:

I’ve done what @abies suggests in reverse, used a lot of blender tutes to give me ideas in Max, so I know it works in that direction at least.