Tube texture problems - any help appriecated


(MAtt-Black) #1

Hi,

Got a big problem with a deadline looming. I Just discovered Blender last week and rushed out and bought the Official 2.3 Guide. I’m trying to map a image texture to the size of a tube to simulate a slot machine reel. The texture image is 240 wide by 1344 tall. No matter what size I make the tube as I rotate it around in an animation I keep seeing that the texture doesn’t meet up properly where the top meets the bottom.

I’ve tried altering every value I can see in the material ‘Map Input’ dialog and the Texture ‘Image’ dialog with no success.

I’ve used some simple calculations to work out that if the tube is 1 unit wide then the diameter (x & y sizes) should be 1.78. I’ve also tried making the texture repeat 3 times so that the diameter (x & y sizes) would be 5.348.

I need to rotate the tube around it’s centre and take a 42 images as it completes 360 degrees (or 120 if the texture is repeated 3 times for example).

I’ve set the Y repeat to 1, 2 & 3 and altered the sizeY, and everything else I can think of. If anyone could help I’d really appriecate it.

I’m quite a technical guy, who can program, administrate and work photoshop like a dream, but this has me completely stumped.

If needed I can email my .blend file, or as it’s really simple you could send me one. My email is matt-at-udc-dot-co-dot-uk.

Regards,
Matt


(MAtt-Black) #2

I’ve discovered that rather than animate the tube i can bodge it by altering the y offset for the texture in steps, rendering the scene and then saving out the frame image. This is a terrible way of doing it, but enough to meet my needs for today.

Sadly, I can’t find any documentation to explain how and why the texture doesn’t cover the surface of the tube 100% and/or what calculations I need to perform to make it do so.

If anyone does know please reply.

Thanks in advance.


(lirmont) #3

Tube Mapping Mini-Tut

Step 1: Texture & Setup

I followed your texture settings: 240x1344. It’s a common practice of mine (and probably others) to lay out an image with a grid pattern on it for map testing before just applying the image/texture you’re planning for the finished project.

Here’s mine, complete with arrows at the very top and very bottom to show continuity: http://darkabstraction.com/blender/tubeMapping/texture.jpg

Also, here’s a setup of the tube (SPACEBAR -> Mesh… -> Tube) I’ll be using for this mini-tut: http://darkabstraction.com/blender/tubeMapping/step1-setup.jpg

Step 2: Texture Setup

Add a new material to the tube and a new texture.

Now, this is probably where you’re meeting trouble. Tube mapping maps things by X (width) and Y (height), so your map is sideways relative to he way tube mapping will map your image to the tube. To fix this, we select the “Rot90” in the texture window.

Here’s a shot of that: http://darkabstraction.com/blender/tubeMapping/step2-texture.jpg

Step 3: Material Setup

Now, switch over to the material settings area. Make sure you select “Tube” instead of “Flat” (this is a tube mapping tutorial, after all).

Here’s a shot of the material settings: http://darkabstraction.com/blender/tubeMapping/step3-material.jpg

Step 4: Render

Render your scene out. If you’re using my texture, make sure that your picture looks like mine: http://darkabstraction.com/blender/tubeMapping/step4-render.jpg

I hope you’ll notice that the lines (which are 1px wide) sometimes get erased a bit. This is because, A, the tube isn’t in exact proportion to the image file and, B, the image is HUGE and not all the data can fit on the size of our render (i.e. increase the size of the render for all of the image data to fit).

Step 5: Animating and the I-Key

Switch to a view that has the “IPO Window” as one of the viewports. With your tube selected in object mode, press the I key and select “Rot”. This makes a new keyframe (the squares on the IPO window mark keyframes).

Here’s a shot of that: http://darkabstraction.com/blender/tubeMapping/step5-theIkey.jpg

You can navigate through the frames of your blend file/animation by pressing the LEFT and RIGHT keys to progress 1 frame at a time or by pressing the UP and DOWN keys to progress 10 frames forward or backward at a time.

So, move to the desired frame (if you’ve got 42 images and FPS is 12, then 300-ish for roughly each image being 3/4’s of a second on screen; note: you’ll need to change the rendering settings to match this). Insert another keyframe (I-key -> Rot). Select only the “RotZ” IPO. Press TAB to edit the IPO curve at it’s points. With the point at frame 300 selected, press the N key (N key pops up an information/editing window). Change the “Vertex Y” from 0.000 to 36.00 (this correlates to 360 degrees).

Step 6: Animating and Extrapolation

Now, if you were to render this out right now, you’d be sorely disappointed. The tube wouldn’t spin the way you intend it to. It would spin and slowly increase speed until it hit it’s peak around keyframe 150 and then slow back down to a stop at from 300. This is because of the type of “Extend Mode” (it’s a selection on the IPO viewport header) we automatically get. What you want is something that could repeat for a while, until you want it to stop. The important thing is that you want it to move at the same speed. To do this, hit TAB to exit curve editing, but with the “RotZ” IPO curve still selected, select “Curve” -> “Extend Mode” -> “Extrapolation”. You should see your IPO curve straighten out now. You won’t be able to see much, but if you press ALT+SHIFT+A (“View” -> “Playback in 3d Viewport”), it’ll cycle through your animation in a 3d viewport for you.

Here’s a shot of the “Extend Mode” selection: http://darkabstraction.com/blender/tubeMapping/step6-extrapolation.jpg

I hope that helps,
–lir


(MAtt-Black) #4

Absolutely marvelous!

I’d already sorted out the animation stage with a linear speed, etc.

The thing that had stumped me by the looks of it was getting the ‘Tube’ mapping to work. Once I changed it back to Tube I copied your settings from the small XYZ (3x3) box and it all snapped into place.

I am so grateful for your advice :smiley: