Texture Atlas Generator

51 votes
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.
Woody3D's picture

Still a no go!

Every year in my career as I attempt to expand my horizons, I inevitably end up back here attempting one more time to get this script to work. I switch to Editable Poly, I dutifully decimate and destroy all my materials trying to make them as simple as possible,.. (just a standard Multi-Mat with a list of Blinn and Phong Mats, ( A couple have OPAC and/Or Bump channels,.. That's pretty standard though,.) After many frustrating years I have decided to find out for sure! I guess if it doesn't deal with a bump map or opac map it wouldn't really be useful for me,.. I'm trying very hard not to sound like jerk but I am SO Frustrated with this. Tried SO Many Times,.. But I do appreciate the effort, It obviously works for some lucky people..

I will tell you what I have, a Single Character, attached clothes accessories, etc,..
Materials I explained above, simple as far as I know,.. Perhaps No Bump or opac is allowed? I can"t decimate my materials that much, there becomes a point where working with such simplified scenes makes the whole practice pointless,....

So my scene looks like this:
(crap... My POSTIMAGE.org Image was rejected as SPAM, So I cant show ANYTHING... NOTHING IN THIS WORLD EVER WORKS)

I run the script,
I get this error first:
(I originally posted an Image but got some spam filter) I don't have the energy to go through the 2 hour fail process again... It comes up with that awful 'Unwrap Modifier' screen and says theres some problem and I either click no and 'fix it' (impossible) or click and there might be problems or something etc etc,... I click yes... (I have no choice, I have worked in 3D Studio since Release 1 for DOS but have NEVER figured out that crazy 'unwrap' modifier, In 3D Studio DOS through Max 3, we had a routine where you select a object, click unwrap and it would create a texture map of the object showing its edges so you could put a texture anywhere one wanted, It was even called : UNWRAP... Then it was replaced with this awful, confusing bizarre 'Unwrap Modifier'/ It's Terrible...

Anyways, Next error I get is:

Another missing Image,. WHY WOULD AN IMAGE LINK FROM POSTIMAGE.ORG BE SPAM!!!???
This error says,... Something about,... "Are you sure your materials are Simple enough? This Work work only for you."

and in all these years I have never ever seen any sort of collage map or "atlas" be generated outof this script. I tried it on a Box Mapped CUBE once and it didn't generate anything..

I would love to see it output SOMETHING just once! I hope that gives enough info to help..

ALL the works to post screen caps, and it was blocked as SPAM! (whatever that is)
EVERYTHING IS SO FRUSTRATING!~

Thanks for trying at any rate, and making it free!

skullthug's picture

Finicky, but life saving

Huge thanks to 3D-io for making this and making it free.

With that said allow me to save you some smashing your head against the wall time with some things I found out the hard way.

- Geometry you're atlasing needs to be converted to an Editable Poly otherwise it will generate an error. Collapse your modifiers as well for best results.

- ALL GEOMETRY that is being atlased MUST be assigned a material with a bitmap in the diffuse slot, otherwise it will throw the vague error saying there's a problem with the material.

- Unlike what the GIF suggests, it apparently will not auto-assign the new texture to the geometry when finished. You have to make a new material, assign it the new texture and apply it to the geometry being atlased.

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

Comment viewing options

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