Jump to content
Hash, Inc. - Animation:Master

Use Roadkill UV tool with AM


Malo

Recommended Posts

Hi,

 

Some time ago, I tried to find a way to use Roadkill ( http://www.pullin-shapes.co.uk/page8.htm ), a free standalone program, to autounwrap mdl model.

And there is a way! :) ... I tried to do it, with help of PHP scripts... But as I am not a programmer, the script is heavy, slow, it has "Undefined offset", problems with big models,and it is not a plugin in AM.

But don't be worry, the principle works better than my scripts :)

to download the scripts:

 

the order to use the scripts:

step 1: translate the mdl model in a obj model ( by the "MDL 2 OBJ for roadkill" script. )

01.jpg

step 2: import the obj in Roadkiller, and unwrap it. Then export it.

02.jpg

step3: create the UV informations for the mdl object from the exported obj.( by "Roadkill to UV information" script: )

step 4: In AM, apply a decal to your model, no matter the way, and save it.

step 5: use notepad++ (for example) to open the UVmdl generated format and the MDL model.

In the model, find the code between and where the informations about the UV are, and replace them with the UVmdl format information.

Save it

step 6 : Open your model in AM:

03.jpg

 

 

It is not perfect!!!

The Obj exporter script has some trouble with hooks coordinates.

fazi-dorn.gif

The script for the UV coordinates don't translate always the good CP number for the patches.

fazirenket.jpg

And of course, Step 3, 4 and 5 could be done in one step...

 

It is important to know that it is not a perfect unwrapping for hashpatches, because the unwrapper is made for polygones.

To understand a little better what the problem is, let's imagine it is as if we had to give 4 side polygones UV to a 12 side polygones.

So perharps it is not the better way for AM... but if it could help some people...

 

If someone knows how to programm, and wants to ameliorate the scripts, or better, how to do plugins in AM... I will try to explain better how to process for the scripts:

 

For the obj exporter:

I noticed that:

- Roadkill needs CP coordinates ("v" for Obj format) and CP numbers that make patches ("f" for obj format). Extra information is useless.

- Then, to use the UV information in AM, it is important to keep the same number/name for the CP.

- In Obj format, the CP have not number, but its number is the line number. So when a CP doesn't exist in AM, we must create a line in Obj for this CP.

-To keep the faces joined when creating Faces "f", we must use only the number of the CP that has directly X,Y and Z coordinates.

 

So the script is made this way:

1- import the line splines from the MDl.

2- create an array with these lines.

3- order them from the smaller to the bigger CP number.

4-create the first "v" line and find the CP 1, if it doesn't exist, create the v line "v 1 1 1", and do the same with the second v lines... etc. If the CP exists, write its coordinates... etc. (there I have somes problems with CP hooks, because of the complexity of their relation... perhaps in the SDK, it is easier to find all the CP coordinates, without having to calculate their coordinates? )

 

5- import the patches lines from the mdl.

6- create an array

7- change the number of the CP faces with the CP number that has the direct coordinates in the MDL format. (if you don't do that, all the faces will be independant) (I have some problem to find them all... so don't panic, it is the script the problem)

8- add the result in the obj format.

 

 

The script for the model created with Roadkill is made in this way:

1. import the vt lines without the "vt"

2. create an array with them.

 

3. import the f lines. without the "f"

4.create an array with them.

5. the numbers are grouped by three. the last ones will not be used. The first is the number of the CP for the patches and the second the number of the lines of vt linked with the CP

6. If the line isare made of 9 numbers, it is a triangle, 12 a square, 15 a 5 side patch

so for a 9 number line : a1/b1/c1 a2/b2/c2 a3/b3/c3

the line has to be written:

a. "O a1 a2 a3 a1 b1 (b1+(b2-b1)*1/3) (b1+(b2-b1)*2/3) b2 (b2+(b3-b2)*1/3) (b2+(b3-b2)*2/3) b3 (b3+(b1-b3)*1/3) (b3+(b1-b3)*2/3)

