PDA

View Full Version : how does UVW system work exactly ????

 gamekill06-06-2004, 07:46 PMHi! I am not new to design but I am relatively new to 3D design. I am trying to focus on texturing and specialize in this area. The software that is used where I work is 3DS MAX 6. What I can't quite understand is the whole basic concept behind the UVW system. What do exactly the U V and W coordinates mean? Are they relative to the object or the world? How can I roughly predict where a map will show on an object (front, back, top, under it...), and what size it will be relative to the object? Also creating procedual textures, I have problem predicting where they are gonna show up, and what will their relative size be to an object... for example if I create a simple black/white checkered texture and intend to use it as a wallpaper on a bedroom's right side wall, I have to keep tweaking it's UVW map and tiling size blindly until it gets acceptable. What should be the relation between UVW orientation/size and object orientation/size? Where can I truly learn the UVW system and it's use? I feel this is something a lot of people overlook... If you know the UVW principles please help! :cry: :surprised :scream: :cry:
erilaz
06-07-2004, 01:33 AM
First of all, UVW coordinates correspond in the 2d texture to the XYZ coordinates of a mesh. U is relative to X, V to Y, and W is a perpendicular plane to the UV, used for flipping coordinates and for 3d procedural materials.

It's all explained fairly clearly under the help file in max. :)

gamekill
06-08-2004, 11:47 AM
Yeah it just came across my mind shortly after posting my question... "RTFM" lol

Ok thanks a lot anyway for your reply... I started reading the manual and just began to feel more comfortable with uvw... I just hope I can get it clear on how to map uvs inside mat ids, and even on top of other uvs... k back to the reading!

:thumbsup: :applause: :scream: :scream:

Toxic Frog
06-08-2004, 02:34 PM
It's an easy concept once you see it in action. I'd recommend this:

Create a square plane with several divisions (say 6 in each direction). Create a square image (or just crop a photo in a square shape) and apply it as a planar map on the plane.

Apply an unwrapUVW modifier to the object, turn on sub-object mode (so you can see what is selected), and open the edit window. Hit 'show options' in the Unwrap window, and check 'constant update' and 'highlight selected verts'.

Now in the unwrap window, grab a vert and move it around, and notice what happens to the mapping on the object (constant update will let you see the changes in real time).

Do this for a few minutes and you'll get it, I betcha.

Bobo
06-09-2004, 12:33 AM
Originally posted by gamekill
Hi!

:cry: :surprised :scream: :cry:

This happens to be my favorite topic :)

Here is the concept in short:

The UVW texture coordinates can be seen as a mesh existing in a different coordinate system. UVW coordinates, just like the regular meshes you are using, consist of vertices and faces (which you can see in the Unwrap Modifier). But while the mesh vertices are points in 3D space (having X,Y and Z values), the "texture mesh" has points in TEXTURE SPACE, marked as U,V and W. A VERY important fact is that the mesh faces (the triangles you see in the viewports), and the Texture Faces (the triangles you see in the Unwrap modifier), have ALWAYS the SAME COUNT and have perfect 1:1 correspondence, that means face #42 in the mesh corresponds to texture face #42 in the UVW mesh!

So far, so good. Now let's see what this TEXTURE SPACE is.

Let's start with 2D texture space and planar coordinates - when using bitmap textures, you usually care only about U and V.

In a bitmap, U is the WIDTH of the texture, while V is the HEIGHT. The origin [0,0] is in the LOWER LEFT corner of the bitmap. The upper right corner of the bitmap is [1,1], upper left is [0,1], lower right is [1,0].

When a texture vertex in the UVW mesh has a value of [0,0,0], it means that vertex is located at the origin of the bitmap, its lower left corner. This also tells MAX to place the pixel found in the lower left corner of the texture EXACTLY at the vertex corresponding to the texture vertex. Since the texture faces of the mesh and the UVW mesh have a fixed correspondence, Max can easily find which mesh vertex corresponds to that texture vertex and vice-versa.
(It is a somewhat disturbing fact that there can be an arbitrary number of texture vertices, more or less than there are mesh vertices. This gives Max alot of flexibility which was not present in the old 3D Studio DOS, but also causes headaches in the beginning... For more info, please read my explanation in the "Understanding texture Coordinates" topic of the MAXScript Online Help for max 6.)

Now let's see how the above works in the simplest case:

A plane with 2 faces/4 vertices, Generate mapping coordinates checked, and a material with a Bitmap texture. The lower left corner vertex of the plane corresponds to a texture vertex with value [0,0,0], the upper right to [1,1,0]. The result is that the bitmap is placed perfectly on the plane.

