sorting out the mhstx feature

If your topic doesn't fit anywhere else, put it here.

Moderator: joepal

sorting out the mhstx feature

Postby robertltux » Mon Feb 06, 2012 7:45 pm

okay since it seems that nobody has written any docs on it im going to ask some questions

the feature revolves around
1 a base texture
2 N "overlay" textures
3 the mhstx file

the format seems to be fairly simple
[
{ 'txt': 'dollvio-left.png', 'dst': (470, 1783) },
{ 'txt': 'dollvio-right.png', 'dst': (1803, 1546) }
]

giving us N lines (one for each overlay texture) with 4 fields the second and fourth field seem to be the biggest concern

each line has the overlay file as the second field and then the fourth seem to be coordinates in some sort of grid (a standard MH skin is 2048X2048)

my big question is what on the overlay should map to the given cords (and which way is the counting??)

do we count from the lower left , upper right or?? and is the given cord pair the center , upper left , lower right or?? of the overlay??

also is there a limit as to how many overlays can be in the file??
robertltux
 

Re: sorting out the mhstx feature

Postby mflerackers » Mon Feb 06, 2012 11:53 pm

The format is standard python, and it's a list of dictionaries. The dictionary defines one sub layer, each layer has a texture (txt) and a destination (dst) into the big texture. The coordinates are just pixels like you would place it in gimp or photoshop into the skin file.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: sorting out the mhstx feature

Postby robertltux » Tue Feb 07, 2012 5:17 pm

mflerackers wrote:The format is standard python, and it's a list of dictionaries. The dictionary defines one sub layer, each layer has a texture (txt) and a destination (dst) into the big texture. The coordinates are just pixels like you would place it in gimp or photoshop into the skin file.


great answer now for the details im looking for
1 Where is the Zero Point for the grid?? (gimp has zero on the upper left)
2 on the overlay what is the point given?? (are we just matching the zero pixels of both images??)


and can i assume that we could have a file with a dozen overlays??
robertltux
 

Re: sorting out the mhstx feature

Postby mflerackers » Wed Feb 08, 2012 12:04 am

Like I said, it's image pixels, so of course left top is 0, 0. And yes you can have as many files as you want in one sub texture file, but it constitutes one layer in the texture eventually.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: sorting out the mhstx feature

Postby ThomasL » Wed Feb 08, 2012 8:55 am

Is it possible to save the modified image to disk? I tried with the Image.save() function. It does save a big tif file, but unfortunately all programs I have say that the file is corrupt.
ThomasL
 
Posts: 1139
Joined: Tue Sep 15, 2009 2:46 am

Re: sorting out the mhstx feature

Postby mflerackers » Wed Feb 08, 2012 9:06 am

It is always saved as tga at the moment, so be sure to give it that extension.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: sorting out the mhstx feature

Postby ThomasL » Wed Feb 08, 2012 10:11 am

OK, now I can save a texture and import it into Blender. But the eyes are always brown. Is there some way to get hold of the modified image? Or a list of subimages, so I can blit myself.
ThomasL
 
Posts: 1139
Joined: Tue Sep 15, 2009 2:46 am

Re: sorting out the mhstx feature

Postby mflerackers » Wed Feb 08, 2012 10:25 am

Actually it is currently only written to the OpenGL texture, not the disk. You can add this in 3_libraries_eye_chooser.py in setEyes, after texture.loadSubImage(img, 0, 0). The plan is to move the layer code to a more general place (Human?), since we won't have only eyes, but I didn't have time to do it yet. Once there are other sub textures besides eyes, we need to keep track of the layers, like we do for clothes etc, so when for example a tattoo is added, the eyes are not erased.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: sorting out the mhstx feature

Postby ThomasL » Wed Feb 08, 2012 12:13 pm

So, can I get hold of the OpenGL texture? It should already be loaded into memory.
ThomasL
 
Posts: 1139
Joined: Tue Sep 15, 2009 2:46 am

Re: sorting out the mhstx feature

Postby mflerackers » Wed Feb 08, 2012 12:26 pm

The data is already in img, which is copied to the texture:

texture.loadSubImage(img, 0, 0)

so just add

img.save("file.tga")
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto


Return to General discussions about makehuman

Who is online

Users browsing this forum: Google [Bot] and 5 guests