texture to UV Map...From Blender to Unity...

Hi Guys,

sorry for this question but I have to get over this problem soon: I am modelling a pot in Blender. I create a material with a texture mapped with ‘Tube’ mapping. When I export the file into an .OBJ, the UV mapping is empty and of course Unity won’t visualize the texture properly on the model. So, back to Blender, I investigated about the UV-mapping editor… which drives me crazy. Actually, if I randomly map my model on the texture and Export it, Unity will visualize the texture (with the wrong map as it’s not a Tube map anymore).
So, I wonder what I am missing … once I create the material with the texture (and Tube-map) how can I also export the correspondent mapping in the OBJ file so that Unity can visualize it. The texture is repeated along my pot and it looks like the file in attachment.

Thank you very much for any help!
GC

641990–22942–$texture2.bmp (1.86 MB)

I guess you need to learn to UV map. There are plenty of tutorials about doing that in Blender.

–Eric

Ok, may be I’ll put some examples of what is the problem: vaso1.jpg is my vase with a material which as a texture mapped with Tube-mapping (texutre coordinates automatically generated) and the texture is repeated 5 times along the vertical axe. Now, vase2.jpg is the result of attaching a UV-map where the model has been unwrapped with Cylinder Projection onto the Image. Now, I don’t want the model unwrapped on the image, but the Image replicated on the model. Blender must have generated the texture mapping coordinates but when I export the file, it doesn’t contain them.

Cheers,
GC


642031--22945--$vaso2.JPG

You can just save Blender files, you don’t need to export in different formats.

–Eric

I did, but Unity crashes.

oh…even better, I’m using Blender 2.5 but Unity takes Blender 2.4 .blend file format… just perfect.

If you export to a different format, then include the UVs when doing so.

–Eric

Apparently, if I just create the material, with the texutre… without using the UV-editor, I’ll see the texture in the rendering… properly attached, but if I export in .OBJ file, check the UV-coordinates on (as I want the in the file) and again NOT using the UV-editor, well… unity doesn’t recognize any UV mapping and so it won’t attach the texture properly.

GC

If you don’t use UV mapping to create UVs, then there aren’t any, but you need them. Unity can’t import materials from any other app (they are all different and there is no standard). So, back to the beginning: I guess you need to learn to UV map. There are plenty of tutorials.

–Eric

So, in the picture there is the panel of my texture, and the Mapping is set to: Generated, Projection: Tube. Which makes it work only for the rendering… now, I want those coordinates. UV-mapping makes another thing, I don’t need to project the geometry onto the Texture. Modelling via UV_editor it will take ages…for such a silly operation.

cheers,
GC.

642060--22947--$panel.JPG

And this is the SmartUnwrap blender applies… onto my texture… now can you see my point… using UVEditor it project the geometry onto a pre-designed texture which is not what I want.

Cheers,
GC.

This is now your second thread on basically the same subject, and despite the fact that I replied to you with some help in the other thread, you gave, no response, no update on if it worked or didn’t work, and no thank you.

Despite my better judgement, I’ll reply to this one.
UNITY needs an actual UV map, not just interpreting one. The “generated projection” you used in Blender will NOT transfer to Unity, in fact this is true of “every” 3D program because it’s NOT creating a UV map, it’s just generating one on the “fly” to make it render. While it may not be convenient and you may not “like” the answer, you need to unwrap the model and make an actual UV coordinate map for Unity to be able to apply your texture to the model.

Next, your texture is non-square. This is, generally speaking, not a good thing. Typically what you do is unwrap the model into a square grid with a “blank” texture of whatever pixel size you want (256x256, 512x512, etc), and then paint the colors you want in various places in Blender using the paint tools, or export the grid to photoshop/GIMP, paint the texture over the UV grid, then import into Blender. You can even use your current texture as a sample set for painting the new texture.

If you’re dead set on using non square UV’s, then I would probably do the gradient texture the “other” direction (left to right instead of top to bottom), and just UV map the bowl in half, so one half is on one side of the texture and the other half is on the other side. This will have some overlap of inside and outside, but that seems to be what you’re trying to achieve, bottom brown, top edge black anyway. I have no idea how well Unity will deal with non square textures though…so the point may be moot, and I’ve never tried it myself.

To unwrap and split the bowl in half, go into edit mode, enter edge select mode, hold down ALT and click on an edge loop that passes all the way through the middle of the model, you may need multiple edge clicks with SHIFT to get it to go all the way through the model, depending on how your edges are aligned. Hit CTRL+E and choose Mark Seam. Open the UV editor, add a blank texture of whatever size, hit U to unwrap. Now either paint the map in blender, or go to the UV’s menu, choose export UV Layout, chose your format of choice, open the image in whatever paint program and make the texture map to the UV’s. You’ll need to cover up the edge grid completely or it will map back onto the surface in Blender when you import it back in.

Lastly, the .blend file import doesn’t “just” work with 2.49, it also works with 2.5x, but you need to download an update to the import/export python file here on the Unity site in the forums somewhere, do a forum search. Of course I haven’t tested this in Unity 3.4 yet…because, well, it just came out yesterday. :smile:

You can also view a video tutorial here if what I said above didn’t make sense:

http://www.blendercookie.com/2011/01/21/intro_uvmapping/