Texture Atlas Generator

Version: 
1.0.3

This script generates a texture atlas out of the selected objects, and manipulates their UVs (and if necessary, their geometry as well). Currently only Multimaterials and/or Standardmaterials (with bitmaps in diffuse channel!) supported.
Texture atlasses especially are important for real time applications and game development. Check http://developer.nvidia.com/object/texture_atlas_tools.html to see performance comparisons.

Features:
- geometry slicing
- padding
- simple packing algorithm
- editing many objects at once, thus creating only one atlas for all of them

If feedback is positive, 3d-io would consider transforming this script into a much faster and better plugin, developed in C++.

Example for a generated texture atlas:

Additional Info: 

This script adds a single button to your Interface. When you click it, a rollout appears. Usage:

- Disable Undo: Should be checked, especially when working with big meshes.
- Generate Messages: Produces some interesting statistical data in the MAXScript Listener.
- Ignore Warnings: If you check this option, you won't be asked to stop or continue when there are errors in the UVs and/or in the meshes
- Slice Geometry and Generate UVs: This option will manipulate the UV coordinates of all selected models, so they fit to the texture atlas that will be generated. Meshes with texture coordinates lower than 0 or bigger than 1 are not really suitable for producing a texture atlas, because texture atlasses don't support tiled textures. Thus, this option will slice those meshes and move the texture chunks in such way that the coords are all in the range 0...1.
- Break all Edges: Normally, TexAtlasGen tries to keep texture chunks together where possible, which is very slow, as it tests every edge's position. With this option, you can break all edges, which is faster, but will increase KB size of the mapchannel. This option has no impact on UV mapped models, like characters.
- Create: If you don't want to create an atlas, disable this option
- No padding: This checkbox is only available if you don't generate the UVs (see above). It will prevent TexAtlasGen to add any padding for the individual textures in the atlas and thus will be much faster. If you want to have a fast overview of the textures, use this option.
- Choose Path & Filename: Where you want to have your texture atlas saved.
- Padding: The amount of padding around any tiled texture. Won't have any effect on UV maps.
- Shrink in Atlas: When checked, any texture in the atlas with padding will be resized so the original texture size persists. For example, if you have a 64x64 texture and set padding to 2, the texture will be resized to 60x60, with a padding border of 2 on every side. If you deactivate this option, the size of this texture in the atlas would be 68x68.
- Generate Texture Atlas: Let the magic begin.

Version Requirement: 
tested with Max 9, Max 2009
Video URL: 
AttachmentSize
test_texture_atlas.jpg281.23 KB
step_by_step.gif523.78 KB
TexAtlasGen-v1.0.3.rar14.8 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bkalesti's picture

Inefficient packing?

Hi there! I am finding this script very useful in many ways, however, I continue notice huge spaces without any textures. Case in point: I recently generated an atlas that requires a 2048x2048 (because one of the textures is over 1024, so I totally understand that), however, there's a huge empty space that could easily be cropped out. I measured it in an image editor, and determined that a 2048x1024 sized chunk could have been eliminated. I have seen TAG create non-square atlases before, so I'm at a loss.

