Site hosted by Angelfire.com: Build your free website today!
 


20. 3D Studio Max Texture Mapping - Part 1
 
Previous   Table of Contents   Home   Next




REVIEWING WHAT WE'VE DONE SO FAR...

So, in the last tutorial I exported a LightWave object as a 3D Studio Max mesh, rotated it 90 degrees so it was towards the camera, and smoothed it.

Next, we have to get the texture maps working.


WHAT DOES THE LIGHTWAVE MANUAL SAY?

Unfortunately, LightWave manual says remarkably little about exporting to the 3DS format.

It says the following... "FOREIGN OBJECT SUPPORT

     Exported Formats

         3DS M, SA, SSP, T, UV

     M    = Geometry Mesh
     SA   = Surface Assignments (LW default properties)
     SSP = Standard surface properties (color, glossy, etc.)
     T    = Texture maps (non-procedural)
     UV  = UV Texture information

     NOTE: Before exporting to a foreign object format,
             save the object as a LightWave .LWO file first.

     When appropriate, an options dialog box may appear
     when you load or save a foreign object format file.
     Some trial and error may be needed to get acceptable
     results.
"




There's no explanation of why, or how, so I guess it's down to the 'trial and error' part.

Load in the 'figure.max' scene from the last tutorial, or if you are already there, you're already there.

Things seemed to have been going well. I had just done the smoothing on the front polygons, and in theory I could have done the same to the back polygons, creating a 'Smooth' modifier for them just as I did on the front ones; but, there is something inciduous happening that you can't know about. ...something that makes no sense... Something that has to do with the application of 2D planar textures maps.

Thinking ahead, I know that the next step will be to add those front and back planar maps as surface textures to our figurine. When you're going to be hoping to translate something like a planar texture map from LightWave to 3D Studio Max format, you can almost be sure that it will break somewhere along the way unless you firmly understand what each program is doing to perform planar maps. It's always best to do some experiments before you go too many steps and find that you will have to do everything over again.

Lets review a bit... back in LightWave, I had explained that a planar map is like you had a slide projector, and it's like that slide projector is shining from the front of your world towards the back of your LightWave 3D world. The light from that projector is hitting the object and is passing through that object, and, therefore, any texture map which is going to be placed on those back polygons will need to be flipped because it's like the projector is shining right through the objects (You remember the red spot on the heel in Tutorial number 10, Texture Mapping?).

Well, we're figuring that in 3D Studio Max, it must be the same, correct? We've now got our figurine heading towards the 'Front' of our 3D Studio Max world; so if all things are equal, we'll be all set, right?

