PDA

View Full Version : XBMC Skin Compressed Textures Tool


Butcher
2004-02-27, 23:53
i've implemented compressed texture support into the latest build of xbmc. this helps reduce the memory used by skins significantly. it does, however, mean that you will need to mind a few points while creating skins.

all textures used are now power of 2 (i.e 1, 2, 4, 8, 16, 32, etc.) if you supply a non-power of two texture, it will be padded to the next largest power of two. this can result in a large amount of wasted space. for instance a 40x40 texture is padded to 64x64 wasting 2496 pixels - more than half the pixels in the image are wasted. so basically, try to keep your images as close to power of 2 as possible.

png, jpg and gif files are automatically re-compressed on load into an xbox compatible format, this can cause some quality loss, particlarly in the alpha channel. i have added support for dds files to help with this. dds files are loaded without any conversion - whatever you put in the file, you get loaded directly. to create dds files you'll need an app, this util (http://udn.epicgames.com/content/texturespecifications/dxt_tools.zip) includes a plug-in for photoshop that will let you convert your textures to dds. please note xbmc does not support mipmaps. if you want animation, you'll have to use gifs still.

onkel bouncy
2004-02-28, 00:58
sounds interesting.
will test it soon.

ok
my results:
i used the 2 different backgrounds from hifi skin.
these are two of the biggest graphics in my skin.
rescaled it to 512x512 and saved it as 32bit argb.
other modes (16bit,..) seemed to be a too high quality loss.

one background is now about 1mb big (150kb as png).
now i renamed these two dds files into .png and overwrite the original png's.
no problem for xbmc, but i only saved about 1-2 mb free memory.
that is not much for the two biggest graphics.
i don't know if i can use a better way to save the dds files, but if this is the only way every skin would be 10-20mb big.

is there a limit for free space ?

Butcher
2004-02-28, 04:18
you should be mainly using dxt1, dxt3, or dxt5 for graphics - for non-alpha textures, or textures with a single transparent colour use dxt1 as it's half the size of dxt3/dxt5.

if you use 32bit argb you'll not save any memory at all. in fact with the current code a 32-bit argb dds uses more memory than a png as the png will be recompressed to dxt3 by xbmc, while the dds will not.


also a note for skinners:
all current skins will work fine. you don't have to change anything if you don't want to, you can change stuff to dds if you want finer control over which compression method is used. that's the only advantage.
changing things to be power of two is a space saving feature only, they'll work fine if they aren't power of two but you waste some memory.

currently skins are loading very slowly unless you have all the texutres as power of 2 dds, but i'm planning to work on this and sort it so that pngs and jpgs will be just as fast.

Butcher
2004-02-28, 06:54
speed fix is done, pngs loading nice and fast now.

something to consider if you're finding dxt compression causes quality loss - try using gifs for stuff. you only get 256 colours, but xbmc loads them without recompressing so there's no quality loss and they're the same size (once loaded) as dxt3.

Frodo
2004-02-28, 10:43
k
i disabled the compressed textures (for now)
it caused the skins to look very ugly cause of the compression
we'll see if this can be solved, however in the mean time we'll just use uncompressed textures
frodo

Butcher
2004-02-28, 17:24
note for those wanting to keep skin sizes down... easiest way is small textures. size of the file itself is largely irrelevant - you can have a 2k png, but if it's 1000x1000 pixels, it's going to use a lot of memory. also try and use sizes close to but below a power of 2. a 130x100 texture uses twice as much memory as a 128x100 or a 120x100.

Butcher
2004-02-29, 01:44
ok, new plan - i've made a texture compression tool, it's in cvs (sorry no bin, it needs the xdk). if you run it over your skin's media directory it'll compress the files in it a bit more "intellegently" than the xbox-based compression.

usage is quite simple:
xbmctex [-output outdir] [-input indir] [-quality qual]

-input lets you specify the input directory for the converter. it will search for any files named *.png, *.bmp *.jpg *.tga *.dds in the given directory and convert them. if you don't supply an input directory, it uses the current directory.

-outdir lets you specify an output directory for the converted files. files are saved as filename.xpr (e.g. pic.jpg.xpr) so they won't overwrite your files if you use the same input and output directory. if you don't supply an output directory, it uses the current directory.

