I’m a new jmonkey user and i have a big problem. I’m doing a big house in blender. I chose a floor texture and i need to repeat it a lot. I use UV technic but when i export it whith ogre mesh exporter and i import that in jmonkey, my texture is not repeated. How can I proceed to repeat my texture ? Is there an other exporter which solve that problem ? or an other technic i can use in blender ? I tried to specify a texture coordinate in jmonkey but without success. I know there are a lot of topics about that, but no one could help me.
Thank you in advance
Did you select the “Repeat” option in the image settings?
yes the repeat option is selected. but JMonkey seems not repeat the texture.
Here is my jmonkey code:
sol = assetManager.loadModel(“Models/maison.j3o”);
solcontrol = new RigidBodyControl(0);
geomur = (Geometry) rootNode.getChild(“maison-geom-0”);
not sure if this will help you but I setup a repeating texture on an imported mesh the other day, like this …
Spatial spatial = (Spatial) assetManager.loadModel(“Models/Model.mesh.xml”);
Material mat = new Material(assetManager, “Materials/customPhong.j3md”);
Texture tex = assetManager.loadTexture( new TextureKey(“Models/guide.png”, false) );
((Geometry)((Node) spatial).getChild(0)).getMesh().scaleTextureCoordinates(new Vector2f(40,40));
The important bits being tex.setWrap and scaleTextureCoordinates - the 40,40 means tile the texture 40 times on both U and V.
I have tested it and texture repeating works for both Blender 2.57 and Blender 2.49.
Perhaps you can provide the problematic model file?
Thanks thetoucher. Your solutiopn works fine. However, I would prefer to do everything from blender and export my mesh.
I have blender 2.49.(a the top of blender : 249.2) I have ogre xml exporter you can find here: http://www.ogre3d.org/tikiwiki/Blender+Exporter. I don’t know if there is another version, that’s why I wrote that.
An example in blender:
I delete the initual ucbe and insert a plane. I select al points and ctrl+e for mark seam. I split my area for a uv editor. I select my plane face and u for unwrap. I save my uv face layout. I edit that with Gimp and apply a texture. Then I press F5 and add a material to my plane. Then F6 and add a texture. I load my Image .tga and specify XRepeat and YRepeat (Repeat is checked. I select UV in map input. I see my texture in blender. All is ok. I then return in object mode and export my selected objet. I tried to export obj and ogre meshes exporter but neither has worked.
Do I forget anything ? This is a very simple thing and I don’t understand why it doesn’t work.
I convert my model in jo binary. I type this code in my class:
myObject = assetManager.loadModel(“myFile.j3o”);
myControl = new RigidBodyControl(0);
myGeo = (Geometry) rootNode.getChild(“myFile-geom-0”);
What’s wrong with that ??
No you’re not doing anything wrong it seems.
Perhaps you can provide the model? I did something very similar to what you said and the model appeared correctly for me
I did my textures scales with JMonkey. I Have another problem. I did my house and a lot of objects with blender. I have an ambient light in jmonkey. Textured objects are ok, but colored one’s are white. Their color is the light color. If i set a red color for the ambient light, colored objects (without an image as texture) appear red. What can I do to solve this problem ? I often see forums which talk about material states but i didn’t find any solution. I tried to use directional lights (with diferent directions). Colored objects are ok but some faces are dark. These faces are these which are not visible if i don’t use FaceCullMode off.
So what can I do ?
Thanks in advance
In the Ogre3D exporter, make sure that “Colored Ambient” option is selected
I am using the .obj exporter from blender, not Ogre3d exporter.
The weird thing is that I can see the object correctly with the scene viewer from jmonkey but I can’t see the right colors inside the game with an ambient light. Is there any option to display the original colors and ignore the ambient light color ?
Okay, you said in your previous post you were using the Ogre exporter so I assumed you were still using it.
In any case, search for such an option in the blender exporter, if there is none, then you can either process the model manually after loading it and setting the ambient color to the same thing as the diffuse color.
do you have an example ? How do you set the ambient and diffuse color with jme3 ?
For example, I import a red cube exported in obj format with blender. This cube has no texture but just a red color.
How do you proceed ?
Another question (which could be the solution…)
If i only use an ambient light, i don’t see colored objects, just textured ones. If I add directional lights, i can see colors but some faces are dark or black. (I use a lot of directional lights in different directions so it’s not because these faces are not affected by a light).These faces are those that are not visible if I don’t use FaceCullMode.Off. If i edit the .j3o in scene viewer,I see only one side of these faces(which are dark in the game). Do you have any solution for these faces ?
thanks for your help Momoko_Fan.
I have already seen this page. I did what you said with diffuse. It works. I see my colours. Now I work on shadows. If I use directional lights, some faces are dark. When I edit these objects in the scene viewer, I don’t see these dark faces. It looks like one sided textures. I use two sided in blender but it doesn’t work in JME. I saw a forum with the same problem but there is no solution. Do you have any idea ?
In addition to setting the ambient color to equal the diffuse color, you might also want to disable backface culling, by setting this:
I already use this, but nothing change. I use FaceCullMode.Off. For example I have a wall with a lot of faces. If i edit my wall in the scene viewer, i don’t see all faces. In the game, I see all faces because I use FaceCullMode.Off. I just have a problem with lights (directional). Faces I don’t see in scene viewer are dark in one side (exterior of my wall for example) and ok in the other side (interior). I have some faces dark in one side, and others dark in the other side. Do you see ? Looks like all the faces are illuminated, but some were returned. They are not illuminated on the same side. I do not know if this is related to the textures on both sides of blender, but I tried with the option of two-sided blender, and nothing works.
Here is my problem.
In the first image, you see one side of my wall. All faces are hre, textured, but one is dark.
In the second image,i am in the other side of the wall. you see all faces too, all are textured, but the one which was dark in the first image is illuminated in the second and vice versa.
It’s a normals issue.
Normals are pointing to one side of the wall, so one side appear clear and the other one dark.
You should not use a simple quad for a wall you should either use a box, or at least a really two sided mesh, i mean with faces on each side of the wall.