Hello, I am new to jMonkey so please pardon what is likely a simple/stupid question. Basically I would like to tile a texture on a sphere but can’t seem to be able to do it. When I scale the texture it does not map properly:
Source code reference:
public void simpleInitApp() {
// FOV min view max view
cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.001f, 30000f);
DirectionalLight LocalStar = new DirectionalLight();
LocalStar.setColor(ColorRGBA.White.mult(1f));
LocalStar.setDirection(new Vector3f(0f,-1f,0f).normalizeLocal());
Material PlanetSurfaceMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
//PlanetSurfaceMaterial.setBoolean("UseMaterialColors",true);
//PlanetSurfaceMaterial.setColor("Diffuse", ColorRGBA.White);
PlanetSurfaceMaterial.setTexture("DiffuseMap", assetManager.loadTexture("Textures/CloudLayer.png"));
Sphere PlanetSphere = new Sphere(128, 256, 6.371f);
//PlanetSphere.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
//TangentBinormalGenerator.generate(PlanetSphere); // for lighting effect
PlanetSurface = new Geometry("PlanetSurface", PlanetSphere);
PlanetSurface.setMaterial(PlanetSurfaceMaterial);
PlanetSurface.getMesh().scaleTextureCoordinates(new Vector2f(8f, 8f));
rootNode.addLight(LocalStar);
rootNode.attachChild(PlanetSurface.rotate(0f, 0f, 0));
}
Could someone please tell me what I am doing wrong thanks.