-quality sets the quality for conversion. there are 5 levels, default is normal quality:
min this will change all textures to the smallest suitable type, regardless of quality implications. quality will generally be poor, but the size is very small also.
low this will aggressively compress most textures, it will generally give some visible artifacts in textures.
normal this gives a good balance of quality and compression. there may be soime small image artifacts, but much less than the low setting.
high this should give virtually no visible artifacts on textures, some very slight effects are possible though.
max this will only compress textures if the result is completely lossless. it gives little to no compression but you are guaranteed not to lose any quality.

i'd recommend skinners choose either normal or high as a quality setting for their skins.

edit: couple of other things.
256-colour images are never compressed, they are kept as 256-colour. if you want a 256-colour non-animated image a png is better than a gif as pngs are preconverted whereas gifs are not (faster loads for png). quality for both is the same.
images less than 1024 pixels (eg. 32x32, 16x64) are never compressed as it doesn't actually save any memory to do so. so your icons and such will not become distorted.

onkel bouncy
2004-02-29, 03:12
sounds better and easier.
i will test it soon.

by the way..
i had a look at internal 02-28 and saw that there is more free memory as it was in 02-27.
any optimizations ?

Butcher
2004-02-29, 03:53
other than compressed textures i don't think so

onkel bouncy
2004-02-29, 13:32
are all graphics loaded on xbmc startup, or only if they needed ?

Butcher
2004-02-29, 21:23
as needed, we haven't got the memory to pre-load everything.

Butcher
2004-03-01, 02:40
new version of the tool does gif processing.
all gif processing is done in lossless mode, so you'll never lose any animation quality.
any duplicate frames in the gif are merged so it's not a problem if you want to repeat frames (a common one is a fully transparent frame to hide the anim). merged frames do not have to be sequential (e.g. if frame number 2 and frame number 10 are identical, they are merged).

Frodo
2004-03-01, 09:28
1 new bug.
screen calibration is messed up if you use compressed textures
frodo

pike
2004-03-01, 12:17
@frodo

i think it's faulty png's that is the problem here. skins that has replaced these images doesnt show this problem. (atleast not project mayhem)

Gamester17
2004-03-03, 17:18
i found this browsing nvidia's developers website (http://developer.nvidia.com), not sure if it can be used but here you go anyway:

dxtc decompression code
http://developer.nvidia.com/object/dxtc_decompression_code.html
this sample provides code to read and decompress .dds files in the dxt1, dxt3, and dxt5 formats.

dxt compression library with source
http://developer.nvidia.com/object/dxt_compress_src.html
includes and image library with dxt compressor with full source written by jason dorie of black box games.

nvidia dxtc texture tools
http://developer.nvidia.com/object/ps_texture_compression_plugin.html

Butcher
2004-03-07, 22:57
the dxt compression is easily done with directx, unfortunately, the xdk is required for the xbox specific texture formats.

pike
2004-03-08, 08:34
there seems to be a problem, i couldn't update the .xpr file while xbmc was running using the latest available cvs code.
i assume this is a bug, because how else to update when using it as a dashboard? http://www.xboxmediaplayer.de/forums/non-cgi/emoticons/cool.gif

Butcher
2004-03-08, 12:32
i fixed the no update while running last night. ;)

pike
2004-03-08, 15:12
ah silly me. i forgot that i uploaded the fixed build, the build that was runnign while i was uploading was the buggy build http://www.xboxmediaplayer.de/forums/non-cgi/emoticons/tounge.gif

anyway, a question:

in cvs/skin/mediacenter/pal/media/ there are some images. are these included in cvs/skin/mediacenter/media/textures.xpr ?

MrMario64
2004-03-08, 19:10
pike > yes they r also included in the xpr.
you can see this when you use the program to make the xpr.

so all thats needed in a skin file is 1 textures.xpr in the media folder, a fonts folder and the rest only .xml files.
gif, jpg etc etc are all in the xpr from all locations containing the media.

this is cool stuff :)

zilvershadow
2004-03-08, 20:42
how do you use textures from skins in python scripts?
is this still supported?

zilvershadow

