• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

[Modset4.2] Open BrawlBox/Lib Development Thread [PW's SSS support(PAT0 editing)]

pokelover980

Smash Ace
Joined
Oct 4, 2007
Messages
905
stupid people not posting the right documentation needed for other people to read from the format correctly :mad:
No one is stupid for not posting documentation, it's just that there's been no need to. We've got programs that do all the work for us and thus needing documentation is useless. And since previously mentioned program is open source, there's less need for documentation because the source itself is documentation :p
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
No one is stupid for not posting documentation, it's just that there's been no need to. We've got programs that do all the work for us and thus needing documentation is useless. And since previously mentioned program is open source, there's less need for documentation because the source itself is documentation :p
well... some people *cough* me *cough cough*
can't read the complicated and poorly commented codes out there when I'm trying to learn a format...

eg: mdl0...
I've been asking for info on the face-points for weeks now...
everyone's like *ignoring this dude*

I've asked on about 2-3 forums

documentation's a B when it comes to explanations :glare:
when they give you everything but the equation you'll need

EDIT:
that wasn't ment to be taken as an actual comment though :/
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
hey...

IDK if you guys have been told of this error yet...
but it causes a crash in the viewer...

when you open the left and top/bottom panels, then the right,
or the left and right panels, then the top/bottom...
it crashes immediatly...

IDK if that's this, or my cpu...
just thought I'd bring it up is all ;)

and also...
I'm still stuck on RGB565...
this is what I have right now:

Code:
def RGB565(offset,width,height,length):
    X,Y,TX,TY = 2,2,0,0; fr.seek(offset,0)
    
    while length > 0:
        pixel = bin(ui(fr.read(2))).replace('0b','')
        while len(pixel) < 16: pixel = '0'+pixel
        list(pixel)
        
        R,Gl,Gh,B = pixel[0:5],pixel[6:8],pixel[9:11],pixel[12:16]
        R = chr(int((int(R,2)&31)*float(255/31))).encode('hex')
        G = chr(int(((int(Gl,2)>>5)&7)*float(255/63) + ((int(Gh,2)&7)<<3)*float(255/63))).encode('hex')
        B = chr(int((int(B,2)>>3)*float(255/31))).encode('hex')
        #print '#'+R+G+B
        
        color,x,y = '#'+R+G+B,TX+X,TY+Y
        C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0)
        
        TX+=1
        if TX == 4:
            TY += 1
            if TY == 4 and TX == 4:
                X += 4; TX,TY = 0,0
                if X == width+2: Y += 4; X = 2
            if TY == 4: TY = 0
            TX = 0
        length -= 2
what am I doing wrong??
my first one came out better actually :/ (in the images below)

here's my first code:

Code:
def RGB565(offset,width,height,length):
    X,Y,TX,TY = 2,2,0,0; fr.seek(offset,0)
    
    while length > 0:
        pixel = bin(ui(fr.read(2))).replace('0b','')
        while len(pixel) < 16: pixel = '0'+pixel
        list(pixel)
        
        R,G,B = pixel[0:5],pixel[6:11],pixel[12:16]
        R = chr(int(R,2)>>3).encode('hex')
        G = chr(int(G,2)>>2).encode('hex')
        B = chr(int(B,2)>>3).encode('hex')
        #print '#'+R+G+B
        
        color,x,y = '#'+R+G+B,TX+X,TY+Y
        C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0)
        
        TX+=1
        if TX == 4:
            TY += 1
            if TY == 4 and TX == 4:
                X += 4; TX,TY = 0,0
                if X == width+2: Y += 4; X = 2
            if TY == 4: TY = 0
            TX = 0
        length -= 2
please help if you can :/
 

pokelover980

Smash Ace
Joined
Oct 4, 2007
Messages
905
Well, it'd be nice if you told us what wasn't working with your code so we'd know what to look for :p
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
Well, it'd be nice if you told us what wasn't working with your code so we'd know what to look for :p
alright...
that's the code that does the conversion conversion on the image data,
and writes each pixel in the canvas...
I've got the XY positions working perfectly...

but it's the color that messes up (as you can see in the images below)
I need to convert '00 00' to #000000 properly

I know it's done by the 16 bits in the hex:
00000 000000 00000
R5 G6 B5

but I just can't seem to get any further than that...

the part of the code to mess with is the R,G,B variables...
(all I need is the conversion method)

EDIT:
the difference between my functions:
old:
R,G,B = pixel[0:5],pixel[6:11],pixel[12:16]
R = chr(int(R,2)>>3).encode('hex')
G = chr(int(G,2)>>2).encode('hex')
B = chr(int(B,2)>>3).encode('hex')
reads as: [00000 000000 00000]

new:
R,Gl,Gh,B = pixel[0:5],pixel[6:8],pixel[9:11],pixel[12:16]
R = chr(int((int(R,2)&31)*float(255/31))).encode('hex')
G = chr(int(((int(Gl,2)>>5)&7)*float(255/63) + ((int(Gh,2)&7)<<3)*float(255/63))).encode('hex')
B = chr(int((int(B,2)>>3)*float(255/31))).encode('hex')
reads as: [00000 000] [000 00000]
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
hey...
what filetype is this, and what is it used for??:
(1st 4 bytes of the header)

WààW

just in case anyone knows by chance :/
 

Phantom Wings

Smash Apprentice
Joined
Jul 29, 2008
Messages
150
Tcll, I've been looking at your code and it looks like its just a simple matter of binary shift and AND.

Suppose you have the RGB565 16-bit color value of 0x15E1 (5601 in decimal), you already know the binary separation of the RGB565 format, so all you need to do is perform the following operations.

pixel = 5601 (or whatever color value you have here)

R = (pixel >> 11) & 0x1F) / 0x1F * 255;
G = (pixel >> 5) & 0x3F / 0x3F * 255;
B = (pixel >> 0) & 0x1F / 0x1F * 255;

That will get you the color values from 0 to 255 for RGB - providing whatever the default data type you're using supports decimal division
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
KK
I tried that...
I'm back to all blacks again, but mayby I'm not using it right :/

is this right:
Code:
def RGB565(offset,width,height,length):
    X,Y,TX,TY = 2,2,0,0; fr.seek(offset,0)
 
    while length > 0:
        pixel = bin(ui(fr.read(2))).replace('0b','')
        while len(pixel) < 16: pixel = '0'+pixel
        list(pixel)
 
        R,G,B = pixel[0:5],pixel[6:11],pixel[12:16]
        R = chr(((int(R,2) >> 11) & 31) / (31 * 255)).encode('hex')
        G = chr(((int(G,2) >> 5) & 63) / (63 * 255)).encode('hex')
        B = chr(((int(B,2) >> 0) & 31) / (31 * 255)).encode('hex')
        #print '#'+str(R)+str(G)+str(B)
 
        color,x,y = '#'+R+G+B,TX+X,TY+Y
        C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0)
 
        TX+=1
        if TX == 4:
            TY += 1
            if TY == 4 and TX == 4:
                X += 4; TX,TY = 0,0
                if X == width+2: Y += 4; X = 2
            if TY == 4: TY = 0
            TX = 0
        length -= 2
honestly, I don't understand bit-shifts and all those bit operators yet...
I work in numbers, not bites... :p

EDIT:
wait... >_>
lemme try somethin...
I think I have an idea :p

btw, you'll notice your codes are in chr(...).encode('hex')
I think that's easy to figure out, but I'll explain anyways :p

chr() converts an int to a character (65 = A)
.encode('hex') does exactly as it says =P (A = '41')

EDIT2:
nope...
it's still a variation of blacks...
I think '14' was the highest it got to... ('14' = 20)

here's my 2nd try:
Code:
def RGB565(offset,width,height,length):
    X,Y,TX,TY = 2,2,0,0; fr.seek(offset,0)
 
    while length > 0:
        pixel = ui(fr.read(2))
 
        R = chr(((pixel >> 11) & 31) / (31 * 255)).encode('hex')
        G = chr(((pixel >> 5) & 63) / (63 * 255)).encode('hex')
        B = chr(((pixel >> 0) & 31) / (31 * 255)).encode('hex')
        #print '#'+str(R)+str(G)+str(B)
 
        color,x,y = '#'+R+G+B,TX+X,TY+Y
        C.create_rectangle ( x, y, (x+1), (y+1), fill=color, width=0)
 
        TX+=1
        if TX == 4:
            TY += 1
            if TY == 4 and TX == 4:
                X += 4; TX,TY = 0,0
                if X == width+2: Y += 4; X = 2
            if TY == 4: TY = 0
            TX = 0
        length -= 2
 

NO@H

Smash Journeyman
Joined
Jul 11, 2009
Messages
279
Where is the code for the interpolation of frames? Can't find it in AnimationCode.cs, is it in KeyframeCollection.cs?
 

tehshyguy

Smash Rookie
Joined
Mar 19, 2010
Messages
16
@ anyone who dl the source code...
Did anyone ever get this error when trying to build/debug brawlbox? I get this error everytime i try on every version lol...

Error 48 Application Configuration file "app.config" is invalid. Could not find file 'C:\Users\BrawlBox 4.1\source\BrawlBox\app.config'.
 

