Multiple UV textures (for use in BGE)

Hi guys,

I’m having a problem with UV textures for use in my game where im trying to use multiple UV textures on a single mesh.

I spent over an hour at the weekend trying to figure it out for myself and, failing that, I searched the web and found nothing? All I could find was a small explanation on Blender.org (but I couldn’t understand it).

Basically, im using GLSL materials and I have a basic knowledge of how to unwrap a mesh and apply a UV texture by unwrapping the mesh into the UV/ Image editor and opening an image and moving the verts around to fit that image. I can do this fine, but it’s just with unwrapping the whole mesh and applying a single UV texture.

What I want to do is, unwrap a part of the mesh (in the specific case, im using a human and wanting to unwrap just the palm of the hand and apply a UV texture), apply a UV texture, and then move onto the front of the hand, then the arm etc etc etc.

know the answer is simple because I wasn’t too far off, I could unwrap just the palm of the hand and apply a texture (although for some reason I was having MASSIVE problems getting an image to open in the UV/ Image editor when I unwrapped just part of the mesh? AND it wasn’t texturing real-time in the 3d view???), but the rest of the mesh has the palm texture repeated across the rest of the mesh several times?

I was thinking it might be something to do with vertex groups, but cannot figure it out.

Any help (in layman terms please) would be greatly appreciated.

Thank you all for your help in advance and have a nice day.

:smiley:

If you are not going to use SSS (I think you are not because you are talking about the game engine), all you have to do is to create a new index for each UV part you need.


Then, in Edit Mode, you start selecting the vertices as needed and assigning them the corresponding material index.
In each index you assign a new material with the corresponding texture and that´s it.

When working this way, you actually don´t need to use multiple UVs, using a single UV, overlapping the islands corresponding each of the material indexes is enough. This island overlapping won´t be a problem since each of those islands will use a different material.

I´m not sure if the game engine supports multiple material indexes though, if it does it will work.

Cheers for the reply mate,

I dont know what SSS is, but it’s the BGE im talking about anyway :eyebrowlift2:.

I dont fully understand what you mean, do I for example select all the faces of the palm of the hand, then select a new index (as per your piccy) then click assign. Then go into the UV/ Image window, load an image and unwrap the selected verts and map them accordingly?

Obviously, making sure I choose UV in the mapto panel and load the image into a texture channel?

would this be correct?

Yes, and then you would assign that texture to the corresponding material in the corresponding material
index.

Once you are done with a particular set of vertices, pin them in the UV image editor (by hitting the P key) and that will prevent them from being unwrapped again when you unwrap the remaining parts of the body

mat.blend (34.2 KB)

I´ve uploaded a blend with a cube that has multiple materials assigned to it.

Cheers mate,

i’ll have a check of the .Blend tonight and let you know. :D.

Much appreciated.

I cannot open your .Blend file?

I have attached an image of a palm of a hand and a .Blend for a male model I downloaded to try things out on.

Is there anyway you could map (roughly) the palm to one hand and any other colour to the rest of the body so I can have a look and learn from it?

Cheers :yes:

Attachments


Male_LowPoly_B.blend (253 KB)

Hmm,

I think iv’e found out how to assign different UV’s to a single mesh and how to get the image to show in the UV/ editor window (you have to un-select all the verts and re-select them again (because yeah, that makes sense…)

However, when I press “P”, only the selected UV in the mesh panel on F9 shows up?

Anybody?

No lol, still cannot find out how to get more than one UV showing on my mesh :eek:.

In the mesh panel, I have the standard UVtex (which is there from the off) and now another which I added for the palm and another for the forearm.

If I click on the little picture of a grid next to the name and press “P”, the UV texture applied to that group shows, but none of the others (i.e if I click on the grid for the palm and press “P” I see the texture I applied to the palm, but none of the others).

If it helps, im using GLSL (although I wouldn’t mind knowing how to do it with Multi materials as well if the process is slightly different…).

Cheers for any help guys :slight_smile:

I’m having exactly the same problem! I sat the whole night to try and figure out how to do this! No luck.

I think I just figured it out. although it would be nice it there was more clarity from the Blender wiki, guides and even tutorials. There is a lot of reference to the method but very little on how to actually do it:

Anyway. this is how I did it:

  1. Select the faces you want to have a certain colour or texture (uv applied)
  2. create a new material and assign the faces (vertices) to that material
  3. create a uv map for that material from the selected faces and save it as a tga file (or whatever you prefer).
  4. pin them
  5. switch to the other faces (or manually select them) and assign a different material to them.
  6. Create a uv texture for them as well and pin them. Save the UV texture as a tga or watever.
  7. Do your stuff in photoshop and map each texture to the corresponding UV material you assigned. In other words, the hand UV texture should be mapped to the hand material and the head tot he head material etc. Map each texture to the UV map input.
    8… and now there should be multiple seamless UV’s on a single mesh.

Thanks Gustav,

Please can you explain how I would do your second point? (assign the selected verts to a material).

Also, doing it this way, you wouldn’t be able to load an image into the UV/ image editor and move verts around to fit the image would you? You’d have to export the UV’s using the wizard and make an image fit the verts and then import them back again.

Gustav,

Ignore my question about your second point, I think I understand this.

You still cannot map the UV’s “live” in Blender though can you? (i.e you’d have to assign some verts to a new material, make sure it is mapped to UV, unwrap the selected verts, export them to paint.net/ GIMP/ whatever, load an image into the editing program and map it, save it, import it back to Blender and there you go).

About the second point. Let’s use a easy example:

I have a cube with 6 faces. I select one of the faces and then I go the Link and Materials. There is a bunch of buttons like New, Delete Select, and Assign. I then press the new button. Now I press the assign button to basically assign the new material to the selected faces. Change the colour to red and you will see that only that face turns to red. Later you will uv unwrap that face and assign the same uv map to that material. Make sense?

About the second question. Let me see if I understand you correctly. You want to move the vertices in the uv window to fit on your specifically assigned image… ? You can. Just unpin the vertices in the uv editor. Usually people use a Test grid (checker board like image) to move the vertices around for a clean uv mesh. It’s meticulous but helps to keep the textured mesh uniform. So loading a image should not be a problem. It’s the same principle.

Hmm,

So, can I assign verts to a “new” material, map that material to UV in the “mapto” panel, unwrap the verts for that material in the UV/ image window, load an image into the window (a palm of a hand photo for example) and move the verts to fit?

Then, select other verts (e.g the forearm) and repeat the process?

Well, uh… yes. The steps I would take to accomplish that might differ a bit but the results would be the same.

After unwrapping your uv’s why don’t you try and load a checkered board image and move the vertices around. You should be able to see the ‘distortion’ on the model itself - in textured mode and realtime. Use a blue and white checkered board for the one material and a black and white image for the other material - both with assigned faces or vertices and uv unwrapped. You’ll get a good idea of how it works.

Thanks alot mate,

I’ll have to have a good play around with it tonight and i’ll let you know if im still having problems.

Have a good day

IT WORKS !!! :D:D:D

Cheers for the help guys.