floink
2004-03-10, 18:10
k i've tried last couple of versions thinking it might have to do with som incompabilities with my pc. but i cant get xbmctex to work. i use this from cmd promt: xbmctex.exe -input "c:\xbmc\skin\retro\media" -output "c:\xbmc\skin\retro\media\textures.xpr" -quality "high" it calculates trhu all the files but in the end it don't generate anything.
when/if i specify xbmctex to use an empty dir for both in and out it generates a 1kb textures.xpr and reports on size gain. same result from xbmctex_gui.exe.
/floink

Butcher
2004-03-10, 18:38
can you zip up your media directory and let me have a copy of it?

edit: also, which version of directx do you have and which version of windows? i assume there are no meaningful error messages generated...

floink
2004-03-10, 19:48
done. check .it site. don't know if i can supply any other info on ver of windows.
/floink

Butcher
2004-03-10, 19:56
by version of windows i just mean which of 2k/xp/etc. as for directx version, you should be able to tell that by doing start->run and typing dxdiag then hit enter.

nb: xbmctex is not supported on windows 9x/me. you need 2k or xp (nt4 might also work).

floink
2004-03-10, 21:19
i included a file generated by dxdiag in the above mentioned file. i was thinking maybe windows had a similar generator :)
sorry i forgot to mention that files i upload to xboxmediacenter.it ends up in the skins folder by default.
hope u can find something. btw winxp sp1, dx9.0b.

Butcher
2004-03-10, 21:47
ok, it crashed the tool on my machine, i'll fix it shortly.

stokkes
2004-03-11, 00:59
butcher,

using latest cvs (03-10-2004), i have the textures.xpr in the mediacenter\media directory, however, when i load xbmc, nothing is displayed. it's just a black, skinless menu. totally black with the time on the bottom right. if i copy the .png files from the source (like old builds without the texture compression), it works fine.

any ideas?

just updated the cvs and compiled a few minutes ago, same problem..

-- stokkes

Butcher
2004-03-11, 01:16
floink: tool is fixed, it was crashing on single-frame gifs. btw, you should change your 65 high textures to 64 high - they're half as big that way.

stokkes: could be all sorts of things, do you get anything in the log?

stokkes
2004-03-11, 01:25
texture manager unable to load file:q:\skin\mediacenter\media\blue_rectangle_musi c.png

i get that for every single file

that's really it, nothing odd, unless i'm missing something.

edit:

click here (http://members.rogers.com/stokkes/xbmc.log) for my log file.

stokkes

Butcher
2004-03-11, 01:40
looks like it's failing to open textures.xpr at all.

edit: i've added some more error reporting to the loader, could you grab the latest code when anon cvs updates and give it another try?

stokkes
2004-03-11, 01:41
that's not the only thing..

when i try to view the osd, i get this:

10-03-2004 18:26:02 texture manager unable to load file:q:\skin\mediacenter\media\osd-pnl-bar.bmp
10-03-2004 18:26:02 texture manager unable to load file:q:\skin\mediacenter\media\xb-ctl-nibv.bmp

any ideas? heh

this is bizarro

stokkes

Butcher
2004-03-11, 01:52
btw, you're loading off a hdd right?

stokkes
2004-03-11, 01:55
yes, i'm experimenting with this right now, but without any luck.

first, i had xbmc run as dashboard, home directory f:\xbmc

now i'm trying to run it as a simple app from xbmp , still located in f:\xbmc, but i get the same errors..

quite frustrating ;)

-- stokkes

stokkes
2004-03-11, 02:06
welp, fixed it..

i nuked my cvs directory and re-downloaded everything.. not sure wtf went on with the files in my cvs directory, but that seems to have fixed both the texture and the osd problem.

stokkes

stokkes
2004-03-11, 02:09
one last thing butcher..

your xbmctex, great util.. however, is there anyway that it can be run without initializing the d3d device?

