[SOVLED] Problems Converting to j3o

So I’m trying to import my space ship model to a project in jME SDK 3.1.0-beta1_xbuf-SNAPSHOT and I can’t seem to get it to convert to a j3o properly. When right clicking the blend file and selecting convert to j3o binary the UV coordinates in the resulting j3o are messed up. When I export from Blender to ogreXML selecting convert to j3o works and the UV coordinates are fine except it doesn’t generate tangents so the normal map doesn’t work. Selecting “Advanced JME Binary convert” on the ogreXML and ensuring that generate tangents is checked I get the error “Error extracting OgreXMLTools: java.io.IOException: Stream Closed”

1 Like

Make sure you keep one UV and remove other UVs in blender.

1 Like

You have to change one setting in blender!
Go to your texture material and set the (texture) coordinates to UV. Could be that option “Generated” is selected.

1 Like

Thanks for the replies, however, there is only one UV map layer on the mesh and all the textures have the UV Map correctly selected as mapping coordinates. Plus the UV coordinates work when exporting to OgreXML and then converting to j3o, just not when converting the blend file directly to j3o. The problem with OgreXML is that it errors out when trying to generate tangents.

1 Like

Can you please put a screen shot of model in j3o ?

1 Like

The top one is from Blender, the bottom one is from OgreXML without tangents.

I tried using the advanced jme binary convert in jME 3.0 stable too and got the same error so I guess it’s a linux thing, I gave proper read/write permissions to the SDK install directories.

Created and saved with Blender version 2.77a

1 Like

Does it imports well when you remove normal map?
if your normal map and diffuse map are in png format can you please convert them to jpg then import ?

1 Like

Texture looks like maybe it’s y-flipped. You might be able to fix it in the material.

1 Like

Important hint :
You should generate tangents when you import models that have normal map
so please call TangentBinormalGenerator.generate(mesh); on your model

see http://jmonkeyengine.github.io/wiki/jme3/intermediate/how_to_use_materials.html#optional-bumpy

1 Like

Shouldn’t the tangents be already generated by the Blender Importer?

Anyway you can give xbuf a try if you feel like you have the time to try yet another thing.
The SDK is then capable of importing a pure xbuf file to a native j3o, just like with ogremesh

1 Like

Thanks @pspeed flipping the textures on the Blender j3o worked, but it still doesn’t generate tangents. I’m just using the converter by right clicking on the file in the SDK and converting to j3o, how do I instruct it to generate tangents?

@Darkchaos How do I use xbuf?

1 Like

Nope, blender importer does not imports tangents. (At least was not working prior to 3.1 alpha 5 when i moved to xbuf)

Xbuf importer supports importing tangents in latest version (0.9.1)
You should download JME SDK 3.1-beta1-b002-SNAPSHOT which comes with xbuf v9.1 if i am right ?

@Tryder you may try with Xbuf if there was no success with blender importer.

1 Like

Err you need the latest xbuf blender plugin to install it as an addon.
Then you select “Xbuf Renderer” instead of Cycles/Internal and in the Renderer Settings (Where all blender settings are) you can change the path to your asset folder (it copies the textures there)

Then File->Export .xbuf.

Last time I checked it didn’t really export tangents, though, so you have to see if/how it works.
On the other hand the SDK can generate those tangents, I believe by right clicking on a geometry/mesh?

1 Like

Ah yes. You can also generate this way.

1 Like

Great, got the Blender j3o working and generated tangents, but now it looks like this:

I am using my own shader which is just so I can do the canopy, but when I tried it using lighting.j3md I got the same results, just no canopy.

Here it is with lighting.j3md:

The lighting is flipped because in lighting.j3md there is:

//Note the -2.0 and -1.0. We invert the green channel of the normal map, 
//as it's complient with normal maps generated with blender.
//see http://hub.jmonkeyengine.org/forum/topic/parallax-mapping-fundamental-bug/#post-256898
//for more explanation.
vec3 normal = normalize((normalHeight.xyz * vec3(2.0,-2.0,2.0) - vec3(1.0,-1.0,1.0)));

In mine I flipped the green channel back and just got similar terrible results, but flipped so the light at least is displayed on top of the craft.

1 Like

I got it figured out, I’m using the alpha channel on the normal map as a mask to mix between the canopy shader and body shader. Apparently when I saved out the normal map with GIMP it didn’t save the color value of the transparent pixels.

1 Like