Material import with no bump/normal mat

hello,



i try to have my normal maps imported when i export a model from blender with the ogre mesh exporter, but it does not export any normalMap setting in the material file



so i tried to modify the material from the loaded asset but as i do



mat.setTexture(“NormalMap”, assetManager.loadTexture(“Textures/house_norms.png”));



it does not seem to load the uvs correctly


  • what do i do wrong ?


  • mat.setParam(“ParallaxHeight”, VarType.Float, “0.1”); is it linked to NormalMap ?


  • how come the files exported with the script are .material and if i want to have the material editor running, i would have to rename all the files into j3m ? am i correct



    this is a bit confusing

A screenshot, please.

In order to get your normal map to show you need to generateTangents on your object… I think you can do that via code, or via the scene explorer window… right click on the object (in the little window with all the object names) and it should give you the option to generate tangents… The your normal map should show up if nothing else goofy is going on



I’ve tried importing normals and such through blender and i haven’t had much success… I usually just make a .j3m material and apply it (make sure your model has been uv unwrapped and has a material assigned to it in blender)

@kbender88 said:
In order to get your normal map to show you need to generateTangents on your object... I think you can do that via code, or via the scene explorer window... right click on the object (in the little window with all the object names) and it should give you the option to generate tangents... The your normal map should show up if nothing else goofy is going on

I've tried importing normals and such through blender and i haven't had much success... I usually just make a .j3m material and apply it (make sure your model has been uv unwrapped and has a material assigned to it in blender)


the binormal has been set up in my code
it is more an uv problem than the binormal tangents gen problem

i still dont understand why some materials are ".material" and if i create a new material in jme platform, it is named ".j3md" with a completely different syntax
i have been checking documentation, i still don't understand why the ogre exporter is not producing ".j3md" files. if i convert a mesh from blender, it also generates a +something.material" file
it does not make much sens
@mifth said:
A screenshot, please.


how do i upload a picture on this forum (if possible)

under “upload image…” button :).

here is the code, model is loaded from blender (uvs, and textures)



apparentely, the material from blender is PhongLighting

Code:
Spatial houseModel = DataManager.LoadModel("Models/House/House.j3o");
    Geometry house = tools.findGeom(houseModel, "House-geom-1");
    house.setLocalTranslation(pos);
    house.setLocalRotation(rot);
    
    Material mat = house.getMaterial();
 //   mat.setTexture("ParalaxMap", DataManager.LoadTexture("Textures/house_bumps.png"));
    mat.setTexture("NormalMap", DataManager.LoadTexture("Textures/house_norms.png"));
    mat.setParam("ParallaxHeight", VarType.Float, "0.1");
    TangentBinormalGenerator.generate(house);

    CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node) houseModel);
    
    RigidBodyControl houseBody = new RigidBodyControl(sceneShape, 0);
    houseBody.setCollisionGroup(Main.groundCollisionGroup);
    houseModel.addControl(houseBody);
    rootNode.attachChild(houseModel);
    bulletAppState.getPhysicsSpace().add(houseModel);

    houseModel.setShadowMode(ShadowMode.Receive);
    
    rootNode.attachChild(house);</div>

and the screenshot where the bump is not even showing anymore (pffff)

http://imgur.com/5ragj

here is a try i have made in the jme platform : http://imgur.com/Jwtrx
i added a j3m file to the ouse in the scene editor
it seems to work, but how am i suppose to tune the bump height ? it is to bumpy on the picture

grrr this shit is really pissing me off

i added a bumpy mat in the scene editor, so the house display a “nice” bump

i use a normal map texture



but,as i add the map programaticaly to the house (so it won’t get wiped out if i redo the export in blender)

it is displaying all black in the game

@rompelstilchen said:
how do i upload a picture on this forum (if possible)


Just use this cool service (you can use it event with Facebook/Google accounts):
www.imgur.com

About normalmaps:
just create a new JME material and set the normalmap there. Then assign JME material to your Model.
[java]
house.setMaterial(mat);
[/java]

make sure you have generated tangents, and like mifth said, use j3m files for jme shader/material definition based materials.


it is displaying all black in the game


tangents or no light(or black ambient and specular color in material) ;)
@oxplay2 said:
make sure you have generated tangents, and like mifth said, use j3m files for jme shader/material definition based materials.



tangents or light ;)

@mifth said:
Just use this cool service (you can use it event with Facebook/Google accounts):
www.imgur.com

About normalmaps:
just create a new JME material and set the normalmap there. Then assign JME material to your Model.
[java]
house.setMaterial(mat);
[/java]


well i have done all that

strange the house is showing up in the scene editor
but not in the game(black painted)

everything else is displaying correctly

i use a directional light (sun) in my scene, so it should display right

use ambient light too, if you use directional light and it dont work it can be also becouse of tangents or black specular color



in SceneComposer you propably use camera light so it is visible.



if you dont see it ingame, then propably becouse of “black specular color”, but it still can be tangents problem, dunno.

you override material ingame yes? if not, then its only becouse of light issue



edit:



using normal maps need to have tangents, so you can always generate tangents for your object in code:



[java]TangentBinormalGenerator.generate(object);[/java]




i use a directional light (sun) in my scene, so it should display right


not if specular color is black, that is why i wanted you to add ambient light(if you dont have it black ambient color too...).
@oxplay2 said:
use ambient light too, if you use directional light and it dont work it can be also becouse of tangents or black specular color

in SceneComposer you propably use camera light so it is visible.

if you dont see it ingame, then propably becouse of "black specular color", but it still can be tangents problem, dunno.
you override material ingame yes? if not, then its only becouse of light issue

edit:

using normal maps need to have tangents, so you can always generate tangents for your object in code:

[java]TangentBinormalGenerator.generate(object);[/java]




not if specular color is black, that is why i wanted you to add ambient light(if you dont have it black ambient color too...).


yes it was a light issue, thanks mate

i guess it is all about tweaking, but as i am trying to have a bump wall texture, normal maps seem to be a little bit to weak as an effect, then i would use parallax
the problem is that it always look nice on the deepnes of the bumps and so, but it always looks shiny like an environement map as i navigate around the house in scene editor

i have set the shininess to 0 then the object shows up discarding the shiny parts

hmmm

edit : ok i think i got it, i had to have a clean heightmap texture with no details but the gaps between blocks, also a bit of tweaking on the material

thx everyone

great engine !!