Jump to content
  • Advertisement
Sign in to follow this  
wcassella

Lightmapping and UVs

This topic is 583 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 currently in the process of integrating a lightmapper into my game engine, using this library. Some of the sample images seem to have a bit too much light around the corners, but overall it looks pretty good. 99.9% of my game is static, so I think this is the best solution for general-purpose lighting in my case. However, if anyone knows of any other libraries or tools I should look into though, I'd love to hear your suggestions.

 

Anyway, my engine's mesh format supports having 1-2 UV layouts per mesh. This way you can have one UV layout for materials, and another for light mapping, but if you only have one then light mapping will fall back to using the material layout. In both cases, they're artist controlled, which I prefer.

 

My idea for generating the scene's lightmap was to pack all UV layouts for static objects into one image, where each is scaled with respect to their size and importance in the scene, using an algorithm like this. One issue with this however, is that for small objects the margin between UV islands is going to get really small, to the point where bleeding might become a significant issue. An approach to fixing this would be to regenerate UV layouts for the entire scene during light mapping, but that's just more complication that I'd like to avoid.

 

So I have two questions here:

 

Have you encountered this issue, was it significant, and if so what did you do to fix it?

 

Are there any other light mapping tips or libraries you can suggest before I get heavily invested in this?

 

Thanks!

 

 

Share this post


Link to post
Share on other sites
Advertisement
Most modelling tools support lightbaking nowadays, e.g. 3dsmax. Their renderer usually deliver high quality results and it's fully artist tweakable. if your map is 99% created in such tools, it would be easiest to save all the work and give that a try. The worst part of lightmaps is the UVing, indeed. it's not just light leaking, but also stretching and hard borders you get (due to UV splits of connected meshes). it's a lot of tingling around if you want to solve that all by software. Good artist can usually fix that in their tools, it's not a fun work, but at least they have full control and kind of fast iteration time (you don't have to use 'final quality' all the time).

Share this post


Link to post
Share on other sites
I would recommend generating a second UV set just for lightmaps. This way you can fix light bleeding (cut UV charts at hard edges), light seams (stitch or use "seamless" UV mapping), control density, tightly pack generated charts etc. If you decide to use an external renderer, keep in mind that it needs to be able to support all your custom materials. This may be hard to do with something like 3dsMax. Additionally, it may be hard to extend it to use smarter lightmaps with normal map support (like SH or dir+ambient). Personally I would go with UVAtlas (+bruteforce UV chart packer and object chart bin packer) for UVs and either custom GPU lightmapper or custom CPU lightmapper using Embree for rendering. BTW some time ago I wrote a lengthy post about my lightmapping implementation (UV gen, packing, rendering) which may interest you: https://knarkowicz.wordpress.com/2014/07/20/lightmapping-in-anomaly-2-mobile/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!