so for a 12 number line : a1/b1/c1 a2/b2/c2 a3/b3/c3 a4/b4/c4

the line has to be written

a. "O a1 a2 a3 a4 b1 (b1+(b2-b1)*1/3) (b1+(b2-b1)*2/3) b2 (b2+(b3-b2)*1/3) (b2+(b3-b2)*2/3) b3 (b3+(b4-b3)*1/3) (b3+(b4-b3)*2/3) b4 (b4+(b1-b4)*1/3) (b4+(b1-b4)*2/3)

so for a 15 number line : a1/b1/c1 a2/b2/c2 a3/b3/c3 a4/b4/c4 a5/b5/c5

the line has to be written

a. "5 a1 a2 a3 a4 b1 (b1+(b2-b1)*1/3) (b1+(b2-b1)*2/3) b2 (b2+(b3-b2)*1/3) (b2+(b3-b2)*2/3) b3 (b3+(b4-b3)*1/3) (b3+(b4-b3)*2/3) b4 (b4+(b5-b4)*1/3) (b4+(b5-b4)*2/3) b5 (b5+(b1-b5)*1/3) (b5+(b1-b5)*2/3)

 

7. these created lines will have to be imported in the MDL stamps. (not in the PHP script)

 

If it is not clear (sorry for my English), and if you want to have more information, just ask me and I will try to explain better, or perharps some people could explain better than me.

Link to comment
Share on other sites

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

That is really cool, seeing that you got the obj translation down somewhat how about using the lscm code in it's place. You will need to define pins that keep the axis and distance fixed then define edges that are like zippers and do the whole model in one shot :)

 

I started trying to learn C++ and attempt making some plugs but my time gets eaten up it's just too tough to commit too.

LSCM.txt

Link to comment
Share on other sites

Ever consider making an am plugin for Ultimate Unwrap 3d? UU3d has pretty much all the uv mapping techniques available as well as edge matching, stitching and uv island management.

 

BTW I believe the reason you have trouble with hooks is because in AM they allow an edge to end on a spline without a cp. This may not be exportable to something that converts cp's to vertecies.

Link to comment
Share on other sites

  • Hash Fellow

BTW, I'll just note I have a scheme for mapping without unwrapping

 

http://www.hash.com/forums/index.php?s=&am...st&p=317436

 

 

Basically you let A:M's cylindrical mapping capability do the UV unwrapping for you. I know it won't satisfy everyone, but I'm going to try it on my Punch model.

 

 

Sorry, no vid on it. ;)

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Thank Robcat for your scheme for mapping, I do not know, that it was possible to unwrap cylindrical in AM.

 

Thank, Pixelplucker for the LSCM.txt (sorry can not read yet C + +). I have download the Unwrap 3D demo, it works to import models, but for exported, I can’t know with demo version.

Normally if Unwrap3D don’t rename v’s name in Obj format, that must be good as for Roadkill.

 

I’ve gone deeper on the script.

 

koriganUV.jpg

 

 

I writting the first script again, because it was poorly thought and did not work with certain models.

Now, It is better. It export 3, 4, 5 and hooks.

But not all hooks. The hook must be attached in the midle of the segment.

But it is possible to circumvent the problem manually :

Use the script, and open your model in Roadkill. See what are the «bad» hooks.

Open your model on AM, and take the XYZ of them.

Open the obj model with notepad, and search the lines that are the number of your CPhook, and write the good XYZ.

Faces with this hooks could be affected too... see the follow picture for example:

 

problem-hook.jpg

 

 

example:

 

fas-renket.jpg

 

Note: Models without hook is easier to unwrapp.

 

 

The second script works, but is poorly written, therefore there are «Notice: Undefined offset...».

Sorry if it is not optimized, I am not a programmer, and I take this opportunity to express my admiration for programmers.

 

Follow a girafle model, with his UV (use the map you want). To see the result.

 

Bloavezh mat d’an holl! Happy new year Everybody!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...