Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Field Researcher
Original Poster
#51 Old 18th Feb 2010 at 6:14 PM
I found what's "wrong" with the curtain UV. This particular script has 2 UV records for each section. Could you by any chance attach the .obj file you used for the import of the curtains?
Advertisement
Pettifogging Legalist!
retired moderator
#52 Old 19th Feb 2010 at 3:44 AM Last edited by plasticbox : 19th Feb 2010 at 5:04 AM.
Curtain .obj attached below! This is "as is" – exported from Milkshape, never opened in blender.

Also: could the reason for having two UV records be that the object is mirrored? Or rather, the map is mirrored … it's using the same texure and materials for left and right half? If that's the case then it would be quite easy to look for similar "problem objects" in game (when they look mirrored, then they most probably are mirrored).

This may or may not be related (I'm just extrapolating from what I know about how objects need to be mapped in order to work in game) – I noticed that you are currently not importing any information on smooth or solid rendering, or sharp edges. Could this result in duplicate vertices (that the game needs, so they're there for a reason) getting lost somehow? When importing a Milkshape-generated .obj, I often see that there are sharp edges in EA objects (or perhaps just: something that blender interprets as sharp edges – like duplicate vertices? I don't know the details of this), but when I imported with your script I didn't see any, and everything was rendered solid.

The way these UV maps look reminds me of the problem I had in this thread http://www.modthesims.info/showthread.php?t=389492 (which wasn't really a "problem", more that I didn't know what the game needs to be happy) so that's why I'm thinking this could be the same issue in reverse. I might be just jumping to conclusions, of course.
Attached files:
File Type: zip  curtainVic-0000.obj.zip (16.9 KB, 17 downloads) - View custom content

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#53 Old 19th Feb 2010 at 8:21 AM
Looks like a tad more complicated. Thank you for the .obj file. I've done some comparisons and it looks similar in most parts, except for the faces, but that's because the Milkshape .obj exporter addes extra data which are not available in the .s3ascg files. It also looks as if the exporter removes UV duplicates as it has about 300 less coordinates than the .s3ascg file. And writing this just told me the differences in the face data, so I'm happy with the differences

I don't know the relevance of the second UV, because on second look they are all the same:

vbuf 862
0 0 0.446713 2.422633 -0.365135
0 1 0.531250 0.015625 0.828125
0 2 0.486667 0.015996
0 2 0.057909 0.944377
0 3 0 0 0 0
0 4 1.000000 0.000000 0.000000
0 5 0.498039 -0.003922 -0.003922
1 0 0.385186 2.422633 -0.334188
1 1 0.039063 0.007813 0.984375
1 2 0.563318 0.015996
1 2 0.057909 0.944377
1 3 0 0 0 0
1 4 1.000000 0.000000 0.000000
1 5 0.498039 -0.003922 -0.003922
2 0 0.444882 2.187603 -0.365135
2 1 0.609375 0.015625 0.773438
2 2 0.486667 0.128718
2 2 0.057909 0.944377


And all the way through to section 861. I think I might ignore them for the moment to see how it changes the object and until I know the relevance.

Yes, I'm only processing vertices, faces and UV, although I have been accumulating the others (i.e. normals and armature). I haven't added smoothing, but it will be in the next version to see if it makes an obvious difference.
Field Researcher
Original Poster
#54 Old 20th Feb 2010 at 5:46 PM
I've been able to fix the UV as far as the weirdness as shown in the curtains and the car. The attached images shown both the import from the .s3ascg and the .obj. I specifically used these files as is from the attachments Plasticbox added.

As you can see I still have the UV flipped though, so that is the next thing to work with. I will however add the changes as 0.1.3.
Screenshots
Pettifogging Legalist!
retired moderator
#55 Old 20th Feb 2010 at 5:56 PM
Awesome. Were you able to figure out what that second UV record is used for, or are your screenshots from a version where you just ignored it?

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#56 Old 20th Feb 2010 at 6:24 PM
I moved the second record to a holding list for now. Since those UV records (which are the same in each section all the way down) doesn't even exist in the .obj I have ignored it until I know what it's for. In the case of the curtain, I think it's just a random line that got in by accident by EA, but in other cases this might be a relevant record as you can have UV's assigned to both verts and faces.

That said, I would need the information when I start on the export script.
Field Researcher
Original Poster
#57 Old 22nd Feb 2010 at 5:28 PM
I just found that the .obj UV figures for the V section is not the same as that of the .s3ascg. It looks like .obj V = 1 - .s3ascg V

I'll update the script and see what difference that makes.

UPDATE:
Yes, that flipped the UV round nicely. Version 0.1.4 will be loaded then we can move to the next step. Any suggestions? Blender can automatically calculate the normals. Infact the .obj import script ignores the normals totally.
Pettifogging Legalist!
retired moderator
#58 Old 22nd Feb 2010 at 6:21 PM
Suggestions for the "next step", you mean?

I've only just downloaded v0.1.4 – is that the one that also has smoothing now? That might be kind of important when editing existing objects.

Also, do we need joint assignments? I've never done those in blender I believe .. I don't remember how this worked in TS2, and right now I'm exporting via Milkshape and assign them there, so I'm not really sure whether we'd have to do that in blender or not.


I've been using 0.1.2 a lot on the weekend – I made kitchen counters which have about 30 meshes all together, so it was great to be able to import those directly. Thank you! =)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#59 Old 22nd Feb 2010 at 6:50 PM
Don't have smoothing on yet, I'll load an extra 0.1.5 with smoothing so you can see whether it does anything helpful. On Milkshape from the tutorials it says to untick the smoothing box, but I don't know if it will have the same result.

I think I have to look at the armature (bones) as well, although most have only rudimentary assignments which I think gets allocated automatically in Wes' S3ObjTool when you compile it, if it's missing.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#60 Old 22nd Feb 2010 at 7:20 PM
Tested 1.4, works great

As for bone assignments, we'll need them, unless you still want to open up MS to see where things go, i.e. for animated objects. And you would need to be able to export new assignments as well.

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Pettifogging Legalist!
retired moderator
#61 Old 22nd Feb 2010 at 7:57 PM
Quote: Originally posted by Ceixari
I'll load an extra 0.1.5 with smoothing so you can see whether it does anything helpful. On Milkshape from the tutorials it says to untick the smoothing box, but I don't know if it will have the same result.
I believe you're thinking of the auto smoothing option in Milkshape? I don't know what exactly the problem is with that, I just leave it off, but in general smoothing (what one defines in blender) works fine in game.

Quote: Originally posted by Ceixari
I think I have to look at the armature (bones) as well, although most have only rudimentary assignments which I think gets allocated automatically in Wes' S3ObjTool when you compile it, if it's missing.

The static objects I've seen so far (e.g. tables, lights) only had one joint; for me it didn't seem to make a difference whether I assigned stuff to that or not (maybe because the objtool does it for me?). But when there's more than one, objects will go haywire in game when they don't have proper assignments.

cmo, do new assignments work in game at all? I thought I had read that one can't change them? Or am I now confusing bones with joints with slots? (My total experience with joints is one, so far, so that's kind of likely =)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#62 Old 22nd Feb 2010 at 8:48 PM
The clock, for example, has three bones: the main one, one for the minute hand, and one for the hour hand. These all had to be reassigned to my mesh's different parts in order to work. I did this by exporting my mesh from Blender in three groups, according to what bones they were assigned. Then in MS I assigned them to their respective bones, and regrouped them into one group. One time by accident while testing I assigned the clock body to the minute hand bone, and the whole clock spun

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Field Researcher
Original Poster
#63 Old 22nd Feb 2010 at 9:14 PM
Weird, if I add the smoothing to the faces (not smoothing across the object) the whole object turns black where before it was grey. I'll need to see what's happening here.

I've loaded 0.1.5 extra, but just to show what it does rather than ready to work with. That said, it is on my old laptop and might just be fiddly.
Pettifogging Legalist!
retired moderator
#64 Old 22nd Feb 2010 at 9:40 PM Last edited by plasticbox : 22nd Feb 2010 at 9:56 PM.
cmo: ah ok, I misunderstood – I thought you meant "new" as in, additional ones (vs. swapping them around).


Quote: Originally posted by Ceixari
Weird, if I add the smoothing to the faces (not smoothing across the object) the whole object turns black where before it was grey. I'll need to see what's happening here.


I just quickly tested with 0.1.5 and the victorian curtain – the initial view is a tad weird (it's not completely black for me – everything is one flat shade that kinda changes with the viewpoint; the initial view was black), but after tabbing in and out of Edit Mode, it displays nicely! It also seems to be making sense, see the detail screenshot (sharp/smooth edges where I'd expect them to be).

I didn't do anything but tab and re-select "OpenGL" and tab back .. maybe blender just needs to update the view? When it has no normals upon import, I'd imagine it perhaps needs to calculate them first in order to show anything (sensible)?


e: EA quaint chair is working fine as well – initially it displays odd, but reselecting the drawing mode in Edit is all that it takes to fix it. The smoothing makes perfect sense to me too.

e2: works even without reselecting the drawing mode – just tab and tab back.

I can also confirm that the UV maps of these two objects are now working fine – unjumbled and the right way up.
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#65 Old 23rd Feb 2010 at 6:50 AM Last edited by Ceixari : 23rd Feb 2010 at 1:27 PM.
Thanks Plasticbox. I'll force extra updates and try to add the normals recalculation in the script as well.

Update:
Extra updates / screen refreshes did nothing. The problem turned out to be with the normals not having been calculated. The last script (uploaded as 0.1.6) now calculates the normals and the blackness is gone again. :D
Pettifogging Legalist!
retired moderator
#66 Old 23rd Feb 2010 at 6:20 PM
Cool, thank you.

(When you do updates, as in post new versions, I believe it's just fine to double post, so it gets bumped for people who have the thread subscribed. Otherwise we don't see there's an update =)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#67 Old 23rd Feb 2010 at 8:16 PM
Just being able to import makes things sooo much easier. Thanks a lot for this

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Field Researcher
Original Poster
#68 Old 23rd Feb 2010 at 9:42 PM
I'l most probably have a next version ready tomorrow with some bone assignments. I could see some assignment tonight, but I want to make sure I'm not just seeing things. And I need to dig out some Blender books as I haven't really worked with bones much.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#69 Old 23rd Feb 2010 at 9:59 PM
You also might want to look at the .smd import/export scripts. I don't know if that might help, but they work with bones.

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Field Researcher
Original Poster
#70 Old 25th Feb 2010 at 1:12 PM
Apologies, the bones is taking a bit longer than I thought, plus Milkshape's trial period is over, so I've bought it. Now just need the key to start it working again.

I'm using it to generate export files so i can compare it with the .s3ascg files. So far I've tried looking at other scripts, but it's requiring a bone id (int) which I can't see in the .s3ascg file.

I hope to have this going forward again soon.
Pettifogging Legalist!
retired moderator
#71 Old 25th Feb 2010 at 1:22 PM
No need to apologise =) (as long as you're done before MY milkshape trial runs out, of course! =P).

I'll try asking some people who I think might know stuff about bones, maybe they can give you some useful info.

(At least for me the bones part will probably take a little while to test as well, because right now I have no idea where the bones stuff even IS in blender .. )

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#72 Old 25th Feb 2010 at 5:22 PM
These guys were actually really fast. I now have a proper version of MilkShape and some of the figures now makes loads more sense.
Alchemist
#73 Old 26th Feb 2010 at 8:38 AM
The bones are listed in each .s3asc file in the SKIN section.
For each vertex, there is an assignment value that uses the index of one of these skin items (0, 1, 2...) or -1 for an unassigned value (should never exist, but then the Titanic was not supposed to sink, either, until it found an unexpected iceberg).

A project that has three joints may only have one listed in some files, in those files the joint may be indexed as zero, even if it is indexed with a higher value in another file. You can track the reference by the bone name (hash value).

So an assignment of zero references the first joint in the skin section of the current file. These joint names are built from the hex values of the hash of the name. The name itself does not appear in the file, and brute forcing the reverse hashing is way beyond feasible for this project. A file table of hash <-> name records is possible, but I never implemented that myself.
I do not know how blender organizes bones. The game, and most other editors, implement a per-vertex array of bone assignments. While in theory there could be four assignments per vertex, with variable weightings, the object meshes only use on assignment, with a full 1.0 weighting for that. Multiple assignments and skin weights are only used here in GEOM meshes. You might want to see how the other script implements these, and then you can do the same, only just one assignment.

If you like to say what you think, be sure you know which to do first.
Pettifogging Legalist!
retired moderator
#74 Old 26th Feb 2010 at 5:45 PM Last edited by plasticbox : 26th Feb 2010 at 6:04 PM.
There seems to be a problem with importing sunshadow meshes – I can't tell for certain, at first I thought it was to do with the filename being too long (of a new object, of which I attempted to import all meshes), but then I checked with some where I had successfully imported the 00000000 meshes before and realised I can't import the sunshadows of those either. I can import them in Milkshape, so the files themselves seem to be fine.

It's telling me there's a script error and I should check the script console window, but embarrassingly I have no idea where that is. If I find it, I hope I might be able to tell you something more useful than "I can't import" =). -- oh, duh! It's talking about the system console .. I was thinking a window in blender.

So here's the output of my last attempt:



I'm attaching two example folders below: the high and low detail sunshadows of a kitchen counter (EA base game modern counter).

One difference I can think of, between sunshadows and regular meshes, is that sunshadows have no normals. Other than that, they're just larger .. distorted (for the human eye) .. and sit below z = 0. None of which should pose a problem, I guess? I have no idea whether they have UV maps (seeing as that error seems to be about parsing the UV?), but for all I can see the game wouldn't need them, all it does with those meshes is calculate the sunshadow, I'd assume all it needs for that are the vertex positions.

I'm currently using 0.1.5 I believe (I think it would be good if you'd include the version numbers in your script names!) – it has a timestamp of 2010-02-22 21:15 European time.


e: screenshot attached, this is what I see when importing a sunshadow as .obj – so they don't seem to have UV maps, at least, not really.
Screenshots
Attached files:
File Type: zip  00010000.zip (10.1 KB, 8 downloads) - View custom content
File Type: zip  00010001.zip (6.4 KB, 8 downloads) - View custom content

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Field Researcher
Original Poster
#75 Old 27th Feb 2010 at 1:59 PM
Thanks Plasticbox, I'll have a look on my side. Good plan with the version numbers, I'll include that in the name and description.
Page 3 of 10
Back to top