UV and transparency (I finally got it) - with mini tute

It’s late and I’m getting ready for bed, but before that I have a question that has been puzzling me.

I think I have transparency figured out as far as creating it from a procedural texture, but there are some shortcomings with that process (only being able to Map To flat, cube, cylinder, or sphere) that doesn’t lend itself well to applying textures to irregularly shaped objects.

I am working with makeHuman to make some clothes for the figures, and I recently ran a test of a lace garment with fairly good results…I was able to see the body underneath the garment. However, the lace pattern looked stretched in some places and constricted in others (it was mapped to cylinder).

Using the UV texturing, I was able to LSCM unwrap the garment almost exactly like a real garment pattern piece, so when I applied the lace UV texture, it looked fairly realistic…except I couldn’t get it to render transparent in the appropriate places.

Today, I have been browsing the Elysiun forums and knowledge base, but the information I found doesn’t seem to work. I can render it opaque, or transparent, or using the alpha slider in the Materials buttons, I can render it semi-transparent. Howver, it seems to be an all-or-nothing proposition because the parts I want rendered opaque turn just as transparent or semi-transparent as the areas that are supposed to be transparent. I tried different image types for the texture to no avail (JPG, PNG, TGA).

Is it possible to render UV textures with opaque and transparent areas? Barring that, is there a way to apply a procedural texture in a UV mapped manner?

i hope I am being clear, but if not, I will try to post some examples of what I am trying tomorrow evening. All help would be appereciated :slight_smile:

what you are trying to do is called a sprite. it is possible and here is how you do it:

  1. create a material with your uv cordinates mapped to it
  2. add a texture mapped to uv, col and then load your lace pattern
  3. add in a new channel another texture mapped to uv, alpha and then load your lace pattern with low bright and high contrast and then click the use alpha bar if it supports it (targas and others)
  4. then set your alpha bar to 0 and turn your favorite transparency type (ztransp or raytransp)
  5. the results will be ugly (unlikely to be pretty) and the values will need tuning so play with them!

hope this helps! when it comes to complicated textures like lace it is sometimes easier to actually model it but in your case i can understand that you don’t have the experience yet! can’t wait to see the results! :wink:

yes this is possible :slight_smile:

add your UV-map as you would a normal image texture. Then, under the map input tab, click to UV button to use the UV coordinates for the texture. You now have access to all the normal “Map to” functions (alpha, emit, etc) that you would with a procedural or normal image texture.

I believe thats all.

Thanks for ther suggestions, but I am still not having much luck :frowning: I wonder if I am expecting too much. Here are some images I got by doing it as an image texture
http://www.gottahavacuppamocha.com/albums/blend_models/lace_shadows.jpg
http://www.gottahavacuppamocha.com/albums/blend_models/candide_lace_nightie8.jpg
you can see on the bottom image that the lace is stretched over the breasts, and a bit constricted at the waist. I am hoping to use the UV texture to more accurately portray the way the fabric is made as a garment, while still being able to be rendered as the above mages (with shadows and transparency). At the moment, I still keep ending up with semi-transparent objects, or they are so transparent they aren’t rendered. :-?

I noticed your suggestions (at least the way I understood them) didn’t mention anything about the texture face options under the Editing buttons (while in UV Face Select Mode).

It’s late again, but I will probably plug away at it agaiin tomorrow after work.

Any other thoughts?

well. you may want to use an image that contains transparency information,
for example. tga or png. Right now the garment seems to be stretch lace…but there are many resources on the web as far as garment construction is concerned. If it is not your intention to have the fabric look like strech lace…then good luck. Your pattern for the dress would need a few darts ( seems that fit the garment closer to the body ) that would need to be matched properly to look believable.
Overall. a very good start though. :smiley:

I’d like to know what some of those “resources on the web” are. This topic of building clothing for makehuman figures is of course of considerable interest to me right now.

Idly observing, I notice that the clothing basically consists of one piece of cloth stitched down the middle. Maybe you really need to do it like a dressmaker actually would, as a series of several pieces of cloth stitched togther, so that fuller areas like the bustline are not “stretched.” But I really don’t know and I’m quite interested.

Actually, I have a degree in Apparel Design and Production, which is one of the reasons I got into 3D design in the first place. Clothing construction depends largely on the garment being made and the fabrc being used. You might want to Google for Flat-pattern drafting, draping, clothing design, apparel design, sloper, and similar terms. Actually, I think LSCM is a lot like flat pattern design/drafting. Maybe I will come up with a tutorial/FAQ on apparel design concepts.

I don’t find creating slothing meshes difficult, it’ just the UV I am having issues with at the moment. I’m at work so I have to go. I will check back later

I’d like to know what some of those “resources on the web” are. This topic of building clothing for makehuman figures is of course of considerable interest to me right now.

I usually answer a question like that with a quick google search. …but. to my surprise, this is a VERY difficult thing to find information on the web about. I guess to many ppl are trying to make money from selling the patterns and(or)
housewives trying to make money from home.
. btw. I did costume and clothing design years ago. I still dabble now and then…so here are a few suggestions.
Go to your local fabric store and buy a few patterns to look at the basic pricipals of garment construction. There is always a clearance of outdated patterns , usually for less than a dollar each. Be sure to have plenty of floor space when you open the tissue paper… you would be amazed at the size of some of the patterns !
If you have old clothing or a thrift store in your area, cut aprt a few articles of clothing at the seams to get a better understanding.
Oh cool. I just found a site. http://www.leenas.com/English/draw_sleeve.html
most ppl would never believe that is a sleeve pattern until they see it sewn.
This IS a subject thah not enough ppl have paid attention to. It would be great if barista did do a tutorial. If you understand where the seams are placed…it is not difficult to make clothing at all. I will check back on this post later on to see if you have any further questions.

