PDA

View Full Version : unwrap multiple objects


dejawolf
02-18-2005, 06:05 AM
hmm.. well, i've been attempting this for a long long time, but it's still not present.
so would i have to redo the whole uvw unwrap modifier, or is there a way to modify it to be able to unwrap multiple objects?

prettyPixel
02-19-2005, 03:44 PM
hmm.. well, i've been attempting this for a long long time, but it's still not present.
so would i have to redo the whole uvw unwrap modifier, or is there a way to modify it to be able to unwrap multiple objects?

Why is it so important to work on several objects at the same time?
If you want to see all your uv at the same time, you can attach them together in one object before (using multimaterial and Ids)
What is the advantage to unwrap a big number of objects in one step?

dejawolf
02-21-2005, 10:33 AM
you preserve your pivots and names. when doing mechanical objects for games, this is a big time saver, especially when doing multiple cylindrical objects, or re-using old parts that should have their pivots, but receive new texture coordinates.
also, when doing mechanical objects, you usually start from multiple meshes, then merge them into some fever final meshes.

i'm trying to squeeze a lot of objects UVWs into 1 texture map.
when i have around 15-16 wheels that has the same UVW coordinates, and find out there is a way that i could utilize the wheels texture space better, i'll have to collapse those 15 wheels.
then move them and scale them to this better place.
then detach each wheel, one by one. rename them. and give them new pivots.
or say i have 15 switches (i have)
each that needs their separate pivot. i take them from a previous model, and need to put them on a new texture map, because the surface of them is different in this new model.
some of them are at an angle, and they should all pivot around the X axis.
what do i do? collapse them all, move the UVWs, convert to editable mesh, and detach each object, one at a time, and rename them, as well as giving them new pivots.
it's a long-flung, boring, and mostly unneccesary job.

prettyPixel
02-21-2005, 03:49 PM
I completely agree, the UVWs are the pain of the modelers existence :-) ... at least in the video game because of the technical constraints.

Perhaps there is a simple solution of your problem :
Do you divide your bitmap with a regular grid? For example: if you have 15 objects, do you use a grid of 4 on 4?

prettyPixel
02-21-2005, 04:58 PM
sorry I have forgotten a question: are your UVs all between 0 and 1?

dejawolf
02-22-2005, 10:42 AM
grid? i don't use any grid. i have created my own special texture, that shows the pixels in a bitmap, and arrows, to help me rotate the UV's.
another thing that has annoyed me endlessly is the normalize clusters checkbox, in the unfold dialog. it could have been extremely useful, but since the UVs become gargantuan, it's useless.
as for UV's between 0 and 1.. uhm, dunno. probably, never did any adjustment that sounds like it. i use 1 bitmap for my models. thats about it.

well, sooner or later i'm going to tire completely of max's unwieldy way of handling UV's, and simply build an UV tool into the editable mesh modifier. well, that's my ultimate goal.

prettyPixel
02-23-2005, 07:46 PM
I have written a short maxscript that allow to edit UV's of several objects at the same time.

It's pretty simple:

1- Select the objects you want unwrap and click on "unwrap UV's" : edit them
2- When is done click "set UV's" (don't forget!)

download:
http://users.skynet.be/arketip/maxscript/multiObjectsUnwrap.ms

dejawolf
02-24-2005, 06:22 AM
hey thanks a lot :) this is gonna be very useful!

prettyPixel
02-24-2005, 08:27 AM
hey thanks a lot :) this is gonna be very useful!

Inform me if you find errors...
I would put it on scriptspot later ;)

dejawolf
02-24-2005, 08:32 AM
i noticed that when i tried unwrapping 2 regular boxes, it didn't want to unwrap.
also, the script is quite slow to calculate multiple objects. i'll try and turn off undo while separating the objects to see if it speeds up the script.

well, clumsy me made max crash every time i tried modifying the script.

prettyPixel
02-24-2005, 09:11 AM
It's true, the script works only with this kind of objects:

Editable_Poly
Editable_Mesh

If you want use a primitive place a Edit_Poly (or Edit_Mesh ) on the stack first, and that's will work :thumbsup:

As for the speed... If you just move, rotate, scale your UV's you can use the weld type: don't break mapVertices. It's faster.

dejawolf
02-24-2005, 09:42 AM
ok, yes that's a bit faster. but it still takes more than 20 seconds to calculate 7 objects, with a polycount of 120 each.
but well, shouldn't complain, it's 4 times faster than doing it manually.

another small nuisance is that the old objects are visible through the collapsed UV objects.

prettyPixel
02-24-2005, 11:47 AM
Here is the new version that allow to edit the primitive objects also.

max 6: http://users.skynet.be/arketip/maxscript/multiObjectsUnwrap_max6.ms
max 7: http://users.skynet.be/arketip/maxscript/multiObjectsUnwrap.ms

As for the speed, if somebody have an idea....

