Archived

This topic is now archived and is closed to further replies.

"Baking" UV coords

This topic is 5047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm putting together some various scripts and utilities for Blender in preparation for the sequel to my current project, which will make use of 3D models, and in my research into modelling and texturing I've come across mention of Texporter and other utilities, as well as built-in functions, for generating UV coords and mapping them to a 2D texture. Blender has various simple built in UV mapping functions (Cube, Sphere, Cylinder etc...) but I was wondering what other "baking" methods there are which might be more convenient to work with for arbitrarily complex models. I have considered a script which will break a model down into various patches based on difference between their face normals; adjacent faces with normals that are close to equal (within some arbitrary range) would be flattened into a single patch. I've done a few preliminary tests, and while this method seems to get good coverage with a minimum of strange stretching or compression, it leaves the texture patches a chaotic jumble, leaving the modeller with a pretty mess to try and stitch together and turn into an efficient and concise texture mapping. I've heard passing mention of other methods as well, such as shrink wrap, but I do not have access to expensive packages such as 3DStudio/Maya/Lightwave which might have these other "baking" functions in order to try them out and see how they function. What other methods for UV mapping are there, and does anyone know good links where I can read up on actual implementation of some of these methods, and learn more of how they work algorithmically? Thanks in advance. Josh EDIT: Upon second thought, this might belong better in the Graphics Programming forum. If a mod reads this and feels like moving it, I'd appreciate it. Thanks, and sorry.

Golem Blender--The Gimp--Python--Lua--SDL Nethack--Crawl--ADOM--Angband--Dungeondweller
[edited by - VertexNormal on February 21, 2004 11:47:55 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well, I was hoping for the same sort of info when I found your post. I found a site where i guy posted an expert/import suite with some luv scripts for blender, you can try em out if you like. I dunno about em cause i haven''t tried em yet. If you need to contact me, you can prolly find me as Dudy or Dudymas at the blender.org site... I post randomly, but not very often. Here''s the site:

http://ourworld.compuserve.com/homepages/scorpius/blender_suites.htm
You can [url=http://ourworld.compuserve.com/homepages/scorpius/blender_suites.htm]Click here[/url] or use link above. I think you should be able to see the source and so have some ideas for UV editing. If you can manage an luv exporter before me, then submit your site (if you do host the files) to the google crawler for me and all the other blenderheads. Isn''t blender getting powerful now-a-days?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Well, I was hoping for the same sort of info when I found your post. I found a site where i guy posted an expert/import suite with some luv scripts for blender, you can try em out if you like. I dunno about em cause i haven''t tried em yet. If you need to contact me, you can prolly find me as Dudy or Dudymas at the blender.org site... I post randomly, but not very often. Here''s the site:

http://ourworld.compuserve.com/homepages/scorpius/blender_suites.htm
You can [url=http://ourworld.compuserve.com/homepages/scorpius/blender_suites.htm]Click here[/url] or use link above. I think you should be able to see the source and so have some ideas for UV editing. If you can manage an luv exporter before me, then submit your site (if you do host the files) to the google crawler for me and all the other blenderheads. Isn''t blender getting powerful now-a-days?


Thanks for the link.

I downloaded and checked out the suite you mentioned, and it looks like it consists mostly of import/export scripts rather than UV generation tools. I still have to look at it more closely, though.

What I am looking for is methods on generating the UV coordinate unwrapping for a character mesh, in order to efficiently pack UV maps for the character skin into a single texture and optimize coverage of the model and texture space usage. Currently, I generate UV unwrapping through a rather tedious process of selecting a group of faces, rotating the model so that the visibility of these faces in the window is maximized, generating a patch of UV coords from the window coords, then shuffling/stitching these various patches around to fit within a single texture for skinning. Sometimes I will use cylindrical or spherical UV unwrapping on portions of a mesh if the geometry suits it, but it still involves a lot of stitching and shuffling to get it right, and a lot of iterative tweaking to get good, even skin coverage and minimize distortion.

I understand that plug-ins such as Texporter automate a lot of this task for applications such as 3DStudio, and I was just wondering what procedures they use in order to implement something similar for Blender.

Thanks



Golem
Blender--The Gimp--Python--Lua--SDL
Nethack--Crawl--ADOM--Angband--Dungeondweller

Share this post


Link to post
Share on other sites
Google for "mesh parameterization" or "texture atlas creation" which is the "scientific" names for what you want to do. Probably most hits on the "parameterization" keyword.

A very good place to start is Hoppe''s graphics group at Microsoft Research. http://research.microsoft.com/~hoppe/.

The technique you use is reasonable although not the state of the art; you should probably set your tolerance to be fairly lenient to get larger, connected pieces of the mesh. Like, as long as you''re within 45 degrees of the initial normal, keep going. Then you can try to stitch one of each triangle edges together with one of the edges from another group, and see if the patches overlap or not -- if not, you might want to keep ''em stitched.

Or you can set the tolerance to something like 60-70 degrees, and then run a spring relaxation simulation on the generated mesh to come up with a good compromise between stretching and connectedness. One reasonable relaxation metric is this:

Calculate the lengths of all edges in the mesh, in mesh space. Call this Lm.

For each edge, calculate its length in UV space. Sum all the lengths. Call this Lt. Divide Lt by Lm and call it Smt.

Now, for each edge, compare edge length in UV with length in mesh space divided by Smt. If greater, you want to shorten this edge; move the edge vertices 0.1*difference closer to each other. If smaller, you want to lengthen the edge; move edge vertices 0.1*difference away from each other.

Repeat 20 times or so, until movement subsides. You may need to add additional heuristics to avoid flipping triangles in UV space and possibly to avoid self-intersection if your patch is not convex.

Good luck!

Share this post


Link to post
Share on other sites
Wow, hplus0603, thanks. That was exactly what I was looking for. I was wondering what the "proper" Google search terms were. I certainly wasn''t getting much luck with variations of "UV unwrapping", etc.

That spring relaxation technique is a great idea, and I''m starting experimenting with it in my current (crude) patch generation script right now.

Thanks a lot for the search terms and the link; lots of good stuff there. Ought to keep me busy and out of trouble for awhile.

Cheers,
Josh





Golem
Blender--The Gimp--Python--Lua--SDL
Nethack--Crawl--ADOM--Angband--Dungeondweller

Share this post


Link to post
Share on other sites