Page 1 of 1

UV mapping generation.

Posted: Sun Jun 17, 2012 8:02 pm
by Mel
I would like to know which are the best algorithms for UV map generation. The point is that i want to integrate a small tool to my editor that was able to generate the mapping coordinates for a lightmapping. Google won't be nice to me, it offers lots of tools, free, cheap, or expensive but i don't want a "tool", i want to generate them on my own.

Anyone knows something about this? :?

Re: UV mapping generation.

Posted: Sun Jun 17, 2012 9:14 pm
by nespa
I found an interesting article here :

http://www.3dkingdoms.com/weekly/weekly.php?a=34

Re: UV mapping generation.

Posted: Mon Jun 18, 2012 8:11 am
by hendu
There's a lot of options, spherical, planar, cubic.. But if you have the (cpu) time, the best results should come from just mapping the surface - think of a sheet placed over it, how it would distribute.

Re: UV mapping generation.

Posted: Mon Jun 18, 2012 10:18 am
by fmx
you know, I've been doing the exact same thing for the past few days :P
i need lightmaps for my upcoming game project, and I dont like using irredit so I had a look at generating my own

by far this was the best article i found online
http://www.flipcode.com/archives/Light_ ... tion.shtml

once you understand it, the concept is fairly simple: planar map all polygons onto a new lightmap texture, then use each texel on the surface to determine lighting/radiosity at that point.
the most difficult part is optimally positioning the polygons on the lightmap texture to begin with, the rest is fairly straightforward

Though saying that, I found that Max produces fairly efficient lightmaps, and since it already includes powerful lighting system, I question why I even wasted time creating my own lightmapper...

Re: UV mapping generation.

Posted: Mon Jun 18, 2012 5:07 pm
by Mel
Because it is much simpler to generate your own UV charts than merging 2 meshes to have a mesh with 2 sets of mapping coordinates, and because it integrates everything inside a single application.

Re: UV mapping generation.

Posted: Tue Jun 19, 2012 9:39 am
by fmx
@Mel
I was questioning myself :wink:
last week I rushed ahead with adding a lightmapper into my editor and afterwards I realised I didn't have to:
Max (or any other 3D modelling package for that matter) can generate MUCH higher quality lightmaps than even UDK or Unity are capable of, not to mention the level of control over the generated UV maps

I guess the real problem for irrlicht users is dealing with the data exchange: getting the model data out from Max (or whatever tool) with multiple UVsets intact

I wrote my own COLLADA loader from scratch last year and I found the DAE files exported out from Max2010 work perfectly with my loader.
FBX format is also capable of exporting out multiple UV sets (the preferred interchange format from Max to UDK/Unity actually)

I dont know the state of the current DAE loader in irrlicht, but it should be fairly trivial to edit it to allow loading in additional UVsets into irrlicht's S3DVertex2TCoords or into S3DVertexTangents' Binormals or something

To each his own, I just thought it might be worth sharing my experience with the community :)

Re: UV mapping generation.

Posted: Wed Jun 20, 2012 2:42 am
by Virion
generate own UV is quite important, especially for optimization -- combine all the static objects into 1 single mesh, generate it's UV and use just 1 lightmap for the entire scene. much faster than having to apply a lightmap to each of the object in the scene.

Re: UV mapping generation.

Posted: Fri Feb 15, 2013 11:40 pm
by ibax
Virion wrote:generate own UV is quite important, especially for optimization -- combine all the static objects into 1 single mesh, generate it's UV and use just 1 lightmap for the entire scene. much faster than having to apply a lightmap to each of the object in the scene.
Virion: and what if my object is a house with many rooms? and I cannot put everything to one single UV map (walls, furniture, ...)? what is the fastest solution of UV mapping in this case?

Re: UV mapping generation.

Posted: Fri Feb 15, 2013 11:42 pm
by ibax
I also have a problem with UV mapping: the UV maps is irrEdit looks good, but when executing the irrLicht project, than the UV mapping is not used (textures are mixing). What can be the reason of this? I have only one UV map (map1). In irrEdit the model looks good, so I think, the generated obj+mtl file contains all the necessary information...