here is my speed test:
120t : 10 boxes of 6 faces (12t) + don't weld: 0.3 sec
120t : 10 boxes of 6 faces (12t) + weld: 5.2 sec
5.000t : 10 boxes of 250 faces (500t) + don't weld: 3.6 sec
5.000t : 10 boxes of 250 faces (500t) + weld: 8.2 sec
20.000t : 10 boxes of 1000 faces (2000t) + don't weld: 21 sec
20.000t : 10 boxes of 1000 faces (2000t) + weld: 31 sec
50.000t : 100 boxes of 250 faces (500t) + don't weld : 99 sec


I don't understand when you say "the old objects are visible"... what kind of old objects ?



last update: well I understand now :) and It's also modified.
I also added a progress bar.

max6: http://users.skynet.be/arketip/maxscript/multiObjectsUnwrap_max6.ms
max7: http://users.skynet.be/arketip/maxscript/multiObjectsUnwrap.ms

dejawolf
02-26-2005, 09:51 AM
thanks :) gonna test it now

prettyPixel
03-05-2005, 12:22 AM
It's done! the script is on scriptspot now.
If you already use this script I recommend you to download the last version...

Now, the script is the same for max 7 and 6 ...Is there anybody who can test it with the version 5 ?
thanks in advance

dejawolf
03-07-2005, 02:07 PM
actually, it seems your script is not able to cope with mirroring.
mirrored objects are getting strange mapping malfunctions, and probably causes crashes.

prettyPixel
03-07-2005, 08:46 PM
actually, it seems your script is not able to cope with mirroring.
mirrored objects are getting strange mapping malfunctions, and probably causes crashes.

I think this problem comes from any object which is an "instance" or a "reference".
The miror in itself isn't the problem.
But by definition an instance object is always the similar to the original... and it's not possible to give him different mapping coordinates in fact... In this case the script give it false mapping coordinates (but no crashes to my opinion).

There is 2 way to avoid this problem:
1- to make the instances nodes unique (before to apply the multi-unwrap) if you really want several mapping coordinates for similar instanced nodes.
2- to select only the original object and not the instanced nodes if you would like to have only 1 mapping coordinates for your instanced object.

I think about a technical solution, but an another problem is to know what the user want to make...

dejawolf
03-09-2005, 02:10 PM
hmm, well in my case, the objects weren't instanced, just mirrored.
i had mirrored multiple objects along a single axis.

prettyPixel
03-09-2005, 08:07 PM
hmm, well in my case, the objects weren't instanced, just mirrored.
i had mirrored multiple objects along a single axis.

It is exact! I have just make a test with a mirroired object using "copy mode" and the UVs are false :bounce:

I resolved manually this problem using "ResetXForm" before unwrap the objects.
But after the "ResetXForm", the faces on mirrored objects are fliped! :argh: and I add a normal modifier to correct this strange problem !

How detect if an object is a mirrored object ? Always apply an Xform is an huggly solution...

prettyPixel
03-10-2005, 11:20 PM
Ok now the script can support mirroired objects :beer:
http://users.skynet.be/arketip/maxscript/multiObjectsUnwrap.mcr

Well First, thanks to ' hunter ' to give me the code to know if an object is mirroired:

if ((obj.scale.x < 0) OR (obj.scale.y < 0) OR (obj.scale.z < 0)) do ...

Unfortunally I don't have find a good method for the modifier UVW_Xform.
The problem with the uvw_xform is I must detect if the object is mirrored axis by axis
1- detect if the axis X is mirrored ?
2- detect if the axis Y is mirrored ?
3- detect if the axis Z is mirrored ?
With that I could apply an UVW_Xform but...

and for example when I mirror an object only on the axis X :
(selection[i].scale.x < 0) is true (logic)
(selection[i].scale.y < 0) is true, NOT logic :surprised
(selection[i].scale.z < 0) is true, NOT logic :surprised
It's very strange. Isn't ?

Anybody understands anything there?

prettyPixel
03-14-2005, 07:21 PM
little update.

I have added a function "copy channel" in the interface: for a new channel use the channel n
And I have removed an error when you edit an another channel than the 1...

http://users.skynet.be/arketip/multiObjectsUnwrap.gif

prettyPixel
03-17-2005, 03:42 PM
Again some errors removed in the last version when you don't use basic Editable_Mesh/Editable_Poly objects on other channel than the channel 1. I REALLY recommend you to download the last version because old versions causes crashes of 3DSmax in several cases...

last version : 1.26b
(if you download with scriptspot, the version number is not yet updated (probably you view "1.24" today) but the link is right the "1.26" now)

prettyPixel
03-17-2005, 07:34 PM
Perfect! ScriptSpot is already updated without I ask for It. It's magic :thumbsup:

Be magic you too.