Add a Unwrap UVW modifier on top of the plane, select the single vertices in the corners and watch the U, V and W values in the bottom of the editor's window!

If you would select the upper right vertex in the Unwrap modifier and move it to the center of the texture, you will see that the texel found in the bitmap will try to reach the upper right vertex of the mesh in the viewport, stretching the texture.

If you would enter 2.0, 2.0 for the upper right texture vertex, 2.0,0.0 for the lower right and 0.0,2.0 for the upper left, you will see that you just manually TILED the texture 2x2 times!!!
Basically, the U and V values assigned to the mesh are being multiplied by the tiling values in the UVW Map modifier, but result in the same look as described above!

The Tiling values found in the Material Editor work slightly differently - in the example above, the tiling happens about the origin (0.0,0.0,0.0) by multiplying the values, while the ME tiling happens about the center of the bitmap (0.5,0.5,0.5) and is performed as a matrix transformation (you can see Tiling as the Scale part of the transformation, Offset UVW as the Position, and the Rotate UVW as the rotation component of a matrix transformation in texture space.

Cheers,
Bobo

gamekill
06-14-2004, 03:43 AM
WOW, thank you guys for all this info! Bobo your reply helped a lot... I think I *kinda* got the handle on the UVW concept and uvw unwrap. Did some reading on the manual files and some tutorials.

What I still need to know is how to handle uv mapping with ease. I mean:

1_How can I uvmap just one/some faces of an object on TOP of an existing underlying material? Say I have a huge complex spaceship, and I applied a procedural metal texture on it all over. But I have a bmp file of a logo I want to apply to a specific part of the ship. So I need to know how to use another simple material I create, using the bmp file as diffuse and opacity maps, on top of the procedural metal material (as a second sub_material maybe?). But JUST at some selected face.

_how can I overlap UVmappings? For example I have a simple pencil with an eraser head shaped like a ball. All as one and the same object. Can I apply cylinder UVW mapping to the pencil part and at the same part spherical mapping to the eraser head? even if they are on the same object?

Well I really hope you guys can help me, you have been wonderful for me not only replying to my post but replying to all other posts I have read so far!!!

Thanks...

:thumbsup: :applause: :cool: :cool:

Bobo
06-14-2004, 02:48 PM
Originally posted by gamekill
WOW, thank you guys for all this info! Bobo your reply helped a lot... I think I *kinda* got the handle on the UVW concept and uvw unwrap. Did some reading on the manual files and some tutorials.

What I still need to know is how to handle uv mapping with ease. I mean:

1_How can I uvmap just one/some faces of an object on TOP of an existing underlying material? Say I have a huge complex spaceship, and I applied a procedural metal texture on it all over. But I have a bmp file of a logo I want to apply to a specific part of the ship. So I need to know how to use another simple material I create, using the bmp file as diffuse and opacity maps, on top of the procedural metal material (as a second sub_material maybe?). But JUST at some selected face.

_how can I overlap UVmappings? For example I have a simple pencil with an eraser head shaped like a ball. All as one and the same object. Can I apply cylinder UVW mapping to the pencil part and at the same part spherical mapping to the eraser head? even if they are on the same object?

Well I really hope you guys can help me, you have been wonderful for me not only replying to my post but replying to all other posts I have read so far!!!

Thanks...

:thumbsup: :applause: :cool: :cool:

Some more concepts you must be aware of:

*3dsmax gives you 100 *independent* UVW channels. You can have one texture using channel 1, another one using channel 42. For example, take a sphere, enable Texture coordinates (generates a spherical map in channel 1 procedurally), apply some material with Bitmap texture set to use Explicit UVW Coords, channel 1. Then add an UVW Modifier, set the mode to planar and change the channel to 2. In the material, add some Mix or Composite or whatever Map you want to the original texture, or use a different slot (like Bump, Opacity etc. if you want to control these). Add a second bitmap which uses channel 2. This gives you a single material with two textures applied to the same object with different projection methods (one spherical, one planar).

*You can assign UV coordinates to selected faces. For example, if you take the same sphere, add a MeshSelect BELOW the UVW Map modifier described above, select a couple of faces and change the channel in the UVW Map modifier back to 1, you will have spherical coordinates everywhere EXCEPT for the selected faces.

*You can break faces in the UVW Unwrap modifier and move them to locations on 2D bitmaps to get manually controlled skinning. You can also use the Flatten Texture options and the Texporter plugin to generate a skin template you can paint on in Photoshop or similar. This is the way to go for non-3D textures where you want to control exactly which texels appear on which faces...

gamekill
06-18-2004, 09:36 AM
You guys are really great... you are REALLY helping me on my way to truly knowing how to map EXACTLY what I want in 3DSMAX6...

I am stuck at a point though, and can't seem to get around it... I really hope you guys can help yet once more. I will try my best to explain it clearly:

I created a model of an old-aged, cartoon-like aviator character. A lot of pieces are in fact part of the same solid editable poly object (head, hands, neck, arms, cap, cap dog-ear-like-side-things, eyebrows, shirt). So for this main part I created a multi/sub object. I then created sub-selections and numbered them (main skin faces are channel #2, hands are #1, eyebrows #3, cap #4, mouth interior #5, shirt #6, goggles rubberband #8). I have successfully placed procedural materials for each of these parts, and set the uvw's accordingly, inside the multi-sub object.
My problem though lies in material #2 (the main skin). It is currently a shellac material. What I want to do is add a scar next to the guy's left eye. I already have the diffuse and opacity maps (BMPs) created. I tried changing the shellac-type skin material to a composite material, wich included the original shellac skin as a base material and a new standard blinn sub-material for the scar (maps placed correctly). I then set the scar maps to channel #9, and tried adding an uvwmap (planar, channel #9) to the guy's head (positioned and scaled correctly). The rendered image, though, does not display the scar at all. I also plan to add a tattoo to the back of the old geezer's head. So I guess that would be channel #10. To sum it up, I need to know how to "stamp" little bitmaps with opacity filters on top of procedural textured objects. HELP!

:bounce: :bounce: :bounce: :bounce:

06-18-2004, 02:23 PM
Is the Scar material in the "Mat.1" slot of the Composite material? Which compositor are you using for it... Add, Subtract, or Mix?

Might help to copy the material to a new slot in the ME, simplify it down to just the Scar, apply it to the model and test-render. Does it look right on the eye-area faces?

gamekill
06-24-2004, 11:51 PM
Hi guys, I finally got time to reply.
I seem to be starting to really understand the whole uvw, multimaterial, composite material, and channels concept. I finally managed to add the scar (and a tattoo) to the character.

I can't really tell what was going wrong, but I can tell what I did for it to go right. The sub-id for the guy's face and head skin in general is #2. So in the multimaterial, submaterial #2, I used a Composite material. The base material for this composite is the skin texture itself. The next composite material, though, is a simple Standard type, with the scar.jpg and scaropac.jpg files used as diffuse and oppacity maps, NO TILING. I then set these 2 jpg maps to channel #12. Then back at the editable poly (the guy) I added a uvwmap for channel #12, planar, fit to bitmap (scar.jpg), positioned right where the scar should appear. It worked!!!!!

Whew...

Not as learning never ceases, there are some other stuff about UVW I still can't figure out. Hope you guys can help YET again:

UVW mapping doesn't seem to affect procerural textures at all... Neither the UVW type (spherical, planar, face...), nor the tiling/size seem to make any effect over procedural textures. If that is so, how can I adjust procedural textures on an object? For example, I created a marble material (for a bathroom scene I am working on), and this material is to be used for both the bath tub ans the sink. But I need it to be of a lower scale on the sink for the veins to show. The only way I could to that was by duplicating the bath-tub material, to a nwe sink material, and upping the tiling values on the maps inside it. But that is not too practical... also, if I wish for it to just rotate os offset a little, I can't use uvw map for that either. I also need to keep adjusting the values on the material itself... so how can I control procedural materials aspect on an object???

06-25-2004, 01:23 PM
In the procedural's Coordinates rollout, change the Source to Explicit Map Channel. Then the procedural will use the UVs you provide.

But you'll lose one of the great benefits of most procedurals... they're 3d textures so they don't need to use a stretch-prone set of UVs like a 2D texture does. A 3d texture "fills" the space of the object. The surface of the sink or tub "intersects" with the texture's 3D volume, so the texture never appears smeared. It's a great feature, once you understand the way it works.

You might try using Source: Object XYZ instead of UVs. Object XYZ uses the orientation of the object to align the 3d texture to it... so as you move/rotate/scale the object, the texture stays put on the surface. Using World XYZ will keep the 3D texture in world space, so then if you move/rotate/scale the object, the texture will appear to "swim" through the model, since the texture is staying put while the object moves around. Make sense?

I use the Offset/Tiling/Angle spinners to control the texture in Object XYZ space, and the controls work much the same as move/scale/rotate (respectively).

Hope that helps. It's a cool concept to learn. Especially with my current project...

Anyone working with Volume Maps?