From LightWiki

Jump to: navigation, search


Street Wise. (part 1)

In this tut we will make a winding road. We will create custom textures for it from scratch. We will use automatically generated UVs Texture maps. And we will render it in LW native radiosity with Extreme Enhanced AA in under two minutes!

Okay, first things first. Take your digital camera... What? No digital camera? Log-on to your favorite auction site and buy one. There's no excuse not to have one these days if you are doing ANY kind of freelance CGI work! If you're on a budget I recommend a used Nikon CoolPix 880 which at the time of this writing goes for under $100 and can take 2048x1536 pixel images in RAW and 3 different qualities of jpeg compression. Good enough.


Creating Seamless Asphalt

Now, take your digital camera and stick your head out of a two or three story window (preferably on an overcast day or at 12-noon) and grab 3 or 4 shots of the street surface below. Frame the images to span the entire width of the street. Buy a $20 7-in-1 card reader if you don't have one or use the one you have to copy the images from your memory card to your hard drive. Additionally with the Nikon 880 as well as most cameras in its class range, you can copy the images to your hard drive directly from the camera just by connecting it to your computer with an optional USB cable.

Open the images in Photoshop or anything similar and pick the best image from the group. Delete the rest. No one likes a messy texture artist! Rotate the chosen image so that the sides of the street are on the right and left of the image as viewed on your monitor. Next use the square selection (lasso) tool to select an area that is evenly lit and doesn't have too many unique traits. The selected area should be as square as possible and stretch from one side of the road to the center of the street. If you're in Photoshop turn on the "Info" window so you can see if the selection is square while you're selecting.

Once you have a good square area of a section of half the street, crop the image to that selection and copy it to the clipboard - usually Ctrl c. Select the canvas size from the Image menu, double the width, and make sure you select the move-to area selector so the side of the street remains along one of the image boarders (right or left). When done rotate the entire image 180 degrees and paste the copy buffer you copied in earlier. Move the pasted layer so that the middle seams match up and you have what should look like a complete cross section of a road surface.

Merge the layers so that there is only one layer, select all, and press Ctrl c to copy the entire image into the copy buffer. Expand the canvas as you did before but this time double the height not the width. Make sure you select the move-to (destination) area selector so that the image is touching the bottom of the canvas border as well as both sides. Select rotate canvas 180 degrees again and again paste the contents of the copy buffer. Move it so that it fills the empty area at the bottom half of the image which should be blank if you did everything right.

Note: The reason we are rotating and not flipping the areas as we go is to break up any unwanted tileing effects and to provide us with visual feedback for determining if the street was lit evenly enough for our purposes here. For example taking the original photo and night when the street surface is lit by the uneven lighting of street-lights would not work well for the obvious reasons.

Again flatten layers so that there is only one and begin a clean up process to cover up any obvious seams. There shouldn't be very many if any. If there are your image was too unevenly lit or your camera's film plane (CCD plane) was not parallel enough to the street surface and you will have to shoot again. If it's not too bad do some clean-up by locating any small blemishes or seam patterns and selecting an area very close to it and then copying and pasting the non-blemished area over the top of the blemished area. If you're using Photoshop set the auto feather value to between 5 and 10 and just select, ctrl drag - select, ctrl drag - select, ctrl drag - etc. until all the "noticeable" blemishes are gone. In my image there were about 6 or 8 such blemishes that when tiled would make it obvious to the viewer that he or she was looking at something tiled and not continuous.


Drawing The Line

Create the traffic divider lines in a new layer by creating a rectangular selection of about the correct length vertically in the center of the image and using the fill tool in that layer / selection. If you are in Photoshop now would be a good time to use a filter and give the painted traffic divider lines a little texture detail - maybe even play with the new layer's opacity a bit. Okay we're done with the basic edit. Save the image as Road_Color.tga

Road Image - Color Channel


Birthing Bumps

