XBMC Community Forum
Compressed textures for FanArt - testing here with XBMC 2009-10-05 (r23431) or newer - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: XBMC General Help and Support (/forumdisplay.php?fid=111)
+--- Thread: Compressed textures for FanArt - testing here with XBMC 2009-10-05 (r23431) or newer (/showthread.php?tid=59115)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


- avus m3 - 2010-12-03 01:51

I haven't tried this with my MySQL setup yet but from reading everyones responses why is not the default behavior of xbmc?


- turbobuickguy - 2010-12-06 22:45

Are the instructions posted here still valid for XBMCLive RC2? (I have a clean install on a Zotac HD-ID11)

I have tried following them, and when I get to "sudo sh cudatoolkit_2.3_linux_32_ubuntu9.04.run" I receive an error. "Syntax error:redirection unexpected" to be exact. I am executing this command from my /home/user/download directory, using my user account.

Solving this, is probably something incredibly simple, but I am very unfamiliar with linux to be honest... although I can follow directions well enough to get me into trouble Confused. What I did notice, is that the version of linux showing in my putty window is 10.04, I don't know if that means that the 9.04 version of cuda tools can be used or not, or if I get a newer version, if all the remaining steps here will get me the results I want (converting, and using DDS Fan Art). Any help to get me pointed in the right direction is greatly appreciated!!


IceNine Wrote:Well that is a project that took me almost a whole day. Hopefully I can help you out!

First what you will need:
nVidia Texture Tools
CUDA Tools
g++ and gcc versions 4.4 and 4.3
libjpeg and dev files
cmake

Code:
sudo apt-get install g++ g++-4.3 gcc-4.3 libjpeg62-dev cmake
cd ~
wget http://nvidia-texture-tools.googlecode.com/files/nvidia-texture-tools-2.0.7-1.tar.gz
wget http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/cudatoolkit_2.3_linux_32_ubuntu9.04.run
tar -xvzf nvidia-texture-tools-2.0.7-1.tar.gz
(the cuda extension for nvcompress won't compile on 4.4 for some reason, which is what comes with Ubuntu 9.10 Karmic. If you are running 9.04 you're fine.)
CUDA isn't strictly needed, nvcompress will still work pretty quickly with the -fast option, but CUDA still seems fastest. If you don't want to use CUDA, don't install the cuda tools because the texture tools won't compile without some extra work with g++ 4.3.

To install the CUDA tools, in terminal go to the directory where you downloaded the CUDA file I linked and run

Code:
sudo sh cudatoolkit_2.3_linux_32_ubuntu9.04.run

Now you have to add the cuda libraries to your shared libraries by editing a file. I use nano for my text editor, feel free to use whatever you like.

Code:
sudo nano /etc/ld.so.conf

and add this line to the end

Code:
include /usr/local/cuda/lib/

After you save the file, run

Code:
sudo ldconfig -v

to update the libraries.

Assuming you want CUDA acceleration, after you have installed g++ and ran the CUDA tools installer, move to the nvidia-texture-tools directory (wherever you unzipped it to) and run

Code:
./configure


You should see in the list of things that come up that JPEG is found and CUDA is found. Something like this:

Code:
-- Configuring nvidia-texture-tools 2.0.7-1
-- Setting optimal options
--   Processor: i686
--   Compiler Flags:  -march=i686
-- Looking for OpenGL - found
-- Looking for GLUT - found
-- Looking for DirectX - not found
-- Looking for GLEW - not found
-- Looking for Cg - not found
-- Looking for CUDA - found
-- Looking for Maya - not found
-- Looking for JPEG - found
-- Looking for PNG - not found
-- Looking for TIFF - not found
-- Looking for OpenEXR - not found
-- Use thread library: -lpthread
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xbox/Downloads/nvidia-texture-tools/build

