Creating a flat terrain

Hi, i wondered if it was possible to create a flat terrain with the heightmap method from flagrush, for example in order to have a tennis court or if there were any other better method ?



thank you for your help













I apologise if my english is not perfect , i'm not retard…i'm just french

Yes, by using a heightmap image that is all one solid color you will get a flat terrain. It is probably not the best approach though.



If all you want is a flat surface, then a better approach would be to just use a Quad (See TestQuad.java on how to make one).


jonkille said:

I apologise if my english is not perfect , i'm not retard....i'm just french

Votre anglais est meilleur que mon francais!

thanks a lot. I now have another question. I tried to import a 3DS tennis court model using TestMaxJMEWrite in test renderer but when it is rendered some part of the court appears like textureless. Any idea about how to fix it ?

Post a screen shot if you can. Are there any errors or messages indicating the texture file could not be found by the resource locator?

I attached an example of what i get…and i don't see any error in eclipse so i guess there is none. I also post my code but I can't think about what I would have done wrong


 
package test.tutoriels;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.util.export.binary.BinaryImporter;
import com.jmex.model.converters.MaxToJme;

public class TestChargement extends SimpleGame {

   private static final Logger logger = Logger.getLogger(TestChargement.class.getName());
   
   
   @Override
   protected void simpleInitGame() {
      
      URL modelToLoad = TestChargement.class.getResource("/winbledon/res/tenis2.3DS");
      try {
            MaxToJme C1 = new MaxToJme();
            ByteArrayOutputStream BO = new ByteArrayOutputStream();
            C1.convert(new BufferedInputStream(modelToLoad.openStream()), BO);
            Node r1 = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
            if (r1.getChild(0).getControllers().size() != 0)
                r1.getChild(0).getController(0).setSpeed(20);
           
            Quaternion temp = new Quaternion();
            temp.fromAngleAxis(FastMath.PI / 2, new Vector3f(-1, 0, 0));
            rootNode.setLocalRotation(temp);
            r1.setLocalTranslation(new Vector3f(10,0,0));
            r1.updateRenderState();
            rootNode.attachChild(r1);
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Failed to load Max file", e);
        }
        SceneGraphDump.dump(rootNode);
   }
   
   
   public static void main(String[] args) {
      TestChargement app = new TestChargement();
      app.setDialogBehaviour(AbstractGame.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
        app.start();
      
   }
   }

nobody can help me on this ?

I'm not experienced with using 3DS. Is the texture file separate from the model file?

No … :frowning:

If you load the model in an editor (like blender) or in ModelLoader.java does it look correct?

no it don't but it doesn't matter anymore cause i created my own bad looking tennis court from quad. I only need to have something to show to the teacher by thursday. Thank you for the modelLoader it can be really helpful. I only am a newbie on jMonkey but it really looks powerful and easy to use :slight_smile:



So let's change the subject…i only have a flat Terrain made of quads, can i create a winbledon looking texture with all the lines and then apply it to my quads. Is there a method to extend texture on a whole surface ?

jonkille said:

I only have a flat Terrain made of quads, can i create a winbledon looking texture with all the lines and then apply it to my quads. Is there a method to extend texture on a whole surface ?

Using the Quad, texture coordinates by default are already defined for that. You simple must add a TextureState to the Quad and add a Texture to that.

once again thanks a lot