Now convert it to a gray scale (Image -> Modes -> Grayscale if you're in Photoshop) and open the contrast/brightness and make it muddy dull and dark. Think "Height-Map" cuz you're making the bump map for this texture. Additionally bring the brightness of the traffic divider lines layer way down so that the overall intensity-average is just slightly above that of the asphalt surface. When done save-as Road_Bump.tga.

Road Image - Bump Channel


Just Speculation

Now we need a version of the map that will serve to break up specularity hits in a way believable for an asphalt street. It depends how old and oily or new and sparkly the street is as to whether we add contrast or remove it. For mine I had to remove it - first I did a "unsharpen mask" operation and then again I opened the brightness/contrast controls, muddied and darkened it and applied a very slight blur. Good enough for my texture and this tutorial's purpose. Save your results as Road_Spec.tga and we're ready for LightWave 8.0 or LW 8.2 if that's out by the time I finish typing in this monster.

Road Image - Specular Channel


Street Wise. (part 2)

Man, part 1 was a heck of a lot of reading just to take a pic of a road, clip it, rotate and paste quads, add a line, and then modify it for spec. and bump. Hopefully you already knew all that and you're down here reading the fun stuff. If not, that's kewl - you learned something.


Now the Fun Part - LightWave 3D!

Here we will put the textures that we ourselves created, to good use. LightWave 8 is so darn easy to use that this section could easily be written in just 5 or 6 short sentences. No! don't even think about it. You're not getting off that easy.


The Travel Section

Open up your LW Modeler and press {Shift X} followed by {n} and use the values you see in the figure below to create a box that will be our road section and a visual reference for texture tweaking. Notice that this is a 6 x 6 x 0.3 meter box created in the "Top View" at world coords 0,0,0. and has 4 segments across in the x axis.

Road Tut 0010.jpg



Next let's give this road section a little arc across the top. Can't have guys hydroplaning off our street on rainy days! Besides the shading and spec hits will look allot better this way. So in the front view assuming you are in wire frame or color wire frame view mode, lasso select the three points as shown in the image below. Actually we will be selecting 6 points when we do this as you can see in the other view panels of your quad view modeler layout. Once selected press {t} and nudge them upward in the positive Y axis just a tad. Feel free to try the keyboard nudge by pressing {Alt UpArrow}. Press {Space} to drop the move tool and deselect the points on both sides of the middle. You should see the "Sel:" readout ( in the bottom left of the modeler screen) indicating that just 2 points are selected - Top-most, center-most in the front view. Now press {t} once again and nudge it in the same Y axis about half as much as you did when you moved all 3 (erm, I mean 6). Press {Space} to deselect the move tool again and your results should look very much like the figure below.


Road Tut 0009.jpg



Let's set up the surfaces and as a special bonus for FPrime users let's use FPrime from Modeler! Yes that's right, FPrime previews right from Modeler! Well kind of.. First save the road section we have been working on as what else but what describes it best; Road_Section.lwo. Now select "Send Object To Layout" and Layout will pop to front as usual when this is done. While in Layout take the opportunity to load up FPrime in the usual way, make the Layout interface as small as you can without minimizing the application and move the FPrime preview window off of the top of the layout screen so that it's on top of nothing but your windows desktop. Arrange the camera and set up any lights as you like for texture tweaking. This is a road so something like outdoor or tunnel lighting would be optimal! Once FPrime is showing a nice preview of the road section click Modeler to the front and make it's interface (app window) small as well. Dual monitor users won't need this step by the way - just put FPrime on the other monitor! Ok we're all set for FPrime preview renders right from Modeler.

Surf's UP!

We're back in Modeler now so with it's interface selected just press {F5} to call up our buddy SurfEd. First off let's name this surface. In the SurfEd window it should display:

Selected Surfaces: 1 Default Polygons: 28 Textures: 0 Shaders: 0

Click on the "Rename" button just above that info box and enter "Road" for the name. Next click on the {T} button in the SurfEd next to the "Color" channel. With "Image Map" select and the Layer Type and "Planar" as the Projection Type, click the "Image" dropdown and select "Load Image". Locate the Road_Color.tga image you created in Part 1 of this tutorial and load it. Click on "Y" as the "Texture Axis", and click on the "Automatic Sizing" button just below. It should look something like this but with FPrime at the bottom if you own FPrime and are following along.


Road Tut 0006.jpg


Next click on Use Texture. Press {s} to save the object and select the "Synchronize Layout" option in the far far upper right pull-down menu. Hey! Cool! FPrime updated! Yeah ok, so you already knew that - well it did get you to read this far into the tut! Don't stop though cuz there will more ah-hem, "stuff" later too.

Okay, so repeat from the "click on the {T} button" in the paragraphs above but for Specularity -> {T} and for the Bump -> {T} instead of the one for Color. Adjust any settings for each texture as you know how beyond the description above. Save as you go channel to channel and anytime you want to see any changes that you have made via the FPrime Preview window just click "Synchronize Layout" and FPrime will update. If you need to force a preview update press {s} prior to Synchronize.

Before we leave the SurfEd for good turn on smoothing and set the "Smooth Threshold" to 10, set the "Glossiness" to 70 or 80 percent, and drop down the Diffuse to something reality based. Nothing is 100% Diffuse! Let's give it 80% or so and it should be look'en like a pretty nice chunk of street. Here's mine:


Road Tut 0005.jpg


Kurv's Ahead

Ya, Ya, I know... I stole that subtitle. Maybe he won't sue! Hey! I bought his books! And besides we're about to do just that; make kurvs err, umm, Curves. With Layer 2 in the foreground and Layer 1 in the background select the "Spline Draw" tool and draw/create a curve in the Z direction that represents the curvature you would like to have in your road. Be sensible with the twists and turns and start it off as close to X=0, Y=0, Z=3m as possible. When you are satisfied press {Enter} to make the spline. Make a note of the total length of your spline as we will use this value shortly. My spline ended up looking like this and is about 105 meters long:


Road Tut 0008.jpg


Zoom in and select the first point on the spline we created to make sure it's exactly at X=0, Y=0, Z=3m by pressing {i} or {v} and entering it numerically. Remember that our asphalt block is 6m X and Z with it's center point at 0,0,0 so Z=3m will be right exactly on the face of that side of our object. Also check X=0 and Y=0.

Road Tut 0007.jpg


Press { ' } to swap the foreground and background layers so that our asphalt chunk is once again in the foreground layer.

With modeler still in a quad view layout select "UV Texture" as the view type for the bottom right panel and click on the {T} button just below from the row of selections {W}, {T}, {M}, {C}, and {S}. Open the drop-down menu there currently displaying "none" and select "new". Enter the data as you see in the figure below and click on "OK" to define the UV space.

Road Tut 0011.jpg


If you did everything right it should look like the figure just below.

Road Tut 0012.jpg


Your background layer should still contain the spline we made just a few steps back. With that being the case lasso select the row of 4 polygons facing in the Z direction as seen below.

Road Tut 0013.jpg


Railed!

Now we're going to Rail Extrude the road shape *and* create the UV map for the resulting shape at the same time. Find and select "Rail Extrude" under the "Multiply" tab. Set it up as you see below but for the number of segments change the default 20 to the length of your spline in meters divided by 6. So if your spline ended at Z=63 and we know it started at Z=3 then the length of your spline would be approximately 60. and the number you would enter would be 10. You can also use trial and error here if you'd like. The purpose of this is to get the extruded segments as close to 6 meters each as possible. We will also be using the spline length again in just a few steps so hang onto it.

Road Tut 0004.jpg


After you have clicked "OK" to a satisfactory rail extrusion lasso select the original 28 polygon object and delete it by pressing {Ctrl x}.

Now all we have to do is apply the newly and automatically created UV in our surface properties. Press {F5} to bring up Mr. SurfEd and for each of the channels we had an image applied to (Color, Specularity, and Bump), select Projection as "UV" instead of "Image" and then select the "Road_UV" from the "UV Map" pull-down menu. Here is the Bump channel shown below for reference.

Road Tut 0003.jpg


Also in the figure just above is shown our next step. In this step we will stretch the mesh in our "UV Texture" view panel to be about the same length as our spline or until we are happy with the spacing of the traffic divider line.

So press {h} for the stretch tool and locate your cursor at U:50 V:0 and press and hold the {Ctrl} key to constrain single axis stretching as you click and drag your mouse upward.

Press {s} to save your finished model and switch over to layout for that speedy radiosity render! Hey, under 1min. on this machine and it's a P4 3.0gig dog!

Onto the second half of the tutorial: Ultra_Fast_Radiosity