Lets see if we are O.K. (You are suspecting that we AREN'T).

We have a clue that something isn't right when we render the scene after importing the 3DS mesh into 3D Studio Max. Press 'F9' and it says:




So, we know that something called 'Map Coordinates' is missing. We also know that there is some relationship with a thing called UVW 1.

The other two things we can infer from this is that it is related in some way to the front Polygon and back polygon Surface Names. The obvious guess is that either the texture maps or bump maps for the front and back polygons are screwing up (or both).

In order to know what might be going wrong, we'll first need to understand how 3D Studio Max treats planar texture maps. As usual when you wish to learn something new, the first step is to start browsing the 'Help->User Reference...'. These help sections are generally confusing, so I'll be adding images to the text to help illustrate what they might be talking about.

Any comments in red or green are mine.


UVWs

(From the UVW Map Modifier section. We first need to know what UVW stands for...)
"The UVW coordinate system is similar to the XYZ coordinate system. The U and V axes of a bitmap correspond to the X and Y axes."

( Ah. That is VERY IMPORTANT. They are saying that U and V are the same as X and Y.

"The W-axis, which corresponds to the Z-axis, is generally only used for procedural maps, although a bitmap's coordinate system can be switched in the Material Editor to VW or WU, in which case the bitmap is rotated and projected so that it is perpendicular to the surface."

In 3D Studio Max, the X and Y, as I've mentioned before, are rather strange. Z is the 'Up and Down' axis in 3D Studio Max. Thus, to have X and Y be like a regular graph, and Z be 'into our world', that is talking about the 'TOP' viewport. Look at the indicator in the 'Top' viewport and you'll see what I mean.




In LightWave, on the other hand, X and Y with Z going 'into' the world would be the 'Front' viewport.


So, we have just learned that 3D Studio Max's Top Viewport is similar to LightWave's 'Front' viewport.

It also implies a second thing. In LightWave a planar map is projected from the 'front of LightWave's world pointing towards the back'. Does this mean that planar maps are projected from the sky pointing towards the ground in 3D Studio Max? You don't believe me? Well, read on.)


"...scanned, imported, or hand-constructed polygonal or patch models do not have mapping coordinates until a UVW Map modifier is applied."

Do you remember the requester which said, 'Missing Map Coordinates'? It also said, 'The following objects require map coordinates and may not render correctly'. This was referring to FrontPolyg and BackPolygo. They are agreeing with what occurred, in that they are saying that imported objects do not have mapping coordinates. Thus, (Very Important) - a 'UVP Map Modifier' needs to be applied.

"If you apply a UVW Map modifier to an object with built-in mapping coordinates, the applied coordinates take precedence if map channel 1 in the UVW Map modifier is used. The Generate Mapping Coordinates option, available during the creation of primitives, uses map channel 1 by default."


Mapping for 2D Maps

"You can locate a 2D map on the surface of an object by using a map channel, any assigned vertex color, or the local or world coordinate systems. You can also choose different environment mappings. See Coordinates Rollout (2D)."

The 3DS exporter is wanting to map 2D maps onto surfaces... The 'Missing Map Coordinates' requester said (UVW 1) twice, so that might mean 'Channel 1'?


Maps and Mapping Coordinates

"Maps have a spatial orientation. When you apply a material with maps in it to an object, the object must have mapping coordinates."

... And, the FrontPolyg and BackPolygo surfaces don't yet have mapping coordinates.

"These are specified in terms of UVW axes local to the object.

...

Some objects, such as editable meshes, don't have automatic mapping coordinates."

I believe that the triangle polygons from LightWave are being converted into 'Editable Meshes'. This is what the 3DS Export Module does, I believe (not being smart enough to convert Nurbs surfaces and such).

"For these types of objects, you can assign coordinates by applying a UVW Map modifier."

That's the second time we've been told we will have to apply what is called a 'UVW Map Modifier'

"If you assign a map that uses a mapping channel, but don't apply a UVW Map modifier to the object, the renderer displays a warning that lists objects that require mapping coordinates. You can also use UVW Map to change an object's default mapping."

Aha! (Very Important) That sounds exactly like what is happening. A map has used a 'mapping channel' (probably channel number 1) but didn't apply a UVW Map Modifier to the object because it already had said that it doesn't do that on Imported objects.

UVW Mapping Coordinate Channels

"Each object can have from 1 to 99 UVW mapping coordinate channels. The default mapping (from the Generate Mapping Coordinates toggle) is always UVW 1. The UVW Map modifier can send coordinates to any of these channels."

So, 'UVW Mapping Channels' go from 1 to 99.

"Each map in a material can use any UVW channel (if present)...
"


So, what did I learn from all of that?

  • I learned that most likely the planar maps will not apply correctly because the object would have to be lying down if the projector comes from the sky pointing downwards.

    I will have to do experiments to see if this is the case.

  • I learned that map coordinates are not being applied to the imported surfaces named 'FrontPolyg' and 'BackPolygo' because map coordinates are not automatically applied to imported objects.

  • I learned that the two maps have used a mapping channel (probably UVW Channel 1), but they didn't apply a 'UVW Map Modifier' to the objects.

  • But, the most important and shocking thing I learned is the 'Z' axis really does go up and down in 3D Studio Max's world. Don't think this to be a small thing, because it isn't. In the math world, the X axis should go left to right, the Y axis, Up and down and the Z axis, into the world.

    It isn't the entire program that is that way, though. When 3D Studio Max first turns on, the default camera looks down the 'Y' axis (All you need do is look in the Perspective window to verify that).

    If the Z axis in 3D Studio Max goes up and down (which it does), that means that the world is like an enlarger, where the platform of the enlarger is the world, the X axis would be a line drawn horizontally on the board of the enlarger, and the Y axis would be a line drawn straight from you to the post of the enlarger.

    In and out would be into the board, or toward the enlarger's lens. Thus, as I mentioned, the 'Top' view would be the 'Front' of the object. And I thought LightWave users had it bad with the 'Back is Front' problem...

    Why is it that programmers do stuff like this? And, why is it that no tutorial I've ever seen for 3D Studio Max has ever mentioned this? Is it the old "Shut up about the faults of 'our team'." thing? Anyway, if you have been really really confused about what's what, know that it is built in to the program. It isn't you.

Let me interject here. I'm going to rip the fabric of spacetime here. I am now arriving from 'the future' after having done many experiments. First I need to say that the plug-in is broken, in many respects. My guess? It was developed back about the time of Max revision 2 and we are now at Max 4.2. Why do I think that? Because both 'FrontPolyg' and 'BackPolygo' are using one channel, UVW Map Channel 1.

First, I'll prove that the 3DS Export module is buggy, and show what can and can't be used when exporting from LightWave v7.5 to 3D Studio Max v4.2. I will show the correct method one should use, and why.


IN WHAT WAYS IS LIGHTWAVE'S 3DS EXPORT MODULE BROKEN?

First, lets see what we get if we act as if the module works.

I load the LightWave object, from which I reduced the number of polygons in the last tutorial, called 'figure, no skelegons.lwo' into Lightwave Modeler.




I do a 'File->Export->Export 3DS', save it as 'figure - no rotation.3ds' and turn off 'Apply Rotation'.




I go to 3D Studio Max and do a 'File->Import...' and choose 'figure - no rotation.3ds'.




I press 'F9' just to prove that the map files are still present inside this version of the file and it shows that the objects called 'FrontPolyg' and 'BackPolygo' have un-mapped coordinates.




I set up a target camera in the 'Left' viewport by going to the 'Lights & Cameras' tab of the 'Tab Panel' and selecting the 'Target Camera' icon.




I click with my right mouse button in the 'Left' viewport, press 'z' key to zoom and drop back. I press CTRL-P to pan and center the figure so he's laying at the bottom of the viewport. I click in the 'Left' viewport above his neck and drag downwards. The camera expands outwards like a pyramid.
,br>



I ensure that the camera is also centered over the figure in the 'Front' viewport.




Next, I select 'Omni Light' from the 'Lights and Cameras' tab of the 'Tab Panel'.




I add two omni lights in the 'Top' viewport, one over each side of her chest by clicking with the left mouse button.




I choose the 'Select and Move' tool from the 'Main Toolbar' to ensure that I don't accidently add any more lights, and to move the lights higher.




In the 'Front' viewport I move the lights up a bit.




I click in the 'Perspective' viewport and press the 'c' key to switch to the 'Camera' view in that viewport.

I right-click over where it says 'Camera01' and choose 'Viewport Clipping'. I drag the bottom yellow arrow down to the bottom and the figure appears.




Viewport clipping is an annoying 'Help Feature' that removes parts of an object if you are too close to the object. I hate viewport clipping. They have the same annoying feature in LightWave, and it also causes problems there.

Now, I am ready to add map coordinates. I go to 'Graph Editors->Schematic View->New Schematic View'.




Click on 'Default' and it will turn yellow.




Press to delete it.

I click with my left mouse button in the 'Left' viewport to make sure that all polygons are unselected and the white wireframe goes away, being replaced by a light-blue color (both objects have been given the same random light blue color, as can be seen by the color of the little triangle at the upper-right corner of the name box).

I double-click on the left side of the 'FrontPolyg' box, where the red symbol is, and it turns yellow. The Front Polygons become selected (they turn white).




I close the 'Schematic View 1' window. Theoretically, if the export module had properly added textures to this object, I should now be able to go to the 'Material Editor' and a Material would be defined. I press the 'Material Editor' button to see...




However, no material has been defined.




Secondarily, when textures are added, the 'Maps' rollout should have the Diffuse Map and Bump Map selected. I look by clicking on the + sign next to where it says 'Maps'.




They aren't. So, the textures aren't being added in the typical, legal, fashion. I close the 'Material Editor'.


ADDING A UVW MAP MODIFIER TO THE MODIFIER STACK

I click the 'Modify Panel' in the 'Command Panel' and see that an 'Editable Mesh' is there for the Front Polygons.




From the 'Modifier List' UV Coordinate Modifiers section I select 'UVW Map'. It adds to the 'Modifier Stack', above the 'Editable Mesh'.




An orange box appears around the figure in the 'Top' viewport.




This shows the mapped area. Theoretically, the object now has map coordinates if all went well, but how can it have proper map coordinates for both the diffuse map, and bump map if it is only using Map Channel 1?

Lets look to see if Map Channel 1 is the one that's selected. I scroll down in the Modifier stack parameters and find it under 'Channel'.




Well, lets see what we've got. I press 'F9'.




Huh. That's pretty, but what is it? Looks like at least part of it is the bump map for the back polygons from the dark black line that's about half-way down. However, there also seems to be color in the image so it is not just that bump map. It is somehow including one of the diffuse maps, it seems, but certainly not doing it the way it did it in LightWave. There are white areas, which means that areas of the diffuse map which shouldn't be mapping are mapping or it wouldn't be showing white.

If I compare the image with the bump map, flipped horizontally, I see correlations in details in the ass line, the left shoulder, and in the hat line.




It is now plain that it only uses UVW Channel 1. Thus, if the object had only one map then it might work? I'll begin again, do the same thing again, but this time I'll only keep one diffuse map for the front polygons, deleting the two bump maps and the diffuse map for the back polygons.

I return to LightWave and press 'CRTL-F3' to envoke the .

I click on the the 'Back Polygons' name in the 'Surface Name' list, clicking the 'T' next to the 'Color' section.




I remove the texture by clicking...




I do the same, removing the bump map from the 'Back Polygons', and the bump map from the 'Front Polygons'.

I do 'File->Save Object As...' and save it as 'figure-onemap.lwo'.

I do a 'File->Export->Export 3DS' and save it as 'figure-onemap.3ds'. I turn off 'Apply Rotation'.

I return to 3D Studio Max, saving the old scene as 'figure-fourmaps.max'.

I go to 'Graph Editors->Schematic View->Schematic View 1', click on 'FrontPolyg' object and delete it by pressing...




I also delete the 'BackPolygo' object in the same manner. Leaving only the camera, the camera target and the two omni lights.




I do a 'File->Import...', choosing 'figure-onemap.3ds'.




I click 'OK' to merge it with the current scene.

I click in the 'Top' view to deselect all polygons and find that it randomly picked marroon as the color of the two objects this time, instead of light blue. I select the 'FrontPolyg' object by double-clicking the box in the 'Schematic View' window. After selecting any object, I can change the wireframe color for that object so I can see it better by clicking on the color gadget in the Control Panel after I've selected the object (to the right of the object's name).




