Texture Atlas for Blender – Scene Lightmaps Baker [v 0.14]

Hi guys.



I found the Baker tool:

And I did my own Texture Atlas addon for baking entire scene. It creates TexCoord2 to every object and makes a texture atlas.



Googlecode page. My addons with latest changes will be here:

http://code.google.com/p/blender-addons-by-mifth/downloads/list



Forum: http://blenderartists.org/forum/showthread.php?265750-TextureAtlas-create-LightMaps-ShadowMaps-for-entire-scene



My video:



http://www.youtube.com/watch?v=Oqgq0vAgM_4&feature=youtu.be



http://www.youtube.com/watch?v=lDjdQAQOOuU&feature=youtu.be


Thanks.
5 Likes

@Momoko_Fan I did you feature reques. Please, test it:

https://code.google.com/p/blender-addons-by-mifth/source/browse/BakeAddons/TextureAtlas.py?spec=svne0c66f76d24ec8fe6e7736422051fd17b91b2400&r=e0c66f76d24ec8fe6e7736422051fd17b91b2400

It seems lightmap baker is ready for use.



Grub the script: http://pastebin.com/hjKhZpUa

Rename the file to MakeShadow.py .

And bake Your scene with objects.



I baked 156 lowpoly objects with one LightMap:

http://i.imgur.com/aIc0c.png

http://i.imgur.com/qLg5M.png

1 Like

Cool, but whats the difference to this? https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender#lightmap_baking

@normen said:
Cool, but whats the difference to this? https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender#lightmap_baking


You can select 150 objects and bake them into one LightMap. The script will create TexCoord2 and place all UVs (of 150 objects) into one place.

That way you mentioned can bake only one object. Or you will need to merge 150 objects into one, and then unwrap them and bake.

Every Box is a separete object on my picture. But they (all 150 objects) are baked into one lightmap texture:

http://i.imgur.com/tbU6k.png
1 Like

Ah, so its more about the atlasing than light maps…

it makes atlas and also bakes…

But if you want, you can modify the script and switch baking off. :slight_smile:

That looks nice…

Also the UI in blender looks more straight forward.

By the way, Normen thank you for the tip. I have done a separate Texture Atlas addon for blender based on the baker.



It can make a group of objects and make a Texture Atlas for them. Then it’s possible to select the group and bake it with the standard baker in blender.



http://pastebin.com/WQHRTUp9

TextureAtlas.py



It has one bug still. Only one textureAtlas group will work.

1 Like
@mifth said:
By the way, Normen thank you for the tip. I have done a separate Texture Atlas addon for blender based on the baker.

It can make a group of objects and make a Texture Atlas for them. Then it's possible to select the group and bake it with the standard baker in blender.

http://pastebin.com/WQHRTUp9
TextureAtlas.py

It has one bug still. Only one textureAtlas group will work.

Can't wait to try it out :)
@jmaasing said:
Can't wait to try it out :)


but you will need latest blender.
Try from here: http://builder.blender.org/download/

Ok, I fixed all issues. You will not get any error now. And I added all functionality, so all groups now work. Have a nice playing!



Updated script: http://pastebin.com/WQHRTUp9

TextureAtlas.py

Ok, i did a googlecode page. My addons with latest changes will be here:

https://code.google.com/p/blender-addons-by-mifth/source/browse/#hg%2FBakeAddons



http://www.youtube.com/watch?v=Oqgq0vAgM_4&feature=youtu.be



http://www.youtube.com/watch?v=lDjdQAQOOuU&feature=youtu.be
1 Like

Tried it out but didn’t manage to get it working for anything but one box in the scene. Probably I do something wrong so I’ll look at your tutorials.

My goal isn’t so much lightmaps as baking blender textures (and normal maps from multitextures). Will that work do you think? In other words I really like the atlas part of it :slight_smile:

You can bake normal maps with standard baker. This script is only for atlses.

TextureAtlas 0.13v is Out! The script for unwrapping and baking of an entire scene. Vital addon for game developers.


1 Like

The good thing this plugin does is always use texcoord2 for lightmaps and doesn’t create a new UVMap each time you want to unwrap. If you’re using this plugin for actual level design then you probably have to unwrap and bake many times, you don’t want to have to delete the UVMap each time to do this. Also if I understand correctly, if you use “Full Render” in baking, does it render the material with the lightmap that is assigned? The correct thing to do in “Full Render” mode is to disable the lightmap while baking, and enable it when done so the previous lightmap doesn’t “leak” on the generated one.



Also, one idea is if it could automatically create lightmap unwrap groups for you based on how much surface area each object uses. So as it goes through objects and notices there’s no more space in the texture, and creates a new texture / group for the next set of objects. This way you might have like 100 lightmaps each one 4096x4096 (for really huge environments maybe).

@Momoko_Fan said:
The good thing this plugin does is always use texcoord2 for lightmaps and doesn't create a new UVMap each time you want to unwrap. If you're using this plugin for actual level design then you probably have to unwrap and bake many times, you don't want to have to delete the UVMap each time to do this. Also if I understand correctly, if you use "Full Render" in baking, does it render the material with the lightmap that is assigned? The correct thing to do in "Full Render" mode is to disable the lightmap while baking, and enable it when done so the previous lightmap doesn't "leak" on the generated one.

Also, one idea is if it could automatically create lightmap unwrap groups for you based on how much surface area each object uses. So as it goes through objects and notices there's no more space in the texture, and creates a new texture / group for the next set of objects. This way you might have like 100 lightmaps each one 4096x4096 (for really huge environments maybe).



If Object has texcoord1, so the TextureAtlas script will create texcoord2.

You can unwrap lightMap group just one time then disable unwrapping. There are 2 ways to disable Unwrapping:
1 - switch "bake" off
2 - set "No Unwrap" button


If you want to use "Full Render" and if you have objects with assigned materials, so you can make a trick:
1 - Unwrap a lightMap group with the TextureAtlas script
2 - duplicate the lightMap group and move duplicated objects to another layer
3 - merge duplicated objects into one object
4 - remove all materials from the duplicated-merged object
5 - Bake a texture with "Full Render" and save a texture.
6 - delete duplicated-merged object.


I did another video for better explanation:
http://www.youtube.com/watch?v=OfwLQMx9NXs&feature=youtu.be
@mifth said:
If you want to use "Full Render" and if you have objects with assigned materials, so you can make a trick:
1 - Unwrap a lightMap group with the TextureAtlas script
2 - duplicate the lightMap group and move duplicated objects to another layer
3 - merge duplicated objects into one object
4 - remove all materials from the duplicated-merged object
5 - Bake a texture with "Full Render" and save a texture.
6 - delete duplicated-merged object.

Yes, I know it can be done manually, but it is tedious to do it for each object (which depending on group may have different lightmap). I was thinking that there could be a button to modify the materials of the objects to use their group's lightmap for rendering (e.g. use as ambient map with texcoord2) and another button to disable that map. This way you can preview how the actual material will look in jME3 in Blender.

It seems i understand your feature request. You want to have a button “Remove Materials/Restore Materials”.



I will try to add such a button.



But for a while try using this trick (it’s pretty simple too):

http://www.youtube.com/watch?v=6oOqER8i418&feature=youtu.be

1 Like