- Home /
running a texture across multiple objects/meshes?
basically i'm looking for some guidance on how to get started or a general idea of how to do this.
I want to basically be able to spawn a cube for example, then spawn another cube along side the first and have the texture not appear to break at the join.
I'm ok with restrictions like it just being cubes basically, I mean I think once I get something working I can understand enough to modify it for my particular needs.
I think perhaps marching cubes might help with this im not sure.
I'd like to be able to have an object composed of say 100 cubes and for the purposes of destroying and creating it in portions I don't want to make it one super mesh, then I couldn't do hit detection etc on one small piece.
However I want the outside to appear uniform so I think i want to perhaps have a seperate mesh/object wrapping around I guess the 100 cube object for the texture to be placed on, again i'm not sure here.
I know what I want to have as an end result, which is a 100 piece object which doesnt on the outside look like 100 joined pieces but looks uniform.
I don't mind if it's a bit difficult I know of course things like terrain deformation exist and look good so it's possible I just don't know where to start, so any guidance on how to do this?
OP_toss outlines two ways to make it work, but there are a lot of posts concerning the issues of getting textures to align without any artifacts across multiple objects. Typically you see some lines between objects, or if using physics, you see objects catching on the edges between objects. You might be better off looking at other solutions. Since I don't know your game, it is difficult to make specific suggestions, but I'll bet there are other approaches to your problem.
Agreed, the solution I proposed is just the simplest and most efficient way I could think of. The other solutions require procedural meshes with procedural collision meshes. Not thaat difficult since you're dealing with cubes. But slow so you couldn't rebuild it every update.
Also if you could respond to your own question with an update or answer that'd be nice. Don't leave us hanging!
so i'm not just using cubes, though I am only using simple shapes.
cubes, triangles, 2 X 1 tri's 3 X 1 tris, maybe spheres half spehres.
I know how to join them "seamless" as far as exactly touchign, tahts done, but the painting the textures on only works on cubes it seems.
i think maybe I want to actually be able to paint a texture like if i coudl do that at runtime.
Does that seem possible?
The issue is like with a triangle joining a cube for example, a tri is no longer a square tileable texture so its edges and stuff are at different points of the edge of the actual uv map of the texture.
so it doesnt align nessacarily I DONT THIN$$anonymous$$.
Im not sure.
I feel like either I could texture the triangle in blender in such a way to make it join seamlessly or else I could in unity "paint" the texture on whereby I somehow take like the UV map of the cube the tri is beside. I look at where the edge of the cube is for example on the texture image. then I somehow define the face of the triangle to start at that same part of the texture image so that the edges match up.
I'm not sure if that makes sense reading, mentally I understand what im saying :P
Basically I want to be able to paint by laying the image over the top of the cube/triangle as it were and then wherever in the middle of this image the cube ends, the triangle begins.
I wonder if maybe I could also do this in blender by having all the shapes in the same scene and uv unpacking them all and trying to make them align that way i'm again not sure, I think if I had like a reference or some diea of how/ the best way to do it I could do it, I jsut dont know where to start really.
Answer by OP_toss · Dec 07, 2013 at 01:30 AM
Why not just make a bunch of cubes that are procedurally aligned to be exactly touching. That solves the model part easily enough. Simple is good and this should suffice. Marching cubes or terrain algorithms that use procedural mesh generation are slow and confusing to implement in my experience.
Then the seamless texture part, since its a cube, you can just use a tileable texture applied to each face of the cube. That way the sides will line up.
If you don't want it to be so obviously repeatable, you can offset the uvs based on the tile's position. So cube 1 has uvs(0-0.25) and cube 2 has uvs (0.25-0.5) etc repeating back to 0. Thus the image would repeat every 4 cubes instead of every 1.
Now you could also get fancy and use 3d textures, and have the shader use the vertex position (interpolated) to lookup the uv for the texture. This could be your most dynamic and efficient option, but 3d textures are procedural by nature, so you'd have to have a way to define one. I've only used them in modelling applications so I can't help you too much there.