dejawolf
03-19-2005, 03:03 PM
thanks, i'll try this one.
in max 6, i had some odd crashes with the previous versions, so i was a bit afraid of using it.
if this version is stable, i owe you a big thank you :)
in max 7, it seemed to run perfectly.
haven't got ghostpainter for max 7 yet. but i'm planning on buying max 7 in a few days,
and then i'll buy ghostpainter for max 7 too (have legal version for illegal max 6 version), finally going legal :)

dejawolf
03-19-2005, 03:22 PM
it still causes crashes in max 6, when i try to unwrap an object twice. (unwrap, set UV's unwrap)
i'm using a pre-service pack max 6 version, couldn't get the service pack to install.
oh well.

i'll just wait on using this till i buy max 7.

prettyPixel
03-19-2005, 10:48 PM
I'm trying to debug this but it's a bit complex.
But I'm sure that the crashes are not linked to the version of 3DSMax...

That occurs because I use the interface channelInfo to copy channels.
There are not enough acces to channels. Nothing to test if a channel exist already or not for instance. And each object type has a slightly different reaction.
Because of that to write a stable function is a terrible spot.

In fact I'm surprised that you have crashes after 2 unwrap.
I don't understand why but my 3dsmax seems more stable than yours.
I have tried myself to crash max and finaly i have found one way to crash my script in 5-7 multi-unwrap.
So If you have a short method to produce the crash, please give me more details on this. I like bugs :o)
What are your actions ? the channels you use, the type of objects you unwrap....

prettyPixel
03-21-2005, 09:49 AM
I just rewrote a part of the script where there were problems.
I abandoned the use of the function channelInfo and the problems of crash seem to have disappeared... But the use of the "Map Channel Info" is disadvised with this script :o)

If you encounter bugs or problems that I am not aware of, please send me yours comments.
Any suggestions are welcome.

walee
03-21-2005, 09:58 AM
Hey pretty pixel, thx for this handy tools. It's going to be a pretty good time saver :)

prettyPixel
03-31-2005, 10:34 AM
A new mode for welding mapVertices is added: 'break + clusters weld'.
That avoid to weld mapVertices beetween various clusters.
That become the default mode.

Find It on scriptspot (http://www.scriptspot.com/start.htm).

Neox
03-31-2005, 04:35 PM
But after the "ResetXForm", the faces on mirrored objects are fliped! :argh: and I add a normal modifier to correct this strange problem !

that is strange to you? after years workin with max in the game industry, it is totally normal to flip the normals after resetting a mirrored object :P

Larpo
06-09-2005, 10:29 PM
Pretty Pixel, you asked to have your script tested in Max 5, and it doesn't appear to have any effect. I cannot edit the uvs when multiple objects are selected. This is a bummer for me, because our game engine is using Max 5 because we are too deep in development of our tools to upgrade. But, I'd love this functionality!! Instead I'm exporting to Maya and doing my UV placement in there because it does support multi obj uv editting.

prettyPixel
06-13-2005, 09:35 AM
Pretty Pixel, you asked to have your script tested in Max 5, and it doesn't appear to have any effect. I cannot edit the uvs when multiple objects are selected. This is a bummer for me, because our game engine is using Max 5 because we are too deep in development of our tools to upgrade. But, I'd love this functionality!! Instead I'm exporting to Maya and doing my UV placement in there because it does support multi obj uv editting.

Hi Larpo

Unfortunately, I don't have 3DSmax5 to make the tests. But if you agree, I can send procedures of test to you to determine where are the specific instructions for 3DSmax6&7.
Thus I could make a compatible version 3DSmax5.
If you are interested, contact me on my email: gray@skynet.be

thanks :thumbsup:

robinb
06-15-2005, 04:06 PM
I've only recently found this script, but so far it's proving to be massively useful. Thanks a lot.

I'm running it under max 5.1 and it seems to be working fine. I'm not trying to do anything clever, just select multiple objects, press the unwrap uvs button. Unwrap them, texport them, Set uvs. All done. Works a treat. Should be great when I come to do some lightmapping.

prettyPixel
06-16-2005, 07:10 PM
Thank you for your answer robinb.
I like when somebody says to me that the script works. :drool:
And Larpo did not write to me...

Yes : Typically this script can be used to make lightmaps but also to make the textures for characters or vehicles (with all the parts in one bitmap)
In fact, I have another script specialized in lightmaps. Its originality is that it calculates the spacing between clusters in PIXELS.
It's useful when I use 'Render to Texture' with the option 'Edge Padding' .. because the unit of 'edge padding' is the pixel.
I don't use the terrible 'Automatic Unwrap' ... I do not understand how people dare to use this option.
I obtain a better optimization of the space with my script ( pixelPack ).
I have not yet posted this script because I have not enough time for the moment but soon it will be there.

Maybe other users of 3DSmax 5 could say to me if the script works with max 5.xx ???

CGTalk Moderation
06-16-2005, 07:10 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.