Wavefront .obj files look very weird

Hello again!

I’m making a game using a “tile system”. After finishing my first tiles and exporting them I get this:

Deled model:

After exporting to .obj format and previewing in jME:

When I tested that obj file in MeshLab and reimported to deleD everything still looked fine and ok…

Maybe this code might help you(my obj import class):

package engine;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import com.jme.bounding.BoundingSphere;
import com.jme.scene.Node;
import com.jme.scene.Spatial;
import com.jme.util.export.binary.BinaryImporter;
import com.jme.util.resource.ResourceLocatorTool;
import com.jme.util.resource.SimpleResourceLocator;
import com.jmex.model.converters.ObjToJme;

public class ObjLoader{
   public static Node GetObjFromLocation(String ObjFileLoc, String TexFolderLoc){
        try {
                 new SimpleResourceLocator(ObjLoader.class.getResource(TexFolderLoc)));
      } catch (URISyntaxException e){e.printStackTrace();}
      Node model = new Node();
      ObjToJme converter = new ObjToJme();
      try {
         URL objFile = ObjLoader.class.getClassLoader().getResource(
         converter.setProperty("mtllib", objFile);
         ByteArrayOutputStream BO = new ByteArrayOutputStream();
         converter.convert(objFile.openStream(), BO);
              new ByteArrayInputStream(BO.toByteArray())));
         model.setModelBound(new BoundingSphere());
      } catch (IOException e) {
         System.out.println("Error while loading obj: "+ObjFileLoc);
      return model;

It might be problem with texture coords, possibly they are not exported together with model information?

Make sure that it does export coords (should do it by default) and that mesh uses correct map channel.

What 3d software you use?

Could you host the object and the texture, I'll check it out and see if I was right :slight_smile:


Delgine Deled 2.0

I think I got this problem solved. I remodeled my model using triangles… And I checked texture mapping to be sure if everything is ok. And the problem disappeared :slight_smile:

I used directional light and it looks very ugly now…

Please check that file http://www.hot.ee/karvanahk/grass4.zip

Could I see how it should look? In Deled?

In 3ds I get this after importing:


Object is covered with a multi material, green ones are mat id 1, dark ones are mat id2, at first I thought there might be some normals issue but they seem to be alright.