A lot of people have mentioned that your image should contain an alpha channel such as PNG or TGA but I didn’t hear anyone mention that you have to actually do something with the channel.

In order to make the opaque areas fully opaque and transarent areas fully transparent, you have to construct an alpha channel that says that. In a 2D program like GIMP or Photoshop, you add an alpha channel first. Images including PNG and TGA rarely have them by default as it saves file size.

You add the channel in the bit where you see the RBG channels. This new alpha channel has to be made so that at the opaque areas of the cloth, the alpha is black and the transparent bits are white (that’s in Photoshop. In GIMP it’s better because it actually goes transparent to avoid confusion as to which colour represents which alpha).

For a lace image, this might take a while if the segments aren’t joined but from your image, it looks like the lacey parts are all joined. This means that you just use the magic wand to select the lace part and switch to your alpha channel and just paint it all black. The alpha channel should look something like the first image in the post about 4 posts back.

So now you make the material use the alpha channel of the image by mapping to alpha and set alpha to 0. This makes opaque bits fully opaque and transp bits fully transp - no need to use semi-transp.

I imagine you can do this with procedural textures too by duplicating the texture and mapping it to the alpha channel but using the rgb colours to specify alpha instead of the alpha channel which won’t exist. You would just have to change the procedural texture to black/white.

As for getting the textures to stop stretching, it’s quite difficult in most cases, especially with non-uniform surfaces like clothing. I actually think you’ve done really well with the image you have.

What I think you want is to be able to have the same number of white lace patches across the breast as the waist. I would try using cylindrical UV projection first. Select all the faces in UV select mode and hit U. This gives a menu of texture projections. I sometimes use the panel in the editing section (F9). In face select mode, you get a bit on the far right called UV calculation and it gives some extra options.

You’ll have to experiment with various projections to see which stretches the textures least. Remember that you can apply different projections to different selections of faces though. Like if you add sleeves, project UVs onto them separately from the body.

I like Maya’s way of projecting UVs because you can actually transform the projection object so it fits the model more closely. For example, the human body is more closely represented by a squashed cylinder than a uniform one.

Well I think I finally got it.
http://www.gottahavacuppamocha.com/albums/blend_models/UV_lace_test.jpg
For some reason, I had it in my brain that a UV texture is just another type of image texture. One thing that wasn’t mentioned above is that in the Texture buttons (f6) you have to set an image texture. i just assumed it was None because I thought that if I set a UV texture and a procedural texture to the same image, there would be some sort of conflict. Here are the steps I took:

  1. I deleted the basic cube and put in a basic sphere.

  2. In the Editing buttons (f9), whille in Editing mode, selected all vertices and clicked on Set Smooth.

  3. Then I went into the materials buttons (f5) and clicked on Add New to add a new texture. Nothing extra special needs to be done except to click on TraShado so the sphere can recieve ray traced shadows.

  4. I added a plane, scaled it up a bit and moved it in between the lamp and the sphere.

  5. In the Materials buttons, I added a new material. Nothing special to do yet.

  6. In the texture buttons, I added a new texture, but didn’t define the type yet.

  7. I then went from Editing mode into UV Face Select Mode. I opened up the UV/Image editing window.

  8. I clicked on Image -> Open to bring up the Select Image window and then I selected the appropriate image, an off-white and transparent PNG.

(**NOTE: If I picked a white & transparent PNG, the whole thing shows up in the UV/Image Editing window as white. If I picked a black and transparent image, the whole thing shows up as black. If I picked some other color and tranparent image, I was fine, though the transparent areas would show up as white. I would LOVE for this to change so that the transparent areas show up as the traditional two-tone gray squares. Hint to anyone in Blender development)

  1. Back in the Texture buttons, I set the texture type to image. Then I loaded the same image as I used in the UV/Image Editor. I then clicked on UseAlpha.

  2. In the Materials buttons, under the Map To tab, I clicked on UV, and under the Map Input tab, I clicked on Alpha.

  3. Still in the Materials buttons, I truned the Alpha slider down to 0. Under the Mirror Transp tab, I clicked on ZTrans.

  4. I went from UV Face Select mode to Object mode and then selected the lamp. I then clicked on RayShadow.

  5. Under the Scene buttons (f10), I then clicked on Ray to turn on ray tracing.

  6. Hit the Render button or the f12 key to render the scene.

Hopefully this will help noobs (and not-so-noobs such as myself) in the future :smiley:

Also, I agree with Mr Nightmare that a good way to get an idea of how clothes are constructed would be to go to a thrift store buy some clothing item and then use a seam ripper to tear it apart at the seams and then lay the pieces out flat ( I would recommend a ladies dress blouse). It can be pretty surpirising. Maybe I will try to work on a basic clothes making tutorial this weekend.

Thanks for all the help everyone.