NO@H

Smash Journeyman
Joined
Jul 11, 2009
Messages
279
@ anyone who dl the source code...
Did anyone ever get this error when trying to build/debug brawlbox? I get this error everytime i try on every version lol...

Error 48 Application Configuration file "app.config" is invalid. Could not find file 'C:\Users\BrawlBox 4.1\source\BrawlBox\app.config'.
Yeah I got the same thing..
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
KK... 2 things...

1: still need to know how to figure out the face-points

2: RGB565 still doesn't work correctly

I'm getting tired of asking these :/
I've done alot of searches, and havn't really found anything to give a perfect conversion...

somebody has to know something...

EDIT:
another thing...
RGB5A3 format...
all I know is it's 16bit pixel data, but I can't seem to find any info on the format...
all I can find is stuff like "convert this to RGB5A3" or "images are in RGB5A3 format"
I'm so sick and tired of searching with only those results :mad:
 

Phantom Wings

Smash Apprentice
Joined
Jul 29, 2008
Messages
150
Hey, not everything needs to be given to you. Some things need to be worked on until a satisfactory solution is found. If Kryal had sat around asking people to give him all answers I really doubt that Brawlbox would even exist today.

If you really want to know about the rgb5a3 format, then this should get you to where you're looking for.

Both the first, second and third result will provide you with enough details to understand the format - if you take the time to read through them.

No one has to give you anything. So please, don't demand for people to help you like it's your right to unless you want to lose everyone's respect really quickly.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Oh,PW... Sorry for having you done such a thing.

Tcll,you should learn how to read C# codes. Kryal's code tells you a lot of information.
(I think you have forgotten that I'm not a English speaker. I can't tell you better information than this because it's hard for me to explain my idea in English.)

@tehshyguy&NO@H
I'm sorry,that's my mistake. I'll update repository soon.
 

Phantom Wings

Smash Apprentice
Joined
Jul 29, 2008
Messages
150
Don't worry about it Bero. You've done an awesome job at leading the continuation of Brawlbox. My main gripe is with the ones who cannot be bothered with putting some of their own time towards something and insist that someone else should do the work for them.
 

Supreme Dirt

King of the Railway
Joined
Sep 28, 2009
Messages
7,336
If I have some spare time I'll try to help with this, but I've pretty much got my hands full with school and Brawl 64.
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
Hey, not everything needs to be given to you. Some things need to be worked on until a satisfactory solution is found. If Kryal had sat around asking people to give him all answers I really doubt that Brawlbox would even exist today.

If you really want to know about the rgb5a3 format, then this should get you to where you're looking for.

Both the first, second and third result will provide you with enough details to understand the format - if you take the time to read through them.

No one has to give you anything. So please, don't demand for people to help you like it's your right to unless you want to lose everyone's respect really quickly.
didn't you read my previous post...
I've done that already -.-*

I'm just asking someone that knows, and apperently the format is widely known...
so why not spread the word...

I share everything, so why don't I get a little respect in return :/
I'd call that fair :/
*noticing how many I's I used above* 9_9

whatever...
I won't lose others respect...
I show enough as it is =P (or at least try to)
it's just...
I need some in return plz :)

Oh,PW... Sorry for having you done such a thing.