you see, i often do some compiling, playing around from my office through remote desktop. however, when trying to run xbmctex.exe through remote desktop, i get a cannot init d3d device: 830283737 (number isnt exact, but it's a garbage number after device:) .. anyway you could fix this?

Butcher
2004-03-11, 02:24
um, i kinda need d3d to do the texture conversion http://www.xboxmediaplayer.de/forums/non-cgi/emoticons/tounge.gif

stokkes
2004-03-11, 02:25
well, guess that puts me in my place then ???

floink
2004-03-11, 08:56
worx now, thx for fixing. i really haven't put any time into correcting my 65 to 64 textures and such, cause i thought maybe ur magic tool would do that for me http://www.xboxmediaplayer.de/forums/non-cgi/emoticons/tounge.gif . will try to do my homework better. damn if i knew this before starting doing skinnning.

Butcher
2004-03-11, 15:23
i could have the tool "fix" textures, but you run the risk of quality loss - in general it's going to be better to use photoshop or such to do any resizing so you can see how it affects the output.

floink
2004-03-11, 15:26
see updated retro skin on .it using textures.xpr with some "fixed" images.

floink
2004-03-12, 22:18
k butcher i've got another challenge for u ;) i _think_ xbmctex messes with my gifanim images. i've got a ffwd anim that's supposed to have a 240sec (longest possible frame pause) on the end frame. this is to 'emulate' an gifanim that only plays once. but after using xbmctex that last frame pause is removed and the anim loops without any pause. strange thing is i have this pause on play/pause-gfx and ffwd/rew-gfx but only the ffwd image is affected after compression. i have double checked my original gfx and in uncompressed state tha prob is gone. and i can't find any differences in this image and the other three. i'll upload the original images so u can have a look.
/floink

tober
2004-03-13, 04:19
i don't know if i was the only one having this problem, but the utility would run on my main machine but not do anything (works fine on one of my other machines). it looked like it wasn't initializing the d3d device (no error messages or anything though). i ran dxdiag and it didn't report any problems.

changing d3ddevtype_ref to d3ddevtype_hal in xbmctex.cpp seems to have fixed my problem.

i am running:
xp sp1
dx9.0b
nvidia 53.03 drivers

Butcher
2004-03-13, 16:16
xp doesn't come with a reference rasteriser by default, you'd probably need the dx sdk installed to get one.
i deliberately didn't use d3ddevtype_hal to avoid problems with graphics card drivers.

onkel bouncy
2004-03-15, 20:52
is it possible to decompress textures.xpr in it's source graphics ?

Butcher
2004-03-16, 13:03
yes it's possible, i may add an option to the tool to allow it to unpack textures.

onkel bouncy
2004-03-16, 17:06
please post when it's done.

Butcher
2004-03-16, 19:27
don't hold your breath. ;)

also note that it will unpack everything to tga files - anims will be skipped.

onkel bouncy
2004-03-17, 11:58
this is fine.
hmmm...
it's hard to edit and rename theese files for testing.
i think it's nearly impossible for new skinners to make a new skin without having the original graphics.

is there a way to make the original graphics public for new skinners ?

Butcher
2004-03-17, 13:18
which original graphics?

onkel bouncy
2004-03-17, 13:53
the original graphics of the default skin.
it's a lot easiere for skinners to see and edit theese files first, before making a complete new graphic-set.
e.g. i can't use the osd of other skins.
it's impossibel with one texture-file.

Butcher
2004-03-17, 13:56
they're in cvs.

onkel bouncy
2004-03-17, 13:59
really ?
but not in cvs build.
i will get the latest cvs.

pike
2004-03-17, 16:34
@ onkelbouncy

cvs is not the same as build.
cvs is the site where all the sourcecode is hosted!

cvs-build is another story. there's no point in distributing the gfx 2 times, so only the compressed gfx was included (to the best of my knowledge, remember, we don't make builds)

onkel bouncy
2004-03-17, 17:20
nearly every skinner starts with modifiying other skin-graphics.
but with only one texture-files it's impossible.
it's the same as getting a zipped sourcecode without having any tools to unzip.
the only way is to download each file here:
http://cvs.sourceforge.net/viewcvs....ia (http://cvs.sourceforge.net/viewcvs.py/xbmc/xbmc/skin/mediacenter/media/)

but getting each file (170) is not nice.
is there a way to download all media-files in one download ?

Butcher
2004-03-17, 18:28
use a cvs client, such as wincvs or tortoisecvs.

onkel bouncy
2004-03-18, 09:41
thanks.
i've used wincvs to download all files.

LiGhTfasT
2004-04-24, 03:14
could someone upload the dell skin files to allxboxskins.com, these xpr files are a lot of messing around... i'll stick to .pngs etc

