@mifth: I get the following when trying to run the script:
Info: Something went wrong!
Traceback (most recent call last):
File "D:ProgramsBlender2.63scriptsaddonsTextureAtlas.py", line 295, in execute
bpy.ops.object.select_all(action='DESELECT')
File "D:ProgramsBlender2.63scriptsmodulesbpyops.py", line 180, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.select_all.poll() failed, context is incorrect
Also, when clicking "Start Unwrap/Base" with lightmap mode, the model is not unwrapped correctly. E.g. for the cube, all faces map to the entire texture which is incorrect. I followed the exact steps that you did in your previous videos by using the new plugin.
@Momoko_Fan said: @mifth: I get the following when trying to run the script:
Also, when clicking "Start Unwrap/Base" with lightmap mode, the model is not unwrapped correctly. E.g. for the cube, all faces map to the entire texture which is incorrect. I followed the exact steps that you did in your previous videos by using the new plugin.
I cannot repeat your exception. Can you download the latest blender here and try again: http://builder.blender.org/download/
I supposed you will make manual unwrap. That's why all polygons were on entire texture. :) Ok, I added AutoUnwrap button.
Try again the latest version, please:
http://code.google.com/p/blender-addons-by-mifth/source/browse/BakeAddons/TextureAtlas.py?spec=svn2297847fda0c9aa7cf3acecbc0dde3f52bf642ae&r=2297847fda0c9aa7cf3acecbc0dde3f52bf642ae
@mifth: I tested the latest version of your script (v0.14). All issues I had before were fixed, it could become the best lightmapping script for Blender
One issue I noticed while trying to unwrap / bake a plane, here’s the log:
[java]Starting unwrap
Warning, less then 4 faces, skipping
finished all 0.00
Traceback (most recent call last):
File “C:UsersKirushaAppDataRoamingBlender FoundationBlender2.63scriptsaddonsTextureAtlas.py”, line 516, in execute
Error: No objects or images found to bake to[/java]
EDIT: One more thing I noticed: I started by creating 1024 size lightmaps but then after playing around I decided to switch to 512, but the lightmaps were still 1024. It seems like you may need to ensure the already set lightmap size matches the size set in the GUI.
@Momoko_Fan said: @mifth: I tested the latest version of your script (v0.14). All issues I had before were fixed, it could become the best lightmapping script for Blender :)
.....
...
Hi man! Thank you for testing! You could have some issues if your blender revision is less than 50100. Blender API could be different a bit.
I tested a Plane object with blender revision 50310 and 50520 and i have no such an exception when I autoUnwrap it.
I hope you tested it with latest blender builds from here:
http://builder.blender.org/download/
http://www.graphicall.org/
About texture size: if you did not save the generated texture, so their size will be changed. Other way - you can make "Image -> Replace Image" magic. :)
I posted the script into blenderNation and i have many positive results: http://www.blendernation.com/2012/09/13/textureatlas-add-on-baking-entire-scenes/
@nehon said:
Why not make the script compatible with 2.63?
blender 2.63 has 17 different API. 2.63.0, 2.63.1, 2.63.2... 2.63.17 is the latest one. Actually, I don't know which api is used for the official release.
But the script will be compatible with official 2.64. :) I will test it anyway.
@nehon said:
I guess there are no big differences between those API (I hope so...)
According to your feature request I did compatibility with all blender 2.63 API. Download it! :)
http://code.google.com/p/blender-addons-by-mifth/downloads/list
Edited: @Momoko_Fan i fixed the exception you posted above for official blender release. Now you can use the script with standard blender. :) Thanks.
the resulting maps look great in blender! how would I use that lightmap in jme thereafter? you wrote it is based on texcoord2, do I have to export the models therafter in a special way?
@mifth: I tested your version for 2.63, it works fine now
I actually have the same question as ghoust: How do we actually get these lightmaps in jME3? There’s no way to assign the lightmaps to the materials right? The way it should work is, if it sees the material is shared with another object that uses a different lightmap, then it should clone that material. The only issue I see is that you cannot “unclone” the materials easily … This method would only work if you generate the lightmap as the last part of game level design…
Also I noticed that sometimes after baking the texture several times, it doesn’t actually update it in the 3D view but it appears correctly in UV view. Do you know why that happens?
@Momoko_Fan , great that it works, thanks for testing! Just export the model into Ogre (only ogre supports texCoord2). And you should have 2 UVMaps - one for common texture and one for lightmap texture.
@mifth: What I mean is, the model’s material normally won’t have the lightmap unless you assign it manually. I think that the Lightmap Baker should automatically assign the lightmap onto the model’s material.
@Momoko_Fan said: @mifth: What I mean is, the model's material normally won't have the lightmap unless you assign it manually. I think that the Lightmap Baker should automatically assign the lightmap onto the model's material.
You should manually assign textures. Reasons:
- Not all people use Blender's Materials for their game engine and models.
- Not all people use Blender internal Render. For example, Cycles render uses nodes for materials.
@Momoko_Fan said:
Sure, but game engine materials cannot use TexCoord2, or multiple textures per material, so your script won't work for them anyway.
The purpose of this feature is only for games. Games cannot use nodes for materials, so its not necessary to support nodes.
- @nehon already said how to use lightmaps: "You just have to set the boolean UseSeparateTexCoord to true and texcoord2 will be used for lightmaps." Everything works ok, just have a try. :)
- Not only for games. :) Sometimes this is feature request of animation studios..