Hi I am trying to make Hexagon terrain system. As far now I can create hexagon tiles , subdivide it and apply textures to it.
The problem I am facing is how to align texture coordinates to any seamless textures.
So how to apply square seamless texture to hexagon so that it looks like seamless?
You want to use a seamless rectangle texture for a hexagon grid?
If the texture is way bigger than the hexagon you could subdivide the rectangle, but normally you want to have every field have the same texture, but this would be impossible
If all the hexagons are aligned to each other (flat without any âstepsâ) and have the same seemless texture, why have multiple hexagon meshes in the first place?
You would save a lot of vertices and solve the texture problem, if you combine all affected hexagons into one single mesh.
As i mentioned earlier I am making Hexagon based terrain system. I have different idea for adding number of hexagon. here is related discussion⌠How to calculate IntBuffer? - #15 by MegaWolf
Should not be a big problem - just use a factor for the translation between x and y. (or x and z - usually itâs x and z). The rest will be done by the âwrappingâ of the texture which will be computed on the graphics card for you. Here is a sketch I made in a couple of seconds:
the uv mapping looks wrong, from that image the texture is not being 100% displayed horizontally. Make sure your uvâs extend all the way to the limits.
No. I mean u = (some factor) * x and v = (some factor) * y just as the sketch shows you.
Note that y is typically z in most 3D worlds (jME has default x,z-plane too).
It assumes that you have a different mesh for each hex field or use some very simple shader.
I think itâs called âplanar projection of texture coordinatesâ or something like that.
Very simple thing - might be one of the simplest things in 3D mesh/shader writing.
Yes, each hex is separate tile. At this point I am not using shader right now. Can you guide me how to setup UV mapping by code? is it different than setting TexCoord as I shown in first post?
Sorry I am not good on this concept.
TexCoord is uv-mapping.
x-component of texture coordinate is called âuâ instead of x
y-component of texture coordinate is called âvâ instead of y
Thatâs it.
You simply set texture wrapping mode to repeat and assign some numbers to the u and v component of the tex coordinates.
Only problem: It will not wrap at the upper and lower border and left side and right side of the hex tile. It will wrap wherever the u coordinate increases by 1.0 and where the v coordinate increases by 1.0 (so itâs âmodulo 1â if you know what modulo means).