   creating a better UV Atlas
  currently I'm working on an implementation of virtual texturing (the "megatexture" way)For this i want to unwrap all my models so that their UVs are in the range of 0 - 1.0.At present I'm using my own simple method to do this, which consists of rendering each subset in texture space with tiling on and using that as the new textures.This works ok for some models but for others it doesn't. Here for example you can see the texture atlas of the Sponza model and the model in my engine:For other models this doesn't work quite as well. Check out this house:It render's correctly in the engine but you can see that there's a lot of empty texture space. I don't know much about 3d-modeling and where this empty space is coming from.Then I tried using the UVAtlas features of Direct3d but it seems that it doesn't preserve tiling, which is what i need.So i'm wondering if anyone here has made experiences with these problems and some suggestions, links etc. Or maybe even an idea how i could use the Direct3d UVAtlas features for my intentions.I've looked at the papers of Hugues Hoppe but to be honest i didn't understand much of it. Some code snippets or algorithm details would be more comprehensible to me.   
Quote:Original post by scopeThen I tried using the UVAtlas features of Direct3d but it seems that it doesn't preserve tiling, which is what i need.I thought the idea of using a mega texture was that everything was unique (thus no tiling), am I wrong here?   ;  > It render's correctly in the engine but you can see that there's a lot of empty texture space. I don't know much about 3d-modeling and where this empty space is coming from.Maybe it's reserving space for the mipmaps??   ;  It looks more like you're trying to make an automatic UV unwrap tool, than an atlasing tool (although it fulfils that purpose)Quote:Original post by scopeAt present I'm using my own simple method to do this, which consists of rendering each subset in texture space with tiling on and using that as the new textures.How does this work exactly?Automatic UV unwrap is a pretty tricky business. People have been trying to make tools/plugins that do this for a long time, and the artists I work with are never satisfied with these tools :/Quote:Original post by NanohaI thought the idea of using a mega texture was that everything was unique (thus no tiling), am I wrong here?Yeah, but first you need a unique UV layout for your mesh. Once the model is UV'ed, you can start off by putting tiled textures into your mega-texture as a base, then paint in more details on top.   ;Quote:Original post by NanohaI thought the idea of using a mega texture was that everything was unique (thus no tiling), am I wrong here?I convert the textures into new textures that have the tiles in them. The atlases you see above are 16384x16384 pixels each.Quote:Original post by Ed WelchMaybe it's reserving space for the mipmaps??I'm not sure what you mean here, the mip maps are stored in different layers of the megatexture. The empty space is in the UV coordinates of the meshes.Quote:Original post by HodgmanIt looks more like you're trying to make an automatic UV unwrap tool, than an atlasing tool (although it fulfils that purpose)Both i think, in practice i unwrap each mesh and as a final step pack all created textures into a huge uber-atlas. For the examples above i only loaded one mesh.Quote:Original post by HodgmanHow does this work exactly?I find the min and max UV of the subset. Then i render the subset with a shader which uses the UVs scaled to 0 - 1 (using the min and max) as the vertex position and sample the texture using the original UVs. Since textures can become very large this way, i render them in tiles which are combined later. I also extrapolate the colors in a second pass to avoid seams. Then i store the clamped UVs in the subset.Quote:Original post by HodgmanAutomatic UV unwrap is a pretty tricky business. People have been trying to make tools/plugins that do this for a long time, and the artists I work with are never satisfied with these tools :/Yes, i get that feeling too :) It seems to vary from model to model, some make good use of the texture space, some don't. My goal would be to get rid of all that empty texture space. The D3D UV Atlas seems to be good at that but i can't figure out how to preserve the original tiling. Do you know any tools or libraries that i could use for my purposes?[Edited by - scope on May 15, 2010 1:37:10 PM]