I, again, add a UVW Map Modifier to the 'FrontPolyg' Editable Mesh.




And, to smooth the surface, I also add a 'Smooth' Modifier from the 'Modifier List' Mesh Editing section. In the Smooth Modifier's parameters, I checkmark 'Auto Smooth'.




Note that any newly-added Modifier appears in the modifier stack above the currently selected Modifier.




I go to the 'Rendering' tab of the 'Tab Panel' and choose the 'Render Scene' button.




This is where you can set many settings for your rendered scene. You can also scroll the window by moving to a blank gray area, and when the hand appears, use it to scroll the window. I make sure it says 'Camera01' as the Viewport. It is here that I select the rendered size. I could also render other viewports.




And, it is now much closer to being correct. However, those big white streaks seem to me to indicate that the map image is being stretched in the vertical direction for unknown reasons.




A comparison with the full front map seems to indicate similar areas, so I think it's the correct orientation, just the wrong vertical size.

So, I make sure that the 'FrontPolyg' object is still selected, choose the 'UVW Mapping' Modifier' from the Modifier stack and using the tiny down-arrow to the right of the number for 'Length:', I drop it from .992" to an amazing .242" before it finally looks correct.




The resulting image is good




...but many things are drastically wrong with the methods that the LightWave 3DS Export Module is using to map images.

In the next tutorial I will show the proper way to assign Diffuse and Bump maps to the 'FrontPolyg' and 'BackPolygo' objects in 3D Studio Max.

Previous   Table of Contents   Home   Next