Hullebulle
2004-04-24, 04:01
could someone upload the dell skin files to allxboxskins.com, these xpr files are a lot of messing around... i'll stick to .pngs etc
shadow_mx uploaded the file here (http://shadow.gruposid.com/xbmc/mediacenter_files.rar). he says it is prettx uptodate. :)

wabidwoveren
2004-05-01, 00:07
all skinners pm me, please, starting a new site, just for skinners, so we can all work together. thank gamster17 for that.

Hullebulle
2004-05-01, 01:18
all skinners pm me, please, starting a new site, just for skinners, so we can all work together. *thank gamster17 for that.
wabid if you need a host i can offer something like skins.xboxmedicenter.de (some space and traffic).

xeta
2004-06-29, 22:27
all skinners pm me, please, starting a new site, just for skinners, so we can all work together. *thank gamster17 for that.
tried to do the same a while back with xetasoft. i kinda fell outta the scene due to some graphical and web work that needed to be done. i'm willing to start xetasoft back up as a xbmc skinner site if needed.

Hullebulle
2004-07-02, 23:26
btw since my hoster raised my traffic to an amount i never will use i can offer hosting to all ppl contributing to xbmc on www.xboxmediacenter.de (subdomain with your own account ie. skins.xboxmediacenter.de). so if anybody need space pm me. :)

Megabyte
2004-07-17, 07:11
where can i get the round blus circle that behind the home-mymenuitem.png?

i downloaded the rar file here that had all the files but shouldnt there be that image alone so people can put there own graphic over it?

thanks,
joe

yngvebn
2004-07-22, 11:10
is the unzip-function implemented yet?

Gamester17
2004-07-22, 14:49
is the unzip-function implemented yet?
no

yngvebn
2004-07-23, 09:38
so are there no way to extract the fonts from the xpr-files? i'm working on a skinning-app, and i want it to be the skinner for xbmc :)

and also.. can i compress ttf-fonts with this tool?
if not, what kind of fonts are used?

Gamester17
2004-07-23, 16:07
so are there no way to extract the fonts from the xpr-files?sorry no, becaue it's not been coded/designed to do so. like butcher already said it could be coded to do so but no dev has (plans), yet

can i compress ttf-fonts with this tool? if not, what kind of fonts are used?no. i'm not expert but i believe you need a tool from the xdk for that, please search this forum from the beginning

PeterPL
2005-02-11, 11:52
is it possible to unpack textures.xpr ?

C-Quel
2005-02-11, 12:14
no! but if you speak to tecmo they might be able to provide you with a tool soon. :o

EqUiNoX
2005-09-10, 03:39
ive written a tool to unpack xpr's just need to convert the created files from d3d format back to something more useable.

equinox

binhaus
2005-09-18, 07:37
ive written a tool to unpack xpr's just need to convert the created files from d3d format back to something more useable.

equinox
wop sound great .. can you pm me one for testing .. thank

mikenewf
2005-09-19, 02:05
k sounds like i' m in the right place , i also am making a skin and need to open the textures.xpr and replace some .png and add some .png of my own to it !!!!! ........can someone tell me were to find a program that can do this !!!!!!!!! thxs great work ppl :kickass: :bowdown:

EqUiNoX
2005-09-19, 02:12
hi,

currently there is no way (until i finish this project) to extract xpr's back to images. xpr's are at the moment considered as a form of protection from people modifying/copying skin images.

equinox

mikenewf
2005-09-19, 03:18
thx for the reply, when do u thing you'll have it done??? could u pm when u get it done if you have a chance. all i want to do is change the home-focus.gif and make it red, and also i have config pbs, music videos, xbox-saves and the newly integration linksboks and a couple others so they are config right in the main menu screen now and i would like to have pictures for each one !!!!!! thxs for every ones hard work xbmc is truly pimped out

HaggleLad
2005-11-08, 16:41
ive written a tool to unpack xpr's just need to convert the created files from d3d format back to something more useable.

equinox
any news on this alleged xpr unpacking app?

this is highly sought after!! especially now the xbmc skinning app (beta) has been released.

if you dev'd one equinox then you're the man, pm me for testing please.