UV Transfer Script

MentalFish

LScript minion
I have started on a UV transfer script that hopefully will be able to transfer the UVs from one model to another. At the moment the script only figures out what face on one model equals one on the other. Next step is to create a vertexlist comparison to ensure the right UV coordinates is being transferred.

Just run it and click the stage and watch the message window for an output on what face is located where on the other model.
 

pixelinfected

Mad Doctor
great!!!!
sometimes i have some problems with zwave, that it copy uvmap in wrong way, but uv is correct in the original obj.
you do a great thing. thanks a lot
 

MentalFish

LScript minion
Sorry to cause such confusion, this is a ShockWave specific script as the ShockWave exporter does not export multiple UV's pr model and the vertex order gets scrambled on export too. When working with the model inside of Macromedia Director, its not possible to take the UV list from one model and copy it onto another one, even if they are the exact same geometry (vertex numbers are scrambled). That is why I have made a script that compares each face so in the next turn it will be possible to re-arrange the vertecies so one model can hold the 2 UV coords from the two models (one from the color/texture model, and one from the lightmap model).

I thought there was a UV transfer script available for LW, if it isnt, ill make one :)
 

Dodgy

Worms no more! Free fun!
There's a bunch of vmap transfer plugins.... But I can't find them right at this moment. They're called drainBGVmap.zip or something, but they're well worth having..
 

MentalFish

LScript minion
btw, does a modified version of a model in ZBrush/ZMapper alter the vertex or face order when exported back to OBJ ? If not then it would be very easy to copy the original UV's back onto the ZBrushed OBJ...

I googled on various drainBGVmap alternatives, with and without spacing between each word, and couldnt find anything. Do you know who made them?
 

MentalFish

LScript minion
After 1.5 liter of coke and a beginning headache i nailed it :D

The script can now transfer the UV between two models inside the same, or different, W3D files. This means you can feed the function named mergeUVs with 2 models and a tolerance value, and it will spit out which model has the most vertecies and its second UV layer. Once you have that, its a few lines of code to apply the second UV and texture to the model, but its always applied to the model with the most defined vertecies. A model with the same amount of points in LW may have different vert count inside of ShockWave due to difference in UV, some vertecies are shared and some are split up, i guess i should explain better, but i'll do that later.

When using this type of script in a project, it is best to run the script once before publishing the final project, and just store the uv-list directly as an array in pure Lingo, then there is no need for parsing anything when game/project is launched.

See screenshot of it in work, or just download the thing and run it in Director.
 

mdoyle

New member
THanks petter for the script, been out of the office the last 2 days but will get a good look at it when I get back, am quiite looking forward to it

:D
 
Top Bottom