-e Your configure completed 033[92msuccessfully033[0m, now type 033[1mmake033[0m

If that works well, and you are on Ubuntu Karmic then you need to set up g++ to compile using version 4.3.

Code:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 --slave /usr/bin/g++ g++ /usr/bin/g++-4.3 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.3

You can confirm that this finished right by running
Code:
sudo update-alternatives --display gcc

Now set the system to run version 4.3 instead of 4.4.

MAKE SURE TO CHANGE THIS BACK WHEN YOU ARE DONE.

Code:
sudo update-alternatives --config gcc

You should see something like this:

Code:
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path              Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-4.4   44        auto mode
  1            /usr/bin/gcc-4.3   43        manual mode
  2            /usr/bin/gcc-4.4   44        manual mode

Press enter to keep the current choice[*], or type selection number:

In this case you would type 1 and hit enter. Just put whatever number you have to switch to version 4.3.

After this is done, in the nvidia-texture-tools folder, type

Code:
sudo make

and, assuming everything compiled ok (I got some warnings in the compile process but it did finish and everything seems to work fine) type

Code:
sudo make install

and it should install the files properly.

At this point you can change your default compiler back to version 4.4 by running the same command as above and set back to auto (option 0 in the example).

Try to run nvcompress (you should be able to do this anywhere in the command line now) and if you get the typical list of options than you are good to go. Initially I had some issues with nvcompress not seeing the needed shared libraries. You'll know if you have this same problem if, when you try to run nvcompress, you get an error saying it can't find some shared library. If this is the case, follow the next instructions.

Move to the /usr/local/bin directory and check if nvcompress is really not seeing libraries.

Code:
cd /usr/local/bin
ldd nvcompress

You should see a list of libraries that nvcompress depends on. If you have any entries that say Not Found at the end than some libraries aren't being seen. I was missing one (libcudart.so.2) at the end of all these steps, but I fixed this by copying the file to a library I knew was working.

Code:
sudo cp /usr/local/cuda/lib/libcudart.so.2 /usr/local/lib/libcudart.so.2
sudo ldconfig -v

You only need to do something like this if nvcompress gives an error that it can't find a shared library.

Hopefully this should be thorough enough and I didn't forget anything. Pretty much all of this info I found digging around on Google. If anyone runs into any problems that I didn't cover here I can try to help, but I'm not much of a linux guru.



- ashlar - 2010-12-12 12:18

Two questions on this:

1) to update an existing library to use this I need to completely clean and rescan?

2) need to configure a new Asrock ion 3D. In this case if I add the relevant advancedsetting entry before scanning the library I should be covered, right?


- Jimmer - 2010-12-12 12:56

You don't need to rescan. Just enable it in advancedsettings.xml

All you need to do is browse through your existing library. First time you do this it will cache your art as a dds file. Next time you browse over something, it will use the dds version. On the downside you will have to browse your whole media collection to bring up your art for each film and make the dds version. It does not automatically created dds art for you... On the upside, you only have to do it once!

Jim


- ashlar - 2010-12-12 18:06

Thanks Jimmer for your very quick and clear reply. Much appreciated.


Loading DXT1 compressed texture from DDS file - galvanash - 2010-12-15 05:39

I know xbmc doesn't support xbox anymore... But if there is a developer that might be willing to help out with what is probably a simple problem for those that actually know directx programming...

http://www.xbmc4xbox.org/forum/viewtopic.php?f=24&t=1413&p=15058#p15058

Any help at all would be greatly appreciated.


- jmarshall - 2010-12-15 06:21

Why not use D3DXCreateTextureFromFile or whatever it is - the XDK contains functions that'll likely be able to load .dds images. Take a look through the XDK documentation.

If you can't do that then it should be basically the same as directx on windows. See TextureDX.cpp in particular.

You probably need to watch the pitch and height requirements, though the total size you're copying seems fine (4bits/pixel for DXT1). At any rate, the debugger will probably at least tell you where it's crashing - one presumes in the memcpy. Check that you're not running off the end of image.GetData() or lr.pBits. lr.Pitch might be somewhat useful for giving you a clue, but don't rely on it - it does funny things on DXTn textures. It might be worth running a for loop (you'll need it to pack it out to power of 2 anyway) - see Texture.cpp for the bit that packs out the texture.

Something else you'll likely run into (when it's not crashing at least) is that xbox may require that DXT1 be swizzled, I'm not sure - you may be able to "just" modify the code in DirectXGraphics.cpp or whatever it is for this (it unswizzles and unpacks DXT1,3,5).

That's about all the help I can give. Have fun!

Cheers,
Jonathan


- galvanash - 2010-12-15 07:51

jmarshall Wrote:Why not use D3DXCreateTextureFromFile or whatever it is - the XDK contains functions that'll likely be able to load .dds images. Take a look through the XDK documentation.

Thank you! I switched to using this call (much simpler). It is working (i.e. the call is successful - returns D3D_OK), and it is no longer crashing... But nothing gets drawn (the fanart background is just white). Oh well, Ill keep trying to figure out whats happening. Thank you very much for the pointers.

EDIT: SUCCESS!!! Thank you very much - you got me on the right track. I had everything right after I switched to using D3DXCreateTextureFromFile (as you suggested), but I wasn't settings the width and height in the CPicture.m_info struct (imageLib does that part in the normal code path - I missed it). I just set the width and height and xbmc started displaying the DXT1 texture. Yay! Now I just got to test and test and test.... Smile


- acbeef - 2010-12-16 16:45

Just a quick question ... I didnt see it posted
Does the dds conversion happen on cutom backgrounds for skins or do you have to convert those images manually

Ie: conditional weather folder, movies , tvshows...etc

Thx


- ashlar - 2010-12-19 16:02

acbeef Wrote:Just a quick question ... I didnt see it posted
Does the dds conversion happen on cutom backgrounds for skins or do you have to convert those images manually

Ie: conditional weather folder, movies , tvshows...etc

Thx
+1 on this question. Is it worth doing it?