Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Mapping textures to round shapes other than cylinder.

AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
02-05-2008 00:17
How do you shape/construct/distort a texture so it will wrap round cones, vases, ball shapes etc., without distortion?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
The mapmaker's dilemma
02-05-2008 10:14
Cartographers have been wrestling with that question for hundreds of years. The answer is that it's not strictly possible. Whenever you try to transfer an image from a curved surface to a flat one or vice versa, there will be some distortion. In the mapmaking world, that creates a tradeoff between representing true shapes and relative sizes of objects (continents, etc.) .

The best way to get a compromise that is pleasing to you is to create your own map of the curved object you want to draw on. Use Photoshop (GIMP, whatever) to make a checkerboard pattern of colored squares, then upload it and apply it to your object in world. Use your camera to take photos from a variety of angles so you can study how your grid pattern is distorted. Then go back to Photoshop and tweak your original pattern by stretching or compressing to compensate for the distortions you see in your photos. Upload again to see how well the "corrected" grid fits on your object. For a simple object like a sphere, you should be able to create a map that works well after only a few iterations of this process. For a more complex shape, it may take a while. (Take a look at Robin Wood's avatar UV maps to see what a complex map looks like, for example.)

The quality of your map will depend partly on how patient you are and partly on how small you make the squares on your gridwork. When you are all done, though, at least you'll have a decent way to predict how you will have to stretch any other texture to make it look right on your 3-D object.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
Another way...
02-05-2008 12:52
Rolig's advice is correct.

An alternative is to use some 3D paint tool. You make a cone, or whatever, in the tool, you paint it to look like you want, then you extract that texture (you unwrap it, in other words) and import that into SL.
_____________________
So many monkeys, so little Shakespeare.
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
02-05-2008 15:57
Cool, really great input. Thanks.

That brings up another question which I fear has no easy answer.

How do you convert a 2D picture of 3D object into a texture to put back on a 3D shape of the original? I'm assuming that the surface facing front in the picture is repeated round the object. Can you take a strip parallel to the axis, correct for parallax and repeat/stitch together to make a texture which you then distort to match the 3D texture template? Or does this introduce too much loss of detail?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-05-2008 16:16
Ow! That gives me a headache. In fact, I think that is how NASA makes some of their 3-D photomosaics of planetary surfaces, like Mars and Mercury, but they have hefty software behind them to stretch individual photos just the right way. I imagine you could do it that way too, but my guess is that you'd have a real mess by the time you were done. You would be fighting distortion at every step in the process. It sounds like more trouble than it's worth, although it might be fun to try once, just for the heck of it.
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
02-06-2008 00:25
In 3D software you use UV mapping to transfer a 2D image onto a 3D model. To do this relatively easily for multiple images you need software that will support multiple UV maps on the same model (eg Blender). For each photo you create a UV map with "Project from view" which basically flattens the model as you look at it. This gives a UV map which will correct the 2D image into 3D space for the object.

You then use something like vertex weights to control the blend between the different images, this lets you select which image has the most detail for that part of the model. Once you've done that you could bake the final material to a normal UV map to create a combined texture for cleaning up in your graphics software.

http://blenderartists.org/forum/showthread.php?t=74137