BILL'S HAT MODEL IMPORTED INTO BRAWL!

Started by Protoman.EXE, February 20, 2010, 04:09:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Win. What does it replace?
[white]: SW-2632-7270-6724[/white]


Quote from: NecroMasterX on June 03, 2010, 12:27:19 PMHey randomtbrush, are you ever gonna do my request for max's severed head?
It's on my to-do list.

Quote from: BehindYou on June 03, 2010, 02:59:01 PMWin. What does it replace?
The Maxim Tomato. Maxim Tomato heals 50%, sandvich laying on the ground heals 50HP. Makes perfect sense.

whats the format on the polygon block.

its like header info then a bunch of strips.. but the strips have a format to them..

-[3bytes] 0x9800FF {start of strip?}
-[2bytes][x3] 3 Faces
-[1byte] 0x00 node?

..pattern repeats depending on the amount of faces in strip...
Luka Megurine by mariokart64n
[Character-ImportModel-Zelda]

June 05, 2010, 04:12:15 AM #63 Last Edit: June 05, 2010, 04:30:16 AM by RandomTBush
Quote from: mariokart64n on June 05, 2010, 02:19:28 AMwhats the format on the polygon block.

its like header info then a bunch of strips.. but the strips have a format to them..

-[3bytes] 0x9800FF {start of strip?}
-[2bytes][x3] 3 Faces
-[1byte] 0x00 node?

..pattern repeats depending on the amount of faces in strip...
For tristrips, the first byte is for the polygon type (with 98 being the identifier for triangle strips), and then the next two is for how many polygon groups there are in the batch. Then, all the bytes after that for vertex position ID, normal position ID, and UV position ID, in that order, and there are always at least three groups.

This page has information on the different polygon types, under "Conversion Methods" (click on the button to the left to expand the section). Although written for Super Smash Bros. Melee, the polygon format seems to be the exact same for Brawl.

Anyway, Sandvich is released!


http://forums.kc-mm.com/Gallery/BrawlView.php?Number=7137&Moderated=All

I'll most likely take a new picture for it tomorrow, as I was in a bit of a hurry to get it uploaded.

I don't get the sandwich joke, but okay.

June 05, 2010, 04:35:38 AM #65 Last Edit: June 05, 2010, 04:45:58 AM by RandomTBush
Quote from: OizenX on June 05, 2010, 04:30:26 AMI don't get the sandwich joke, but okay.
The basic idea of the picture's from Meet the Scout, one of Valve's promotional videos for Team Fortress 2. The red team's Scout (on the right) interrupts the blue team's Heavy (on the left) right before he's about to eat his Sandvich.



I'm gonna re-take the picture sometime tomorrow, though, since I'm gonna change it so that Ness is holding the Home Run Bat. Either that, or just about to bash Dedede's head in.

But as for the idea of the Sandvich itself, it's food. Food replacing food. Makes sense.


June 06, 2010, 03:03:26 PM #67 Last Edit: June 06, 2010, 06:28:28 PM by mariokart64n
I made a maxscript to read a stripified DAE then write only the strips to a bin file as hex.

it follows what I sorta understand but it's not tested.. cause I haven't even gotten this to work yet
the info supllied by RandomTbush really confused me after he said the polygon file doesn't have faces, its just ID's IDs IDs.. if thats the case I have no clue. cause there is alot of random numbers at the end of the polygon block.. but I can makeout the starting pattern, which also is backed up by the melee info

[2bytes] ID {9800=triStrips}
[2bytes] FaceCount {??not sure on base unit 0 or 1} DAE uses 1, usually hex is 0
[2bytes][FaceCountx3] faces...


anyway here's the script, please test it out. I think I have the endian wrong
fsource = GetOpenFileName \
caption:"die!" types: \
"PKG(*nif)|*.*|All files (*.*)|*.*|"
f= fopen fsource "rt"
-- fext= getFilenameType fsource
-- fsize= getFileSize fsource
fpath= getFilenamePath fsource
fname= getFilenameFile fsource
-- f = fopen "T:\\BrawlMods\\marth_shinobo\\polygon15" "rb"
-- f = fopen "T:\\BrawlMods\\marth_shinobo\\ok2.dae" "rt"

-- fpath="C:\\"

