Texture of Terrain goes crazy




What is that? It should be a textured terrain, but it looks more disgusting than no terrain

..which has been my problem since yesterday and now I set it visible with setRenderQueueMode(Renderer.QUEUE_OPAQUE)

I need some help :cry:



Here is how I init my terrain:


//This grayscale image will be our terrain
           URL grayScale=this.getClass().getClassLoader().getResource("mce/game/data/img/es1_h.png");
         
          //  Create an image height map based on the gray scale of our image.      
           ImageBasedHeightMap ib=new ImageBasedHeightMap(new ImageIcon(grayScale).getImage());

           // Create a terrain block from the image's grey scale
           Vector3f terrainScale = new Vector3f(10.0f,1.5f,10.0f);
           tp= new TerrainPage("terrain",50,ib.getSize(),terrainScale,ib.getHeightMap(),false);
         tp.setDetailTexture(1, 80);

         // Some textures
         ProceduralTextureGenerator pt = new ProceduralTextureGenerator(ib);
             pt.addTexture(new ImageIcon(TerrainCreator.class.getClassLoader()
                                         .getResource(tex_grob1)),
                           -128, 0, 128);
             pt.addTexture(new ImageIcon(TerrainCreator.class.getClassLoader()
                                         .getResource(tex_grob2)),
                           0, 128, 255);
             pt.addTexture(new ImageIcon(TerrainCreator.class.getClassLoader()
                                         .getResource(tex_grob3)),
                           128, 255,
                           384);

             pt.createTexture(256);

         TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
         ts.setEnabled(true);
         Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
               Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
         ts.setTexture(t1, 0);

         Texture t2 = TextureManager.loadTexture(TestTerrain.class
               .getClassLoader().getResource(tex_detail),
               Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);
         ts.setTexture(t2, 1);
         t2.setWrap(Texture.WM_WRAP_S_WRAP_T);

         t1.setApply(Texture.AM_COMBINE);
         t1.setCombineFuncRGB(Texture.ACF_MODULATE);
         t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
         t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
         t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
         t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
         t1.setCombineScaleRGB(1.0f);

         t2.setApply(Texture.AM_COMBINE);
         t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
         t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
         t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
         t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
         t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
         t2.setCombineScaleRGB(1.0f);
         tp.setRenderState(ts);
          

         CullState cs=DisplaySystem.getDisplaySystem().getRenderer().createCullState();
         cs.setCullMode(CullState.CS_BACK);
         cs.setEnabled(true);
         tp.setRenderState(cs);

Do you get the same result when pasting only the code you posted into a new SimpleGame subclass and run it?

Do you do anything with your terrain's vertexbuffer?

Does the texture stay in place on the terrain, or does it move when you move the camera?

mathias4u said:



What is that? It should be a textured terrain, but it looks more disgusting than no terrain


Im gonna puke !!

I think it looks sorta cool! :wink: