A material that is assigned to a geometry is usually stretched over an entire face, so that the material details become blurred (especially with bigger faces).
Is there a way to make a geometry repeat a material over a face?
Normal:
________
| |
| (A) | Texture is stretched over entire face (A)
| |
|_______|
What I want:
________
| | |
|___|___| Face (A) is divided into sections,
| | | and the texture covers each section individually.
|___|___|
(A) ^
Box b = new Box(map.get(0).size()*size, 5, map.size()*size);
float texSection = 10;
b.scaleTextureCoordinates(new Vector2f(texSection, texSection));
Geometry g = new Geometry("BoxFloor", b);
g.setLocalTranslation(map.get(0).size()*size/2, -5-5, map.size()*size/2);
Material m = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
m.setTexture("DiffuseMap", assetManager.loadTexture("Textures/warning strip 2.png"));
/*m.setBoolean("UseMaterialColors", true);
m.setColor("Ambient", ColorRGBA.Gray);
m.setColor("Diffuse", ColorRGBA.Orange);*/
g.setMaterial(m);
g.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
enviro.attachChild(g);
Image “warning strip 2.png” has white, yellow, and black.
What I imagine should be happening is “warning strip 2” should be displayed every so often on the floor. Instead, the area around the player is white, and (if texSection is high enough) you can see a gradient of black and yellow in the distance.
In this picture, you can see that the player is surrounded by white, but there is a gradient in the distance. Please note that the walls use “warning strip 2”, and please ignore the big red thing.