XRF XML Tutorial - By Don Von Free Credits

Don Von Alpha Dom
by Don Von Alpha Dom · 9 posts
11 years ago in Basic Creator Help
Posted 11 years ago · Author
XRF's can be explained pretty easily. An XRF file tells your IMVU product which files to use as textures and which files to use as opacities. An IMVU product normally has several XRF files, one XRF file for every texture used and one XRF file for every opacity used. It is important to know how XRF files work, so you can fix them when they break and so you can manipulate them to create much more complex or KB saving products.

An XRF file is written in XML code. You can learn how to read XML code by reading my tutorial on how to read XML: viewtopic.php?f=105&t=7077

IMVU's create mode stores XRF's inside of XRF slots. XRF slots start from number 0. Below you will find that I have posted the XRF XML code for several XRF files. Notice below that the code is the same for every file, except that the file names inside of the MAP tags' TYPE attribute change. (Example: Texture00.jpg, Texture01.jpg, Texture02.jpg) (Example: Opacity02.jpg, Opacity02.jpg, Opacity02.jpg) The first MAP tag's TYPE attribute holds the name of the texture image which gives the mesh its color, and the second MAP tag's TYPE attribute contains the name of the opacity image which gives the image its translucency (ability to see through the image). You can change these file names freely by opening the XRF files in notepad. Note: Not all products have the same file names.

Here is the XRF code for a file in slot 0:
Code
<HEADER MAGIC="XRF" VERSION="918" />
<MATERIAL NUMMAPS="2">
    <AMBIENT>0 0 0 0</AMBIENT>
    <DIFFUSE>0 0 0 0</DIFFUSE>
    <SPECULAR>0 0 0 0</SPECULAR>
    <SHININESS>0</SHININESS>
    <MAP TYPE="Diffuse Color">Texture00.jpg</MAP>
    <MAP TYPE="Opacity">Opacity00.jpg</MAP>
</MATERIAL>


Here is the XRF XML code for a file in slot 1:
Code
<HEADER MAGIC="XRF" VERSION="918" />
<MATERIAL NUMMAPS="2">
    <AMBIENT>0 0 0 0</AMBIENT>
    <DIFFUSE>0 0 0 0</DIFFUSE>
    <SPECULAR>0 0 0 0</SPECULAR>
    <SHININESS>0</SHININESS>
    <MAP TYPE="Diffuse Color">Texture01.jpg</MAP>
    <MAP TYPE="Opacity">Opacity01.jpg</MAP>
</MATERIAL>


Here is the XRF XML code for a file in slot 2:
Code
<HEADER MAGIC="XRF" VERSION="918" />
<MATERIAL NUMMAPS="2">
    <AMBIENT>0 0 0 0</AMBIENT>
    <DIFFUSE>0 0 0 0</DIFFUSE>
    <SPECULAR>0 0 0 0</SPECULAR>
    <SHININESS>0</SHININESS>
    <MAP TYPE="Diffuse Color">Texture02.jpg</MAP>
    <MAP TYPE="Opacity">Opacity02.jpg</MAP>
</MATERIAL>


The same can be said for the Texture Map XRF XML code, which you can see below. Notice that only the file names change:

Code
<HEADER MAGIC="XRF" VERSION="918" />
<MATERIAL NUMMAPS="1">
   <AMBIENT>0 0 0 0</AMBIENT>
   <DIFFUSE>0 0 0 0</DIFFUSE>
   <SPECULAR>0 0 0 0</SPECULAR>
   <SHININESS>0</SHININESS>
   <MAP TYPE="Diffuse Color">Texture00.jpg</MAP>
</MATERIAL>


Code
<HEADER MAGIC="XRF" VERSION="918" />
<MATERIAL NUMMAPS="1">
   <AMBIENT>0 0 0 0</AMBIENT>
   <DIFFUSE>0 0 0 0</DIFFUSE>
   <SPECULAR>0 0 0 0</SPECULAR>
   <SHININESS>0</SHININESS>
   <MAP TYPE="Diffuse Color">Texture01.jpg</MAP>
</MATERIAL>


Code
<HEADER MAGIC="XRF" VERSION="918" />
<MATERIAL NUMMAPS="1">
   <AMBIENT>0 0 0 0</AMBIENT>
   <DIFFUSE>0 0 0 0</DIFFUSE>
   <SPECULAR>0 0 0 0</SPECULAR>
   <SHININESS>0</SHININESS>
   <MAP TYPE="Diffuse Color">Texture02.jpg</MAP>
</MATERIAL>


You can have 2 sections of a mesh share the same opacity and or texture by giving them the same XRF XML file, or by setting their MAP TYPE to the same image file inside of the XML.

Tip: Map files (texture images and opacity images) are almost always of type JPEG (*.jpg). PNG is also acceptable for slightly better resolution. JPG is best for low KB products. PNG is best for high resolution products. TGA files are also acceptable. TGA files give the most KBs, but are easiest for IMVU to render and are considered industry standard for most 3D engines. (which is why the original IMVU avatars use TGA files.) So, if you want products with low kbs, then use JPGs. If you want products with high resolution, then use PNGs. If you want products that load fast and lag less, then use TGAs.

Warning: GIF files and other types of image files are NOT accepted by IMVU.

You might be saying to yourself right now, "But Don, what about the rest of the data? There is so much text and numbers in that code you wrote above! What is that for?".

Answer: Simple my young developer. IMVU does not use 99% of the data that you find in most XRF files. Most of the data is there for other 3D programs that do use such data. In fact, some XRF files that you open might have 10 times the code that I wrote, but all of it is unnecessary and is not used within IMVU. You might as well stick with the bare minimum code to save a few bytes of data

Tip: If you open an xrf file and it contains a bunch of random symbols and gibberish instead of XML as displayed above, then that means the xrf is really a crf (a compiled XRF file). To convert the CRF back into a XRF, you can use the IMVU Mafias texture map decompiler: buysell/single_ad.php?ad_id=1933
Posted 7 years ago
Keep up the training please Don.

thank you
Posted 6 years ago
I dam sure learnt something today, keep up the good work.
Posted 6 years ago
that was very informative. appreciate those tips.
Posted 5 years ago
Don Von Alpha Dom wrote:
You might be saying to yourself right now, "But Don, what about the rest of the data? There is so much text and numbers in that code you wrote above! What is that for?".Answer: Simple my young developer. IMVU does not use 99% of the data that you find in most XRF files. Most of the data is there for other 3D programs that do use such data. In fact, some XRF files that you open might have 10 times the code that I wrote, but all of it is unnecessary and is not used within IMVU. You might as well stick with the bare minimum code to save a few bytes of dataTip: If you open an xrf file and it contains a bunch of random symbols and gibberish instead of XML as displayed above, then that means the xrf is really a crf (a compiled XRF file). To convert the CRF back into a XRF, you can use the IMVU Mafias texture map decompiler: buysell/single_ad.php?ad_id=1933
Glad I saw this post. Makes it so much easier to look at all the code and not feel overwhelmed when you only understand a fraction of it. :working:
Posted 5 years ago
thanks for the tutorial :D
i appreciate it a lot!
thanks again
Posted 5 years ago
Thanks Don that's really helpful. Good luck for future threads I'm sure they'll be as helpful or more than this one. :dancingapple:
Posted 5 years ago
Something good to start understanding all that

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT