Engineer roocker666 Posted May 3 Author Engineer Share Posted May 3 3 minutes ago, shak-otay said: The question is, "can we create a flag from the vertex block values?". I have my doubts when looking at your mesh format pictures above. In theory yes because we have 4 bytes of padding too after vertices("flag" and "pad" are these 4 bytes, one short and other short) but we need to read Uvs, + 8 bytes of padding and in Vbuf48 the same but reading Normals + 4 bytes padding. So It seems like we need to read the entire buffer in both mesh formats or something like that. Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 3 Engineer Share Posted May 3 (edited) Hmm, it skips the wrong faces. The implementation looks correct: # A000 # skipped 26 # F000 # skipped 27 # 0 f 27/27 28/28 29/29 # 0 f 28/28 30/30 29/29 # 0 f 29/29 30/30 31/31 .... (maybe a "plus/minus 1" index bug, but in principle no fault) edit: hopefully I "bugged it out" but still extra faces, hmm, thinking (added resulting kitana obj for reference, 1026 faces skipped, only difference I see are lots of holes) Maybe I'm reading the wrong flags? The log shows the skipping working as expected, from a mathematical point of view: # 0. 17c +16 dec. [0] # 1. 19c +16 dec. [4000] # 2. 1bc +16 dec. [c000] # 3. 1dc +16 dec. [c000] # 4. 1fc +16 dec. [4000] # 5. 21c +16 dec. [0] # 6. 23c +16 dec. [7000] # 7. 25c +16 dec. [b000] # 8. 27c +16 dec. [b000] # 9. 29c +16 dec. [0] # 10. 2bc +16 dec. [8000] # 11. 2dc +16 dec. [8000] # 12. 2fc +16 dec. [0] -------------------------- # C000 # skipped 2 # C000 # skipped 3 # 4000 f 3/3 4/4 5/5 # 0 f 4/4 6/6 5/5 # 7000 f 5/5 6/6 7/7 # B000 # skipped 7 # B000 # skipped 8 # 0 f 8/8 10/10 9/9 # 8000 # skipped 10 # 8000 # skipped 11 # 0 f 11/11 12/12 13/13 # 0 -------------------- Makeobj_log, kitana_b+16.zip Edited May 4 by shak-otay 1 Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 4 Engineer Share Posted May 4 well, no matter which flag I choose, red or blue, in both cases I get holes. Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 4 Author Engineer Share Posted May 4 (edited) 1 hour ago, shak-otay said: well, no matter which flag I choose, red or blue, in both cases I get holes. But those holes are in Vbuf32 or Vbuf48 meshes? or maybe in both? Try this, in Vbuf32 use the first short after vertices as "Flag" but in Vbuf48 use the second short after vertices as "Flag" Edited May 4 by roocker666 Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 4 Engineer Share Posted May 4 (edited) Cool thought - but sadly it happens in both: (it reads "skipped vertexnumber", where vertexnumber is a faceindex of the skipped face) # 8000 (flag) # skipped 4079 # 8000 (flag) # skipped 4080 # 6000 (flag) f 4080/4080 4082/4082 4081/4081 # 4079. 2a324 +16 [8000] [32] # 4080. 2a344 +16 [8000] [32] # 4081. 2a364 +16 [6000] [32] ---------------- # 0 f 947/947 948/948 949/949 # A000 # skipped 949 # C000 # skipped 950 # 0 f 950/950 952/952 951/951 # 948. 8dbc +16 [0] [48] # 949. 8dec +16 [a000] [48] # 950. 8e1c +16 [c000] [48] # 951. 8e4c +16 [0] [48] ------------------------------------- After having checked it back 'n forth I'm not sure whether skipping is worth using it here (if I haven't used the wrong flags, maybe). There's less extra faces and lower legs are near to perfect but as another result of skipping we get holes. Dependent on the flags I use (offset 16 or not) they maybe bigger or less big. Edited May 4 by shak-otay 1 Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 4 Author Engineer Share Posted May 4 7 hours ago, shak-otay said: After having checked it back 'n forth I'm not sure whether skipping is worth using it here (if I haven't used the wrong flags, maybe). There's less extra faces and lower legs are near to perfect but as another result of skipping we get holes. Dependent on the flags I use (offset 16 or not) they maybe bigger or less big. Well, at least we have less extra faces. I have an idea, download attached "model3_Kitana_Fatality.rar" from 1st page. I cut all meshes and made two files, one has all Vbuf32 meshes and the other has all Vbuf48 meshes, then choose one or the other to see what happens. Maybe we can identify which mesh group has holes. I hope just one group shows holes.. Kitana fatality model has more meshes inside like guts and bones, the good thing is that this model use one texture for the whole body and other texture for all guts and bones. 1 Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 4 Engineer Share Posted May 4 (edited) Thanks! I'll look at that asap. Meanwhile I had logged the skipped meshes (1189) and grouped separately. The picture illustrates the situation. I append the obj in question for reference. edit: added pictures for vertex32only and vertex48only .mk models To track this down I assume it's required to collect the numbers of the obvious extra faces in blender, then check their vertex blocks in the mk file(s) for similarities. And check whether the flag WORD is >= 0x8000 always. Makeobj_log-kitana-1189_skipsIncluded.zip Edited May 4 by shak-otay 1 Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 5 Author Engineer Share Posted May 5 (edited) I tried to make a script for Noesis based on TriList by Leeao and a "mesh search" from Durik. The script reads meshes from Kitana fatality "model3_kitana_vertex32.mk" It seems like Vbuf32 meshes look perfect(using 1st short after vertices as Flag). Check Image 1 Then I made a few changes in the script(uncomment lines 32, 41, 42 and 47 to read meshes from Kitana fatality "model3_kitana_vertex48.mk") but meshes have holes(Image 2) *Save changes after uncommenting those lines, then close and open Noesis or just reload plugins from menu. That means only Vbuf48 meshes have holes. Then I changed the "Flag" using 2nd short after vertices(just swap lines 36 and 37) and No holes! but some extra faces(image 3) *Don't forget to save changes again after changing lines 36 and 37. So, 2nd short works better for Vbuf48 meshes but is not perfect because it creates some extra faces, I don't know if that is the corret Flag, besides there are more bytes that we can use as Flag after Uvs(only in vbuf48 meshes, Vbuf32 are fine), I am getting tired of this BS, lol Edited May 5 by roocker666 Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 5 Author Engineer Share Posted May 5 (edited) Here is that Noesis script if you want to test it: fmt_mk_shaolin_ps2_vbuf32_48_test.py And textures of Kitana Fatality Edited May 5 by roocker666 1 Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 5 Author Engineer Share Posted May 5 (edited) . Edited May 5 by roocker666 Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 5 Engineer Share Posted May 5 (edited) Cool! Combining the two no-holes meshes should give a perfect body!? Could you upload the script you created the vertex48-no-holes with, please? Because no matter how pad and flag line are ordered I get holes for vertex48 mesh (it's less with flag using 2nd short, yes). (lines 32, 41, 42 and 47 uncommented, of course) btw, using padding value as flag would mean the concerning vertex never being skipped, so less holes, yeah. Since vertex48 doesn't have many skips (see last picture in my previous post) there should be no big visual difference, but I have some small holes in vertex48, even if "skip" is off in the Make_obj app. edit: I checked the logs again why some extra vertexes are not marked for being skipped and found a vertex in a vertex48 block with a skip flag value (0xA000 for vertex 187) at an offset +16. I have no idea whether this is the cause of our troubles and I'm too exhausted atm to check further. It's important, btw, not to confuse the sub mesh numbers in the picture (SM_58_skip) with the vertex numbers. The _skip sub meshes consist of one face only (where I'm confused why vertex 184 and 186 are not marked for being skipped by their flags). Edited May 5 by shak-otay Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 5 Author Engineer Share Posted May 5 (edited) Yes, by combinning both meshes is a "perfect body" just meshes Vbuf48 have a few extra faces here and there but are inside the whole body. Script for the"vertex48-no-holes" is the same, lol. Just swap lines 36 and 37, Those lines read pad and Flag after vertices, so you need to change those, Vbuf48 holes(lines 36, 37): flag = (bs.readShort() & 0x8000) == 0x8000 pad = bs.readShort() No holes: pad = bs.readShort() flag = (bs.readShort() & 0x8000) == 0x8000 Edited May 5 by roocker666 Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 5 Engineer Share Posted May 5 (edited) Yes, I know. edit: ok, I see, I have two versions of .pyc in the cache. My fault was to rename the modified script. edit2: no. didn't solve my problem. Could you please compare the modified script with the one you get the vbuf48-no-holes picture with? Size of mk file is 99488 bytes. This is what I use and get: fmt_mk_shaolin_ps2_vbuf48_test.py Edited May 5 by shak-otay Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 5 Author Engineer Share Posted May 5 16 minutes ago, shak-otay said: edit2: no. didn't solve my problem. Could you please compare the modified script with the one you get the vbuf48-no-holes picture with? Size of mk file is 99488 bytes. This is what I use and get: Script is fine, maybe you need to press red icon on bottom "Toggle face cull" or just press F4 1 Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted May 5 Engineer Share Posted May 5 Ok, the "dirty trick". I was in the hope the script would work without it. Well, seems to be a good result, though I'm still suspicious about using pad word for flag creation. Link to comment Share on other sites More sharing options...
Engineer roocker666 Posted May 6 Author Engineer Share Posted May 6 (edited) On 5/5/2024 at 3:13 PM, shak-otay said: Ok, the "dirty trick". I was in the hope the script would work without it. Well, seems to be a good result, though I'm still suspicious about using pad word for flag creation. Yeah, that's a problem when you create faces, probably there is other algo to fix faces orientation but that means more work.. So is Ok like that. I am not really sure how PS2 creates faces, that is a big question but anyway. I really appreicate all your work and time for this, Thank you for all your help man! 😃 Edited May 6 by roocker666 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now