Blender Loader feedback

Really good work! ^^



But I have problems with textures/images…


java.lang.IllegalStateException: Invalid texture format for blending operation: BGR8
at com.jme3.scene.plugins.blender.helpers.v249.TextureHelper.blendTexture(TextureHelper.java:1095)
at com.jme3.scene.plugins.blender.helpers.v249.MaterialHelper.toMaterial(MaterialHelper.java:196)
at com.jme3.scene.plugins.blender.helpers.v249.MaterialHelper.getMaterials(MaterialHelper.java:470)
at com.jme3.scene.plugins.blender.helpers.v249.MeshHelper.toMesh(MeshHelper.java:268)
at com.jme3.scene.plugins.blender.helpers.v249.ObjectHelper.toObject(ObjectHelper.java:178)
at com.jme3.scene.plugins.blender.utils.JmeConverter.toObject(JmeConverter.java:123)
at com.jme3.scene.plugins.blender.BlenderModelLoader.load(BlenderModelLoader.java:131)
at com.jme3.scene.plugins.blender.BlenderModelLoader.load(BlenderModelLoader.java:71)

As far as i see it from the code only 3 formats (ABGR8, RGB8 and Luminance8) are supported.
I toke i quick look at the source but can't find a quick fix. ^^

Ok i think i found a solution.

I added the following…

[java]

} else if (format == Format.BGR8) {

texPixel[2] = texPixel[0];

pixelValue = data.get();

texPixel[1] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;

if(neg) {

texPixel[1] = 1.0f - texPixel[1];

}

pixelValue = data.get();

texPixel[0] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;

if(neg) {

texPixel[0] = 1.0f - texPixel[0];

}

this.blendPixel(resultPixel, materialColor, texPixel, 1.0f, affectFactor, blendType, dataRepository);

newData.put(dataIndex++, (byte) (resultPixel[0] * 255.0f));

newData.put(dataIndex++, (byte) (resultPixel[1] * 255.0f));

newData.put(dataIndex++, (byte) (resultPixel[2] * 255.0f));

[/java]

and

[java]

} else if (format == Format.RGBA8) {

pixelValue = data.get();

texPixel[1] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;

if(neg) {

texPixel[1] = 1.0f - texPixel[1];

}

pixelValue = data.get();

texPixel[2] = pixelValue >= 0 ? 1.0f - pixelValue / 255.0f : (~pixelValue + 1) / 255.0f;

if(neg) {

texPixel[2] = 1.0f - texPixel[2];

}

data.get(); // ignore alpha

this.blendPixel(resultPixel, materialColor, texPixel, 1.0f, affectFactor, blendType, dataRepository);

newData.put(dataIndex++, (byte) (resultPixel[0] * 255.0f));

newData.put(dataIndex++, (byte) (resultPixel[1] * 255.0f));

newData.put(dataIndex++, (byte) (resultPixel[2] * 255.0f));

[/java]

OK, I belive you used the ‘Image texture’ and had one that was in BGR format.



It seems like I focused on generated textures too much :stuck_out_tongue:

They are all in RGB8 or Luminance8 formats.

Right i’m using “image texture” and uv mapped meshes. ^^



Another thing is that my mesh object has 3 textures:

  1. diffuse
  2. normal map
  3. specular map



    I think the all get blended together as diffuse texture. I suppose normal and specular is not supported right now, is it?

Normal and specular textures are supported too.

But maybe there is some kind of bug. :wink:

I will try the use of those too and let you know.

Kaelthas said:
Normal and specular textures are supported too.

Oh that sounds great! ^^

Kaelthas said:
But maybe there is some kind of bug. ;)
I will try the use of those too and let you know.

Thanks! If i can help in any way let me know.

If you need my blend file i can provide it.

Yeah,

the blend file could be cool :slight_smile:

Ok here is my blender 2.57 file…



WoodCrate.blend



and the texture images



WoodCrate_lighter.png

WoodCrate_lighter - Height Map.png

WoodCrate_lighter - (Inverted Normal Map).png



It’s a simple box with textures. ^^