-- fn writeBElong fstream = (
-- long = readlong fstream
-- long = bit.swapBytes long 1 4
-- long = bit.swapBytes long 2 3
-- return long
-- )

-- fn readBEshort fstream = (
-- short = readshort fstream
-- short = bit.swapBytes short 1 2
-- return short
-- )
fn ReadFixedString bstream fixedLen = (
local str = ""
for i = 1 to fixedLen do
(
str += bit.intAsChar (ReadByte bstream #unsigned)
)
str
)

filetest=""
while(filetest!="tristrips")
do(
file=bit.intAsChar (ReadByte f #unsigned)
if file=="<" do(
filetest=readFixedString f 9
triStripOffset=((ftell f)+7)
fseek f -9 #seek_cur
)
if filetest=="tristrips" then exit
)



if triStripOffset!=undefined do(
fseek f triStripOffset #seek_set

faceCount=""
do(
file=bit.intaschar (ReadByte f #unsigned)
if file=="\"" then exit
if file!=" " do(
faceCount+=file
)
)
while (file!=" ")
faceCount =(faceCount as float)




while(ftell f!=end)
do(
file=bit.intAsChar (ReadByte f #unsigned)
if file=="<" do(
filetest=readFixedString f 2
if filetest=="p>" then exit
)
)

fseek f -4 #seek_cur
start=ftell f
-- while(ftell f!=end)
-- do(
-- file=bit.intAsChar (ReadByte f #unsigned)
-- if file=="/" do(
-- filetest=readFixedString f 9
-- if filetest=="tristrips" then exit
-- )
-- )
-- last=ftell f
-- stripSize=(last-start)

-- fseek f start #seek_set
-- StripRead=""
-- for x = 1 to stripSize do(
-- StripRead+=bit.intAsChar (ReadByte f #unsigned)
-- )
-- StripRead as stringStream
-- fr=readDelimitedString StripRead " "

faceArray=#()
stripCount=#()
for x = 1 to faceCount do(
counter=0
do(
fseek f -1 #seek_cur
file2=bit.intAsChar (ReadByte f #unsigned)

if file2=="<" then exit

face=""

do(
file=bit.intAsChar (ReadByte f #unsigned)
if file==" " then exit
if file=="<" then exit
if file!=" " do(face+=file)

)while(file!=" ")

face=(face as float)
append faceArray face
counter+=1
)while(file2!="<")

append stripCount counter
fseek f 27 #seek_cur
)

-- print faceArray
-- print stripCount
fclose f
gc()

createFile (fpath+fname+"_strips.bin")
s = fopen (fpath+fname+"_strips.bin") "ab"
for x = 1 to stripCount.count do(
write=writeshort s 0x0098
write=writebyte s stripCount[x]
for i = 1 to stripCount[x]/3 do(
write=writeshort s (bit.swapBytes (faceArray[1]) 1 2)
write=writeshort s (bit.swapBytes (faceArray[2]) 1 2)
write=writebyte s 0x00
write=writeshort s (bit.swapBytes (faceArray[3]) 1 2)
deleteItem faceArray 1
deleteItem faceArray 1
deleteItem faceArray 1

)
-- gc light:false delayed:false
)


fclose s
gc()



)



wh = ftell f
print wh



-- totalLength=readBElong f
-- mdl0Offset=readBElong f
-- nodeId=readBElong f
-- elemFlags=readBElong f
-- texFlags=readBElong f
-- dataFlags=readBElong f
-- defSize=readBElong f
-- defFlags=readBElong f
-- defOffset=readBElong f
-- dataLen1=readBElong f
-- dataLen2=readBElong f
-- dataOffset=readBElong f
-- unk2=readBElong f
-- unk3=readBElong f
-- stringOffset=readBElong f
-- index=readBElong f
-- numVertices=readBElong f
-- numFaces=readBElong f
-- vertSet=readBEshort f
-- normalSet=readBEshort f
-- fseek f 20 #seek_cur
-- part10Offset=readBElong f
-- dataJump=totalLength-dataLen1
-- fseek f dataJump #seek_set



-- wh= ftell f
-- print "where?"
-- print wh
print "DONE!!"


I'll do more testing myself later, if I have success I'll create a video outlining the method
Luka Megurine by mariokart64n
[Character-ImportModel-Zelda]

Hello! I am not a regular poster! Just when I'm bored I post once in the family thread!

a common screenname of mine is Osamodas, though on some games I mispell as Osamada. I am looking to change the name, as I am an indesicive bastard :D

Quote from: mariokart64n on June 06, 2010, 03:03:26 PM
the info supllied by RandomTbush really confused me after he said the polygon file doesn't have faces, its just ID's IDs IDs.. if thats the case I have no clue.
Ulp. What I meant by IDs, is that there are a certain amount of vertices, normals, and UV points per model. Each vertex, normal and UV point has as many IDs as there are points. One ID per point, ya see.

Let's just say that one polygon group is like this: (0 0 0 2 1 3 4 4 4). That means that the vertices link to points #0, #2 and #4, the normals link to points #0, #1 and #4, and the UV links to points #0, #3 and #4. Only from their own point groups, of course.

RandomTBush, would a model that is 'neither rigged, weighted or textured' work to be imported?

Quote from: Some guy who makes epic modelsMy concern at present is that neither model is rigged, weighted or textured, as well that both models are significantly more complex than the Wii can probably handle. I do have a lower res GL, but he's still not textured or rigged.

Do you have a lot of experience importing outside models into Brawl?

June 06, 2010, 10:12:40 PM #71 Last Edit: June 06, 2010, 10:13:54 PM by RandomTBush
Quote from: Vishkugeta on June 06, 2010, 10:05:16 PM
RandomTBush, would a model that is 'neither rigged, weighted or textured' work to be imported?

Quote from: Some guy who makes epic modelsMy concern at present is that neither model is rigged, weighted or textured, as well that both models are significantly more complex than the Wii can probably handle. I do have a lower res GL, but he's still not textured or rigged.

Do you have a lot of experience importing outside models into Brawl?
If it doesn't have any texture, then it's probably not best to work on it until it does, as the UV values would probably change and therefore have the polygon groups forced to be re-done.

Unless it's not supposed to have textures in the first place.

yay, brawlbox didnt crash this time ^_^

seems there an extra byte.. I don't understand why

like

98 00 [count] [face1] [face2] [node?] [face3]

updated the script, tested on marths hair, but its a vertex mess
fsource = GetOpenFileName \
caption:"die!" types: \
"PKG(*nif)|*.*|All files (*.*)|*.*|"
f= fopen fsource "rt"
-- fext= getFilenameType fsource
-- fsize= getFileSize fsource
fpath= getFilenamePath fsource
fname= getFilenameFile fsource
-- f = fopen "T:\\BrawlMods\\marth_shinobo\\polygon15" "rb"
-- f = fopen "T:\\BrawlMods\\marth_shinobo\\ok2.dae" "rt"

-- fpath="C:\\"

-- fn writeBElong fstream = (
-- long = readlong fstream
-- long = bit.swapBytes long 1 4
-- long = bit.swapBytes long 2 3
-- return long
-- )

-- fn readBEshort fstream = (
-- short = readshort fstream
-- short = bit.swapBytes short 1 2
-- return short
-- )
fn ReadFixedString bstream fixedLen = (
local str = ""
for i = 1 to fixedLen do
(
str += bit.intAsChar (ReadByte bstream #unsigned)
)
str
)

filetest=""
while(filetest!="tristrips")
do(
file=bit.intAsChar (ReadByte f #unsigned)
if file=="<" do(
filetest=readFixedString f 9
triStripOffset=((ftell f)+7)
fseek f -9 #seek_cur
)
if filetest=="tristrips" then exit
)



if triStripOffset!=undefined do(
fseek f triStripOffset #seek_set

faceCount=""
do(
file=bit.intaschar (ReadByte f #unsigned)
if file=="\"" then exit
if file!=" " do(
faceCount+=file
)
)
while (file!=" ")
faceCount =(faceCount as float)




while(ftell f!=end)
do(
file=bit.intAsChar (ReadByte f #unsigned)
if file=="<" do(
filetest=readFixedString f 2
if filetest=="p>" then exit
)
)

fseek f -4 #seek_cur
start=ftell f
-- while(ftell f!=end)
-- do(
-- file=bit.intAsChar (ReadByte f #unsigned)
-- if file=="/" do(
-- filetest=readFixedString f 9
-- if filetest=="tristrips" then exit
-- )
-- )
-- last=ftell f
-- stripSize=(last-start)

-- fseek f start #seek_set
-- StripRead=""
-- for x = 1 to stripSize do(
-- StripRead+=bit.intAsChar (ReadByte f #unsigned)
-- )
-- StripRead as stringStream
-- fr=readDelimitedString StripRead " "

faceArray=#()
stripCount=#()
for x = 1 to faceCount do(
counter=0
do(
fseek f -1 #seek_cur
file2=bit.intAsChar (ReadByte f #unsigned)

if file2=="<" then exit

face=""

do(
file=bit.intAsChar (ReadByte f #unsigned)
if file==" " then exit
if file=="<" then exit
if file!=" " do(face+=file)

)while(file!=" ")

face=(face as float)
append faceArray face
counter+=1
)while(file2!="<")

append stripCount counter
fseek f 27 #seek_cur
)

-- print faceArray
-- print stripCount
fclose f
gc()

createFile (fpath+fname+"_strips.bin")
s = fopen (fpath+fname+"_strips.bin") "ab"
for x = 1 to stripCount.count do(
write=writeshort s 0x0098
write=writebyte s (stripCount[x]/3)
for i = 1 to stripCount[x]/3 do(
write=writeshort s (bit.swapBytes (faceArray[1]) 1 2)
write=writeshort s (bit.swapBytes (faceArray[2]) 1 2)
write=writebyte s 0x00
write=writeshort s (bit.swapBytes (faceArray[3]) 1 2)
deleteItem faceArray 1
deleteItem faceArray 1
deleteItem faceArray 1

)
-- gc light:false delayed:false
)


fclose s
gc()



)



wh = ftell f
print wh



-- totalLength=readBElong f
-- mdl0Offset=readBElong f
-- nodeId=readBElong f
-- elemFlags=readBElong f
-- texFlags=readBElong f
-- dataFlags=readBElong f
-- defSize=readBElong f
-- defFlags=readBElong f
-- defOffset=readBElong f
-- dataLen1=readBElong f
-- dataLen2=readBElong f
-- dataOffset=readBElong f
-- unk2=readBElong f
-- unk3=readBElong f
-- stringOffset=readBElong f
-- index=readBElong f
-- numVertices=readBElong f
-- numFaces=readBElong f
-- vertSet=readBEshort f
-- normalSet=readBEshort f
-- fseek f 20 #seek_cur
-- part10Offset=readBElong f
-- dataJump=totalLength-dataLen1
-- fseek f dataJump #seek_set



-- wh= ftell f
-- print "where?"
-- print wh
print "DONE!!"


also I'm still not sure what you mean by ID's are the IDs in the polgon block that I need to edit
Luka Megurine by mariokart64n
[Character-ImportModel-Zelda]

June 06, 2010, 10:34:22 PM #73 Last Edit: June 06, 2010, 10:41:44 PM by RandomTBush
Quote from: mariokart64n on June 06, 2010, 10:22:13 PMseems there an extra byte.. I don't understand why

like

98 00 [count] [face1] [face2] [node?] [face3]

...

also I'm still not sure what you mean by ID's are the IDs in the polgon block that I need to edit

Hm. Seems like it's a different type of polygon group you're working with. I think the extra byte might be for colour IDs? It does come right after normals (2nd byte) and before UV (4th byte). The one I was working with gives me two bytes for each vertex/normal/UV, and no colour IDs that I have to worry about.

And the IDs for the polygon groups link to the vertex/normal/UV positions, like I said. For example...

ID 0 = -2.0331 0.052406 0.91553
ID 1 = -2.06535 0.053566 0.768179
ID 2 = -3.09214 0.05108 0.188485
ID 3 = -1.93107 0.052136 1.02704
ID 4 = -2.9666 0.073827 -0.560108
ID 5 = -2.03939 0.061984 -2.06363

If the polygon group goes (0 # # 1 # # 2 # # 3 # # 4 # # 5 # #), then it would draw a triangle from point 0 to point 1 to point 2, then one from point 1 to point 2 to point 3, and so on. A similar thing works for the normals and UVs.

Anyway. What are the identifiers set to in the header for the polygon group?


These are the ones I've used, which allow me to have more than 256 polygons per object. (The red ones on the bottom need to match the green ones at the top.)

well that's awesome RandomTBrush.

I can't understand how you're doing that.. I'd like to try importing stuff but it's just Chinese to me.