In general, it would be great if we could have more control over the size of the outputs. Say I want to create multiple atlases with a max size of 1024 (instead of some huge image that an engine can't handle). I'm dealing with literally hundreds of images, so doing this by hand is out of the question. Especially when game development requires lots of iteration and changes on a daily basis!

Thanks so much for any help you can provide! I included a downsized sample image to show what I mean.

Also, if it dynamically rotated textures to get a better pack, that would be sweet. I often see much wasted space when atlasing non-modular uv shapes.

AttachmentSize
extra_space_example.jpg 17.88 KB
sanyigz's picture

Not works of course

It not works of course. It sends couldn't be sliced messages while every maps are between 0,1 that 100%, also f up the uvw maps. Tried with multiple models, nowhere worked.

gatripoli's picture

where is the button ?

hi, I have studio max 2009 and I included the script as instructions but can not find any buttons.
Why?

I hope someone can give me a help thanks

paulov's picture

Hi. This script is what I

Hi.

This script is what I have been looking for for a while. It is fantastic, even if I'm getting some errors :P.

I've bought a low poly street traffic library. Each cars comes in a single mesh with a high number of textures that represent differentes parts of the vehicle. I need to pack them into unique textures per car and this scripts does most of the job, I want to use them in realtime aplications.

The material of each car is a MULTIMATERIAL and seems that the scrit does not like them. So I run first a "Detach by mat ID" script and then I'm able to merge them into unique texture. Now the detach by id script gives me error in some mesehs so I cant perform the atlas operation in all of the models, It wouuld be a hot feature to be able to work with a single mesh with a multimaterial aplied as it is quite common in realtime to attach differente meshes into one and have as a result an unique multimaterial mesh, and would be fantastic to have its material "baked" into a unique texure.

I also miss the hability to control the final output image size, would be nice to be able to set an output final size or be able to make it multiple of 256, filling the unused space with black color would be enough.

just this,

dejeka's picture

i think o got the same

i think o got the same problem with residenninja. yes, i also got an error message same like what residenNinja experienced.

dejeka's picture

What i meant is the 3d

What i meant is the 3d object model was design by some ppl using autocad and they convert it to .3ds with the texture attached. the problem is when i was about to texture them ,since the object was texture with so many improper texturing methods. almost all off them were tiled because the texture resolution are too small and there are so many texture image involve. so i just need one texture consist of all others in one template.

3d-io's picture

There is a READ_ME in the

There is a READ_ME in the .zip which describes the install process. What specifically is you problem? Also I am not sure what you mean with "i got so many to place the UV one by one to their textures". Could you elaborate?

dejeka's picture

can anyone tell me how to

can anyone tell me how to generate this script? n how to open the textgen menu option? im new to scripting stuff but i do need this to generate UV coordinates since i got so many to place the UV one by one to their textures...anyone can help? im using 3ds MAX 9

3d-io's picture

Konnichi wa, ResidentNinja!

Konnichi wa, ResidentNinja! The error you got is displayed when some - probably small - mistake was made in the modelling or unwrapping process. A not sliced face generally means, that some of the generated UV coords could be not in the range [0,1] - if it's severe, then all the coords are off.

I don't quite understand why you need unique UV coords - you have Flatiron for that! :)

ResidentNinja's picture

Great for real-time

Great for real-time conversions...

Our company is doing real-time simulations. We needed a 3D city in a short time frame and ended up purchasing a pre-fab off of TurboSquid. Unfortunately, the city was textured with tiled UVs and UVs that extended outside of the normal 0,1 range. Our current pipeline has involved your other (fantastic) commercial plug-in Flat Iron, both for the Unwrella component as well as for baking in lighting. But, we still have to take the unwrapped UVs into Photoshop and manually create the texture atlas using the source textures. This plug-in would have the potential to save tons of tedious man-hours.

I did a test of this plug in and it is very close to what we'd need to fully automate our pipeline on our current project. I do receive an error: "A specific face couldn't be sliced, which will result in a incorrect UV map. Check your UVs and Geometry please. Continue anyway?" Which, I'm not sure what specifically it is having a problem with. However, it appears to produce a workable result if I "continue anyway."

I'm using it under 3ds Max2010, if that matters. ; )

My one main request would be for an option to make the UV coordinates unique. Right now the plug-in will stack UVs to reuse texture space, which could be useful in some circumstances, but in our case, we still need to bake lighting in. Ideally, such an option would take a textured box that had six identical faces and allow either the creation of a texture with stacked UVs and the one face texture filling the full space, or a texture with six UVs exploded out and each using it's own unique pixel space in the texture.

I have no idea if it would be possible, but if it could also do the same process using procedural textures, it might greatly expand on the plug-ins flexibility and marketability.

Anyways, a fantastic plug-in. Hope to see a commercial version someday. =D

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.