LibGDX 3D Multitextured Terrain

So I have researched a whole lot but I cannot find out how to do it.

I know it is possible through shaders but I haven’t been able to find a tut on how to do it with more than 2 textures.

The result I’m looking for is this: http://www.youtube.com/watch?v=J-FFLSV1mKE

I need help on figuring out how to draw a tile on a 3D triangle mesh grid, almost like 2D game maps are made. Just 3D.

So I need help applying textures to range of squares(2 adjacent triangles)

I have this so far THE GUI IS A WIP:

Use a texture atlas.

How will a textureatlas texturize my mesh like tiles

Are you guys just trying to get posts? Seriously those comments mean nothing. How would I use a TextureAtlas, explain.

Wow, that’s not a good idea to insult someone.

Try actually thinking about the problem. Have you attempted anything? Its really simple, just use a texture atlas, and apply the large texture over a few vertices (your tiles). If you could actually tell us what you’re having trouble with instead of assuming we know what you mean, we could help.

Well I didn’t mean to insult.

Just those answers aren’t answering anything.

Its a 3D mesh. I want to texture it like a tile based game.

However, Its 3D.

I want to be able to draw a texture between two triangles that are forming a square.

A tile-based 3D map. Like in the video.

Its easy, The tile coordinates range from 0 to 1. Tile coordinates are as big as you want, but are generally a power of 2 (2, 4, 8, 16, 32, 64, etc…). In your tile class, or whatever your mesh class is called, simply combine the vertex data for two triangles into one buffer, then draw it with the texture buffer. I believe your issue is you can’t figure out how to draw two triangles together?

I’m using LibGDX’s Mesh class with verticeattribute for texcoords. And simply using mesh.render() with shaders applied. I have it working with 1 texture but since shaders bind using texCoords and the triangles touch texcoords are shared for example its not what I want:

Thanks, that answer clears a lot. And yeah, if you would like to share I would like to take a look.

Is the effect the one I spoke of?

With a mesh like that UV mapping certain corners of my mesh differently for tiles wouldn’t have to be done. Since each set of triangles are symmetrical.

[quote]How would I use a TextureAtlas, explain.
[/quote]
Walk before you run…

Maybe start with a 2D game if concepts like a texture atlas are not yet within your grasp. 3D is very difficult, especially things like terrain.

In your case you should just use different texture coordinates. You need to render the “tile” (i.e. two triangles) with the calculated UVs from a TextureRegion. More info on this here:

For more advanced terrain rendering techniques, check out this site:
http://www.zephyrosanemos.com/

I know what a textureatlas is.

I just don’t see how a TextureAtlas can draw on specified vertices of my mesh.

… Its just a texture that contains sub textures so you only to load the texture file once. There’s no difference between a texture from a texture atlas and a regular texture.

Did you read the links? :wink: You need to use different texture coordinates for your tile vertices. These coordinates would be calculated for you by TextureRegion. TextureAtlas just stores a bunch of TextureRegions by key.

Yes, I knew that. That’s why I didn’t know how a textureatlas helps me.

Thanks! Terrain patch is exactly what I was looking for in an example. It cleared up what I didn’t understand.

Will do. And I have progressed a WHOLE lot now. I will be working on water and world objects soon. My problem before was just the shared vertices, it wouldn’t let me UVMap effectively.