A very funny thing that happens to me when I enable the blender plugin is I can’t open any projects. If I try to open a project at the top right corner of the folder navigator where it specifies the project name, it just keeps on saying “Please Wait…” and I am rendered unable to open any projects. If i disable it, all works fine.

Is this a common problem? Is there a way to fix it?

My first post on these wonderously lovely forums, Hi all! :smiley:



EDIT : I feel a bit awkward for not waiting the extra 2 hours. Downloaded the latest updates, and they solved the issue at hand! I can convert .blend files to .j3o now! And everything else works too! Wonderful :smiley:

OK, I know it took me long time, but finally I solved the problem.

When the material had normal map set and used vertex coloring then it didn’t show up on the model.

I disabled vertex colors when the normal texture is set.



But I’m not sure if the fact that those two cannot appear at the same time is a bug or feature :smiley:

If someone knows that - please let me know :wink:

1 Like

Hi, I have got some feature requests. If I may:

1 Import “Empties” in blender as empty nodes.

2 Import custom properties of an object from blender to j3o node. j3o node now has custom properties.



Uploaded with ImageShack.us

mifth said:
Hi, I have got some feature requests. If I may:
1 Import "Empties" in blender as empty nodes.
2 Import custom properties of an object from blender to j3o node. j3o node now has custom properties.

Uploaded with ImageShack.us


if by empty nodes you mean they can be used as location markers, like for setting up spawn points and such yeah that will be cool.........as for the loader all the test files that seem to have in animations our textures crash the test app in jme3....for me.........just took a quick look over the weekend, should have posted them then but.... I can throw u a couple stack traces if u like when I get home

yeah, empty node with location, scale translation… spawn point. :slight_smile:

Empties are being loaded from the beggining :slight_smile:

I’ll just look if I didn’t forget to give them proper names.



OK I’ll add custom properties as soon as possible.

As soon as I finish issue with mirror modifier :wink:



@mcbeth

Post the files that crash here. I’ll look into them.

Kaelthas said:
@mcbeth
Post the files that crash here. I'll look into them.

well I was testing the files you uploaded to the repo, didn't have time to test any of mine, I'll give you a list of those that crashed and see if I can load any of mine ASAP
Kaelthas said:
OK, I know it took me long time, but finally I solved the problem.
When the material had normal map set and used vertex coloring then it didn't show up on the model.
I disabled vertex colors when the normal texture is set.

Thanks! Seems to be ok now. ^^

Kaelthas said:
But I'm not sure if the fact that those two cannot appear at the same time is a bug or feature :D
If someone knows that - please let me know ;)

Hm... well not sure about this.

hi @Kaelthas



if i do import my blender file within JMP all layers will be imported and not just the active.

The ManualBlenderTester works as expected and imports only the active layer.



Could you confirm this “bug”?

After JMP update I can’t load .blend models now. Log says:

[java]

java.lang.NullPointerException

at com.jme3.scene.plugins.blender.helpers.v249.MaterialHelper.toMaterial(MaterialHelper.java:256)

at com.jme3.scene.plugins.blender.helpers.v249.MaterialHelper.getMaterials(MaterialHelper.java:566)

at com.jme3.scene.plugins.blender.helpers.v249.MeshHelper.toMesh(MeshHelper.java:268)

at com.jme3.scene.plugins.blender.helpers.v249.ObjectHelper.toObject(ObjectHelper.java:179)

at com.jme3.scene.plugins.blender.utils.JmeConverter.toObject(JmeConverter.java:131)

at com.jme3.scene.plugins.blender.BlenderModelLoader.load(BlenderModelLoader.java:132)

at com.jme3.scene.plugins.blender.BlenderModelLoader.load(BlenderModelLoader.java:71)

at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:240)

at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:373)

at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:383)

at mygame.gui.inithud.init(inithud.java:97)

at mygame.Main.simpleInitApp(Main.java:154)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:223)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:124)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:200)

at java.lang.Thread.run(Thread.java:662)

[/java]

Fixed in SVN

Works now, thanks !