Tcll,you should learn how to read C# codes. Kryal's code tells you a lot of information.
(I think you have forgotten that I'm not a English speaker. I can't tell you better information than this because it's hard for me to explain my idea in English.)

@tehshyguy&NO@H
I'm sorry,that's my mistake. I'll update repository soon.
it's not so much the C# itself...
I can read it a little :|
but it's the freakin use of multiple files that gets me

I try to put everything into a single file...
just look at my webste :awesome:

I'll use 1 or 2 seperate files if my code gets too long...
Kryal has way too many seperate files for me to even begin to know where to start :c
it's a little too confusing for me :/

so you see... that's my problem :|

_____________________________________________________________

hmm... this is a new one :/
http://gxr.brickmii.com/Tutorial/Textures/

^this one appears helpful... FINALLY!
I was so tired of searching D:

EDIT:
btw PW...
I'm trying to figure out info that's already known, to help me in figuring out the unknown...

how can you continue if you have no start... :/

I can only figure out the new stuff if I already know the old stuff...

btw, searching is my first priority...
asking is my 2nd...

I really hate demanding, but what is there to do when you're left without options...
you can cross out turning back >:/
 

libertyernie

Smash Ace
Joined
Oct 5, 2009
Messages
929
Location
Eau Claire, WI
One feature I'd love to see is importing new PLT0 palettes, just like how you can import textures in TEX0 format. Right now I have to import some random PNG file with the same palette type and size, and then replace both the texture and palette. While this works, it takes longer than it should.
Another cool thing would be batch importing of textures, but that's not as high a priority for me.
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
@PW: well... that search still didn't give me any answers I needed... -_-*
(yes I looked again...)

BUT...
I started searching for sources, and found the src for puyo tools:
http://code.google.com/p/puyotools/...arp/VrSharp/GvrTexture/GvrPixelCodec.cs?r=122
that appears to be well documented and easy to figure out...
I'ma SVN DL the src and look at it...

FINALLY! for real this time...
gawd... I can't believe how hard people make it to figure something out... D:

oh well...
that's why there's me :3

ask me anything I may know :p
I'm documenting everything I figure out for other users who may want to get into it as well...
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
alright...
I'm trying to convert between REFT and BRRES

problem is, IDK the brres format entirely, and these notes are way outdated...
and I've just recently spent about 2 hrs looking on google...
^(so don't yelp at me please PW)
-^(I wouldn't be asking if there were some good notes avaliable)

old notes:
BRES header:
u32 magic = 'bres'
u32 unknown
u32 filesize
u32 unknown (00 10 00 01)

u32 other_magic = 'root'
u32 root directory length
BRES root directory @0x18:
u32 unknown
u32 ndirents
16 bytes unknown = ff ff 00 00 00 01 00 00
ndirents * struct {
u16 unknown[2]
u16 unknown[2]
u32 offset to dirname from start of directory (dirname is a null terminated string)
u32 offset to data for entry from start of dir

^those notes are quite wrong btw... (what's in red)

here's what I found out in what's above:
62 72 65 73 FE FF 00 00 00 00 09 00 00 10 00 02
72 6F 6F 74 00 00 00 58 00 00 00 28 00 00 00 01
FF FF 00 00 00 01 00 00 00 00 00 00 00 00 00 00
00 6D 00 00 00 00 00 01 00 00 08 AC 00 00 00 28
00 00 00 28 00 00 00 01 FF FF 00 00 00 01 00 00
00 00 00 00 00 00 00 00 00 66 00 00 00 00 00 01
00 00 08 98 00 00 00 40 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

when broken down:
62 72 65 73 (bres)
FE FF (unk)
00 00 (unk) REFT's are 00 07
00 00 09 00 (filesize)
00 10 (int(16) prbly data offset)
00 02 (instance count) this brres contains [ root , TEX0 ] (len == 2)
^this is exactly like an REFT header

72 6F 6F 74 (root)
00 00 00 58 (block-size(from start))

00 00 00 28 (offset block length)
00 00 00 01 (number of offsets)

FF FF (unk) someone said this was an ID or something >_>
00 00 (unk)
00 01 (unk) needed data
00 00 (unk) needed data
00 00 00 00 (data offset)
00 00 00 00 (string offset)
(the above offset is kinda useless, but it contains data needed for something)

00 6D
00 00
00 00
00 01
00 00 08 AC
00 00 00 28

00 00 00 28
00 00 00 01

FF FF
00 00
00 01
00 00
00 00 00 00
00 00 00 00
^kinda useless

00 66
00 00
00 00
00 01
00 00 08 98
00 00 00 40

00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^derp :p (kinda obvious)

the root groups and offsets are the exact same as the mdl0 relocation table groups and offsets:


what is all that (unk) stuff??
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
I found this a couple days ago:
http://game-hackers.com/entries/36-Let-s-start-with-the-exploration-x01
http://game-hackers.com/entries/37-Implementation-for-testing-exploration-x01
I was thinking about implementing BRRES support in Java, but I've sort of given up on it now. Still, I hope this is useful.
thanx :D
*reads*
I GOT THE HEADER RIGHT!!! WOOT ^_^
XDD
yea, that was pure guesswork :p (including the instances (sections is better))

but I still can't seem to figure out those last 4 unks in the offsets...
well, last 3 (1, 3, and 4)... 2 is always '00 00'

if anyone has any ideas, please let me know :)
I think either 3 or 4 may be an indexing method... but I'm not sure yet...

yur definatly being added to the contributors ;)
thanx again :)
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
hey...
anyone know anything about materials other than this:

here's a single material: (FitPikachu_main)

00 00 02 00 FF FF 7E 40 00 00 00 00 03 00 00 00
00 FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00
61 FE 00 00 0F 61 F6 00 00 04 61 FE 00 00 0F 61
F7 00 00 0E 61 FE 00 00 0F 61 F8 00 00 00 61 FE
00 00 0F 61 F9 00 00 0C 61 FE 00 00 0F 61 FA 00
00 05 61 FE 00 00 0F 61 FB 00 00 0D 61 FE 00 00
0F 61 FC 00 00 0A 61 FE 00 00 0F 61 FD 00 00 0E
61 27 FF FF FF 00 00 00 00 00 00 00 00 00 00 00
61 FE FF FF F0 61 F6 E3 78 C0 61 28 03 F0 40 61
C0 28 F8 AF 61 C2 08 FE B0 61 C1 08 F2 F0 61 C3
08 1F F0 61 10 00 00 00 61 11 00 00 00 00 00 00
61 FE FF FF F0 61 F7 00 38 C0 61 29 3B F3 BF 61
C4 08 06 EF 00 00 00 00 00 61 C5 08 1F F0 00 00
00 00 00 61 12 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


block size
MDL0 offset
ID
unk

the data is in Materials2 (materials)
(Materials1 is shaders)
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
yo...
I need to know a little something about the matrices:

since they're in this format:
x' = x*x1 + y*y1 + z*z1 + o1;
y' = x*x2 + y*y2 + z*z2 + o2;
z' = x*x3 + y*y3 + z*z3 + o3;


how do you get the w vector of the matrix??

since matrices usually go as:
X: 1 0 0 0
Y: 0 1 0 0
Z: 0 0 1 0
W: 0 0 0 1

I've never looked into matrices before so IDK alot about them :p

I'm asking this here because I need to know this for dae conversion...
and I know the guy's here definatly know something about it :/
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
hey...
anyone know anything about materials other than this:

here's a single material: (FitPikachu_main)

block size
MDL0 offset
ID
unk

the data is in Materials2 (materials)
(Materials1 is shaders)
If you look at the data structures in BrawlLib you'll find answers.

I think you're mistaken on what the definition of a material is. These are used by materials as extra GPU commands. They are shared, but have one entry in the asset header for each material. They are not exactly 'shaders', but I didn't have a better name for them.

The reason they aren't materials is because they hold no reference to actual rendering data. You can't draw a polygon with it, you need the material to do that.

The Wii doesn't have shaders, but you can simulate them using the TEV registers.

Most of this can be found in the Revolution SDK.

[EDIT]

If you need pixel conversions to/from individual formats, look at Wii/Textures/PixelTypes.cs, you'll find explicit conversions of each. Just a suggestion, don't multiply when converting colors and avoid using floating point (unless you need floating point specifically). Shift operations are the most primitive and take much fewer CPU cycles. And if you're wondering, there's no noticeable difference in precision/loss.
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
If you look at the data structures in BrawlLib you'll find answers.

I think you're mistaken on what the definition of a material is. These are used by materials as extra GPU commands. They are shared, but have one entry in the asset header for each material. They are not exactly 'shaders', but I didn't have a better name for them.

The reason they aren't materials is because they hold no reference to actual rendering data. You can't draw a polygon with it, you need the material to do that.

The Wii doesn't have shaders, but you can simulate them using the TEV registers.

Most of this can be found in the Revolution SDK.
hmm...
well, I get my info on this stuff from blender...

blender uses referenced materials...
the 1st, 2nd, and 3rd panls of the material objects window in blender belong to the materials...
the rest belong to the shaders, along with other things...
http://lh5.ggpht.com/_IteXPmeC6ek/TB0UF93EoQI/AAAAAAAABLQ/j3Pr2KH-6b8/2.PNG
(the Links and Pipelines panel is the link to the materials)


also, the wii not having it's own shaders would be a good reason why the shaders defined in brbx don't match up with blenders shaders:

Diffuse:
-Fresnel
-Minnaert
-Toon
-Oren-Nayar
-Lambert

Specular:
-Wardlso
-Toon
-Blinn
-Phong
-Cook Torr

also...
can I get the link to the SDK plz :)

EDIT:
again...
Pikachu has 3 materials:
-main
-eyeYellow
-metal

the one in the above image is the main
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
No, there are 5 materials (10 if counting metal). Once again, textures are not materials. Shaders are not materials. Materials may use a combination of textures and shaders, but not the other way around.

Materials are 'referenced' in MDL0 as well. Materials attach to polygons to define a collection of rendering operations. That link is defined in the polygon itself. Polygon -> Material -> Texture/Shader

Remember that the Wii development tools used Maya 7, not free software like blender. Blender has a lot of in-your-face feature controls that distract from the basics of 3d modeling and how the rendering process works.

I'll say this again: if you're going to export models to Blender, you need to build a wrapper for the .blend file format. The dae/fbx plugins for blender are horrible and don't support proper skinning (unless this has changed recently).

[EDIT]
Don't ask for the SDK here
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
Remember that the Wii development tools used Maya 7, not free software like blender. Blender has a lot of in-your-face feature controls that distract from the basics of 3d modeling and how the rendering process works.

I'll say this again: if you're going to export models to Blender, you need to build a wrapper for the .blend file format. The dae/fbx plugins for blender are horrible and don't support proper skinning (unless this has changed recently).

[EDIT]
Don't ask for the SDK here
ah...
well that answered a Q I had a long time ago... (maya)

I know...
and no... the plugins still suck balls...
can I get a 3DS format spec doc plz :/
(pm if illegal)

thanx

I've been looking for dae 140 and 141
^(I'll prbly just skip the 140 plugin (my converter)) :/
and I have the 2.48 blender src, but 2.49 has a better blend format

EDIT:
hey Kryal...
could you add this back in plz:
063b is the only one that could do it:
http://lh4.ggpht.com/_IteXPmeC6ek/TFtMAFqw0JI/AAAAAAAABeQ/aP-IDSZ6P8g/063b.jpg
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
BLib has a dae import/export class that is mostly done, but won't work with blender. It properly exports texture coords and bones/skins to Maya/Max.

For the sake of example, here's the decoded 'Shader0' from FitPikachu00:

Code:
----Block 0----
61 FE 00 00 0F - BP Mask 0x0F
61 F6 00 00 04 - KSel[0] (Swap Mode) = ?4 [S1=0,S2=1] 
61 FE 00 00 0F - BP Mask 0x0F
61 F7 00 00 0E - KSel[1] (Swap Mode) = ?E [S1=2,S2=3]
61 FE 00 00 0F - BP Mask 0x0F
61 F8 00 00 00 - KSel[2] (Swap Mode) = ?0 [S1=0,S2=0]
61 FE 00 00 0F - BP Mask 0x0F
61 F9 00 00 0C - KSel[3] (Swap Mode) = ?C [S1=0,S2=3]
61 FE 00 00 0F - BP Mask 0x0F
61 FA 00 00 05 - KSel[4] (Swap Mode) = ?5 [S1=1,S2=1]
61 FE 00 00 0F - BP Mask 0x0F
61 FB 00 00 0D - KSel[5] (Swap Mode) = ?D [S1=1,S2=3]
61 FE 00 00 0F - BP Mask 0x0F
61 FC 00 00 0A - KSel[6] (Swap Mode) = ?F [S1=2,S2=2]
61 FE 00 00 0F - BP Mask 0x0F
61 FD 00 00 0E - KSel[7] (Swap Mode) = ?E [S1=2,S2=3]
61 27 FF FF FF - IREF = 0xFFFFFF
PADDING

---Block 1---
61 FE FF FF F0 - BP Mask 0xFFFFF0
61 F6 E3 78 C0 - KSel[0] (Sel Mode) = 0xE378C? [C0=C,A0=1C,C1=D,A1=1C]
(Enable tex/color/coord map 0 for stage 0, disable stage 1)
61 28 03 F0 40 - TRef[0]   = 0x03F040 [TM0=0,TC0=0,En0=1,CC=0,TM1=7,TC2=7,En1=0,CC1=0]
61 C0 28 F8 AF - ColEnv[0] = 0x28F8AF [D=F,C=A,B=8,A=F,Bias=0,Op=0,Clamp=1,Shift=2,Dest=0]
61 C2 08 FE B0 - ColEnv[1] = 0x08FEB0
61 C1 08 F2 F0 - AlpEnc[0] = 0x08F2F0 [RS=0,TS=0,D=7,C=5,B=4,A=7,Bias=0,Op=0,Clamp=1,Shift=0,Dest=0]
61 C3 08 1F F0 - AlpEnc[1] = 0x081FF0
61 10 00 00 00 - Cmd[0]	   = 0x000000
61 11 00 00 00 - Cmd[1]    = 0x000000
PADDING

--Block2--
61 FE FF FF F0 - BP Mask 0xFFFFF0
61 F7 00 38 C0 - KSel[1] (Sel Mode) = 0x0038C?
61 29 3B F3 BF - TRef[1]   = 0x3BF3BF
61 C4 08 0F EF - ColEnv[2] = 0x080FEF
00 00 00 00 00 - NOP
61 C5 08 1F F0 - AlpEnv[2] = 0x081FF0
00 00 00 00 00 - NOP
61 12 00 00 00 - Cmd[2]    = 0x000000
PADDING
There are three code blocks. GPU display lists must align to 16-byte blocks, which is why they are padded with zeros at the end. Technically, they could all be executed in one batch, but because they have been separated in such a manner it's possible they are used individually.

These commands directly control the Texture Environment (TEV) and the processing of each stage (up to 16).

IMPORTANT! THESE COMMANDS REFERENCE TEXTURE, TEXCOORD AND COLOR MAPS USED IN MATERIALS! This is why you can't just swap out 'shaders'. Materials define the texture layers for a polygon which includes texture coordinates, texture matrices and color sets. Even though you may be using a texture coordinate with an ID of 12, it's been assigned to layer 0 in the material. The 'shader' must then enable coordinate 0 with respect to the material layout.

So, these structures closely regulate the texture environment while processing textures on a material. The material sets global rendering options such as transparency and clipping, while the 'shader' sets fine-tuned options in the color pipeline to simulate shaders.
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
BLib has a dae import/export class that is mostly done, but won't work with blender. It properly exports texture coords and bones/skins to Maya/Max.

For the sake of example, here's the decoded 'Shader0' from FitPikachu00:

Code:
----Block 0----
61 FE 00 00 0F - BP Mask 0x0F
61 F6 00 00 04 - KSel[0] (Swap Mode) = ?4 [S1=0,S2=1] 
61 FE 00 00 0F - BP Mask 0x0F
61 F7 00 00 0E - KSel[1] (Swap Mode) = ?E [S1=2,S2=3]
61 FE 00 00 0F - BP Mask 0x0F
61 F8 00 00 00 - KSel[2] (Swap Mode) = ?0 [S1=0,S2=0]
61 FE 00 00 0F - BP Mask 0x0F
61 F9 00 00 0C - KSel[3] (Swap Mode) = ?C [S1=0,S2=3]
61 FE 00 00 0F - BP Mask 0x0F
61 FA 00 00 05 - KSel[4] (Swap Mode) = ?5 [S1=1,S2=1]
61 FE 00 00 0F - BP Mask 0x0F
61 FB 00 00 0D - KSel[5] (Swap Mode) = ?D [S1=1,S2=3]
61 FE 00 00 0F - BP Mask 0x0F
61 FC 00 00 0A - KSel[6] (Swap Mode) = ?F [S1=2,S2=2]
61 FE 00 00 0F - BP Mask 0x0F
61 FD 00 00 0E - KSel[7] (Swap Mode) = ?E [S1=2,S2=3]
61 27 FF FF FF - IREF = 0xFFFFFF
PADDING
 
---Block 1---
61 FE FF FF F0 - BP Mask 0xFFFFF0
61 F6 E3 78 C0 - KSel[0] (Sel Mode) = 0xE378C? [C0=C,A0=1C,C1=D,A1=1C]
(Enable tex/color/coord map 0 for stage 0, disable stage 1)
61 28 03 F0 40 - TRef[0]   = 0x03F040 [TM0=0,TC0=0,En0=1,CC=0,TM1=7,TC2=7,En1=0,CC1=0]
61 C0 28 F8 AF - ColEnv[0] = 0x28F8AF [D=F,C=A,B=8,A=F,Bias=0,Op=0,Clamp=1,Shift=2,Dest=0]
61 C2 08 FE B0 - ColEnv[1] = 0x08FEB0
61 C1 08 F2 F0 - AlpEnc[0] = 0x08F2F0 [RS=0,TS=0,D=7,C=5,B=4,A=7,Bias=0,Op=0,Clamp=1,Shift=0,Dest=0]
61 C3 08 1F F0 - AlpEnc[1] = 0x081FF0
61 10 00 00 00 - Cmd[0]       = 0x000000
61 11 00 00 00 - Cmd[1]    = 0x000000
PADDING
 
--Block2--
61 FE FF FF F0 - BP Mask 0xFFFFF0
61 F7 00 38 C0 - KSel[1] (Sel Mode) = 0x0038C?
61 29 3B F3 BF - TRef[1]   = 0x3BF3BF
61 C4 08 0F EF - ColEnv[2] = 0x080FEF
00 00 00 00 00 - NOP
61 C5 08 1F F0 - AlpEnv[2] = 0x081FF0
00 00 00 00 00 - NOP
61 12 00 00 00 - Cmd[2]    = 0x000000
PADDING
There are three code blocks. GPU display lists must align to 16-byte blocks, which is why they are padded with zeros at the end. Technically, they could all be executed in one batch, but because they have been separated in such a manner it's possible they are used individually.

These commands directly control the Texture Environment (TEV) and the processing of each stage (up to 16).

IMPORTANT! THESE COMMANDS REFERENCE TEXTURE, TEXCOORD AND COLOR MAPS USED IN MATERIALS! This is why you can't just swap out 'shaders'. Materials define the texture layers for a polygon which includes texture coordinates, texture matrices and color sets. Even though you may be using a texture coordinate with an ID of 12, it's been assigned to layer 0 in the material. The 'shader' must then enable coordinate 0 with respect to the material layout.

So, these structures closely regulate the texture environment while processing textures on a material. The material sets global rendering options such as transparency and clipping, while the 'shader' sets fine-tuned options in the color pipeline to simulate shaders.
hmm...
so what you're basically saying is (in my words):
the "Shaders" (Mat1) are basically a combination of the material and shader??
and, the "Materials" (Mat2) are basically a set of instructions that operate those materials/shaders??
(working in a similar fashon to blenders library materials (1 material shared between objects and shaders))

if that's the case, then Mat1 should just be left as Materials
and Mat2 should be... give me a moment to think up a name on that one...
but it's prbly sonething taken up in blender's logic bricks...

oh wait... nodes... why didn't I see that before
nodes would manipulate the data exactly as you stated before...
not only that, but you can even define custom nodes in blender
^(not being sure of 3DS or Maya)

so yea, mat2 should more aproprietly be called Nodes
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I think you can make model importer easier by completing Kryal's dae importer.
I don't know what should I do to do that, but I think you have more knowledge than I and you can do that IF ONLY you could make C# codes.
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
I think you can make model importer easier by completing Kryal's dae importer.
I don't know what should I do to do that, but I think you have more knowledge than I and you can do that IF ONLY you could make C# codes.
say wut nao...

anyways...
I've almost got a woking method for models alone...
I just need to figure out how face-points work, and how to find their length

once I figure out how everything works, I'll be able to build an exporter to mdl0
 

Kryal

Smash Ace
Joined
May 28, 2009
Messages
560
I think you've missed the point. They're not nodes, they're not materials, they're pseudo-shaders. You can't render a model with them, you can't define geometry with them, but you CAN prepare the hardware environment with them. You can't take a modeling system like blender's and match it to whatever you want. Materials ARE shared between polygons, there isn't a 1:1 ratio of materials to polygons. These 'shaders' are shared for a very different reason.

We're talking about low-level settings for the color pipeline, that may or may not be used by multiple materials. It all depends on the number of layers, and color operations involved. Like I said, they're 'shaders' (look it up) for lack of a better term. Because the Wii doesn't have built-in shaders, developers have to design their own shading operations using the TEV.

And... that's exactly what they do...

Texture shading is done through materials (by the software/hardware), pixel shading is done through these (by the hardware). You can't generate a material from scratch because there needs to be user-defined values. You CAN generate a 'shader' because it mirrors what a material needs in hardware.

So before you go insulting the work of others, please at least know what you're talking about. Do some research on how the Wii GPU operates, and how to manipulate a display list by hand. Only THEN can you preach to others about what you think. Being an 'expert' in blender doesn't mean you know all about 3d modeling and its terms, and certainly doesn't give you boasting rights.
 

Tcll

Smash Lord
Joined
Jul 10, 2010
Messages
1,780
Location
The Gates of Darkness
NNID
Tcll5850
I think you've missed the point. They're not nodes, they're not materials, they're pseudo-shaders. You can't render a model with them, you can't define geometry with them, but you CAN prepare the hardware environment with them. You can't take a modeling system like blender's and match it to whatever you want. Materials ARE shared between polygons, there isn't a 1:1 ratio of materials to polygons. These 'shaders' are shared for a very different reason.

We're talking about low-level settings for the color pipeline, that may or may not be used by multiple materials. It all depends on the number of layers, and color operations involved. Like I said, they're 'shaders' (look it up) for lack of a better term. Because the Wii doesn't have built-in shaders, developers have to design their own shading operations using the TEV.

And... that's exactly what they do...

Texture shading is done through materials (by the software/hardware), pixel shading is done through these (by the hardware). You can't generate a material from scratch because there needs to be user-defined values. You CAN generate a 'shader' because it mirrors what a material needs in hardware.

So before you go insulting the work of others, please at least know what you're talking about. Do some research on how the Wii GPU operates, and how to manipulate a display list by hand. Only THEN can you preach to others about what you think. Being an 'expert' in blender doesn't mean you know all about 3d modeling and its terms, and certainly doesn't give you boasting rights.
I wasn't insuting your work D:
not at all...
I was suggesting a slight correction is all, but I ended up being the one corrected... lol
I had no intention of offending you or making you look bad...
I never do... (to anyone)

sry man...:(
but at least that's one thing cleared up that I kinda know how it works

can you meet me on my thread to continue this discussion :/
I don't really like using the modset thread to talk about the mdl0 format and all it's glories =P

my thread is Universal Model Converter (UMC)
^in case you don't know ;)
 
Top Bottom