Collada importer and Bumpmapping

as the topic says, how do i get bumpmapping from collada to jme?



in the jme test, it used copytexturecoordinates on the mesh, but the loaded model is a sharedmesh which doesnt allow copy texture coordinates. what should i do?

SharedMesh uses some other mesh as a reference. You need to access that mesh through SharedMesh.getTarget() and then you can copy the coords.

Momoko_Fan said:

SharedMesh uses some other mesh as a reference. You need to access that mesh through SharedMesh.getTarget() and then you can copy the coords.


so in other words theres no way for the collada importer to load the bump map from the model file directly?

and for the on fly way, all i need to do is get the texturestate from the mesh and add a bump map into it then copy the existing texture to the bump map?

thx for the answer but i dont think it is actually possible for me to do that simply because there r so many meshes in my game which need to be bump mapped.



i believe the best way to do this is letting the artists finish bump mapping in maya and export to collada and somehow load it into jme.



so how do i do that or is it already supported by jme?

There are many ways to handle bump maps, I don't know how bump maps are presented in the collada format so I can't say for sure if they can be loaded or not.



You are gonna need to either convert the model first and then apply the bumpmap, or apply it right after you load it.

To add the bump map you need to access the TextureState for the spatial and put it in a vacant texture unit, then copy the texture coordinate buffer for the mesh over to that unit. You will also need a shader to be applied to the model to handle the bump mapping (see the tests).

Is it possible to do this way?



1 - Create the models in maya, blender or so WITH bump mapping;

2 - Import the models with a custom test that applies the bump mapping with the mentioned aproach;

3 - Save the new Node in .jme format (at least it will keep the texture information for the shader);

4 - Use this models in the game with bump-shader enabled nodes;

5 - This'd be a standard path that can be automated leaving the free room for the artists…



Is this a good way of achieving it?

that would work nicely if the model only has a few textures need to be bump mapped. in my situation, i have alot of meshes need to be bump mapped. and each of them use a different bump map which make it very annoying to do it the way u said.

Indeed…

You could do this with a simple hack. If you can assign more than 1 texture to a mesh in collada, you can make it known to your program that a certain texture is a bump texture (such as having a special extension like model_tex.bump.png) then you apply the bump effect to that mesh using the texture.

Momoko_Fan said:

You could do this with a simple hack. If you can assign more than 1 texture to a mesh in collada, you can make it known to your program that a certain texture is a bump texture (such as having a special extension like model_tex.bump.png) then you apply the bump effect to that mesh using the texture.


ill try this hack lol thx