PDA

View Full Version : Modding InfoCenter - Understanding The TXTR File and Formats


JWoods
25th Aug 2005, 09:05 PM
>>> MODDING INFOCENTER <<<

Understanding The TXTR File and Formats





DISCLAIMER: The "Modding InfoCenter" threads are NOT tutorials: they are intended to help average-experienced object creators performing specific tasks, or to give users a deeper in-sight on specific modding-related subjects. So, don't expect to find step-by-step explanations, to be performed "blindly". Please DO NOT REPOST the following info, or part of them, on other sites.
All the "Modding InfoCenter" threads are created and maintained by Numenor and JWoods. Everyone is welcome to post his own questions or additional information about the specific thread subject.

SUMMARY: This article gives in depth details about "Texture Format’s", their uses, Mipmap building, DDS plug-ins, tools and their use.The provided snapshots have been taken from UVMapper Pro and SimPE v.044.

:deal: This InfoCenter article is also provided in PDF format. To view it, we strongly suggest to download the Foxisoft PFD Viewer (http://www.foxitsoftware.com/pdf/rd_intro.php): it's free and small, less than 1Mb!

-------------------------------------------------------------------------------------




DDS Utilities and Tools

DDS Utilities allows our Mipmaps to be “automatically” built when importing a DDS format texture.

DDS Plug-ins when installed in our PhotoShop paint program gives us the versatility and usage of the DDS (image) texture format.

:here: FAQ: DDS Plug-ins can only be installed in PhotoShop paint programs. If the DDS plug-in is used with PaintShop Pro, it will cause an error every time a "Save as... .dds" is attempted.


Mipmaps

What is a Mipmap? A Mipmap is a technique used to obtain a high level of detail represented by a two dimensional texture that is placed on a three dimensional mesh. A Mipmap is a composition of multiple images derived from one texture map at different resolutions to represent surface textures at varying distances from the viewer's perspective. The initial (largest) texture is placed in the foreground and progressively smaller ones recede toward the background. Though you can not see this in-game these maps are constantly changing as you zoom in and out. Each scale difference is defined as a MIP map level. MIP mapping helps avoid unwanted rough edges that sometimes can be noticed with other image (texture) formats at different resolutions.

:here: FAQ: A Mipmap is composed of a series of images that are divisible by 2.

Other image formats that can be used in SimPE packages are: png, bmp, gif, tiff, wmf, emf, and jpg. The most widely used for a Sims2 package is the “png” format image due to its low resource and high detail. It is second only to DDS format and therefore very antiquate for usage in creating textures for our packages.


DDS Utility Formats

When you install DDS utilities you are obtaining multiple image/texture formats.

ExtRaw8Bit: Used mainly for shadow textures (grey scale) 8 bits per pixel.
Raw8Bit: Used mainly for shadow textures (grey scale) 8 bits per pixel.
Raw24Bit: Simple color texture format, 24 bits per pixel RGB color mode.
ExtRaw24Bit: color texture format, 24 bits per pixel RGB color mode.
Raw32Bit: Higher quality “Raw” color texture format 32 bits per pixel in RGBA color mode with 8 bits of color.
DXT1: Most commonly used for “normal” high quality textures (DXT1 does not support texture alpha data).
DXT3: Most commonly used textures utilizing a single “alpha” channel. DXT3 is most suited for textures with sharp alpha transitions, between translucent and opaque areas.
DXT5: Most commonly used for textures utilizing a varying amount of transparency. DXT5 formatted textures use an interpolated alpha scheme, they generally produce better results for transparency gradients than DXT3.

:here: FAQ: Raw means “Unprocessed”.




Building a Mipmap

In our example our initial largest texture is 128 x 128. It is not large enough to cover the mesh and we are experiencing “stretching” and “blurring” so we would like to use a larger texture to eliminate this problem.

http://thumbs.modthesims2.com/getimage.php?file=118693&stc=1

We decide that due to our larger mesh size that we need to make our largest “Mipmap” texture 512 x 512. The first step is to equate our new number of Mipmap levels. Multiplying by 2 we come up with the new Mipmap level amount of 10 so we need to enter “10” in the “Mipmap Level” field. Next, we need to click “Build”.

http://thumbs.modthesims2.com/getimage.php?file=118694&stc=1

Now we can “Import” our new 512 x 512 texture map, “Update all Sizes”, “Commit” and “Fix Integrity”.

http://thumbs.modthesims2.com/getimage.php?file=118695&stc=1

After we “Fix Integrity”, save and re-open our package we can see that our new mipmap is built by looking at the “Size” (see image below).

http://thumbs.modthesims2.com/getimage.php?file=118696&stc=1








-------------------------------------------------------------------------------------

OTHER USEFUL RESOURCES

Modding Infocenter Index (http://www.modthesims2.com/forumdisplay.php?f=333) - Comprehensive list of all the InfoCenter threads
Object Creation Workshop and Repair Center (http://www.modthesims2.com/showthread.php?t=82084) - If your object doesn't work, no matter what you try
Colour Options for "EP-ready" packages (http://www.modthesims2.com/showthread.php?t=42014) - About the texture linking tecniques
Sims 2 start to finish Object Creation Tutorial (http://www.modthesims2.com/showthread.php?t=59293) - Learn how to create your own object.




-------------------------------------------------------------------------------------




.

suiryuue
25th Aug 2005, 09:13 PM
Thanks JWoods. You must have read my mind. I was going to ask how to create the larger texture.

Inge Jones
1st Oct 2005, 07:44 PM
I'm afraid I didn't understand: "The first step is to equate our new number of Mipmap levels"

I have a largest texture image of 512x256 and I want to use one of 512x512. If the mipmap level currently is 9, what should I change it to?

JWoods
1st Oct 2005, 07:50 PM
Inge if your largest MipMap desired is 512*512 then there will end up being 10 levels:
512*512
256*256
128*128
64*64
32*32
16*16
8*8
4*4
2*2
1*1

Inge Jones
1st Oct 2005, 07:53 PM
In that case SimPe must have sprung a bug. I had a feeling it would turn out to be 10 so I already tried it, but SimPe says I used an invalid parameter. Never mind I'll check if there's a newer version yet.

Later: I'm still getting the error message with the latest SimPe so I have reported it to Quaxi.

Inge Jones
2nd Oct 2005, 02:11 PM
I know what's wrong now. The image in the file I am editing is not square, it's 256x512. SimPe doesn't want to know. If I try exactly the same moves on a square texture file, it's perfectly happy. Maybe I should enter 9.5?

JWoods
2nd Oct 2005, 02:31 PM
Inge: Regardless of size it should be divisible by 2 with the first entry being 1*1.

1x1
2x1
4x2
8x4
16x8
32x16
64x32
128x64
256x128
512x256

See how this still ultimately = 10?

Inge Jones
2nd Oct 2005, 02:36 PM
Maybe SimPe doesn't understand that it can legitimately be non-square. Anyway I filed a bug report to Quaxi last night. Since I wanted the texture square in any case, I simply cloned the shadow texture in order to make a base for my new textures, so at least I can get on with my object now. :) Thanks!

Numenor
2nd Oct 2005, 04:21 PM
I always deal with non-square images using the "Build DXT" function and the DDS utilities. The "Build DXT" is handy also when your new image hasn't the same dimensions of the original one.

Moreover, in the DDS window, you can set the number of mipmaps at will.

Inge Jones
2nd Oct 2005, 05:00 PM
Ah right, I will remember that for the future. I only last night downloaded the Nvidia DDS stuff, so it's opened a new world for me :)

I'm getting so into meshing that all my hacking requests are building up - but it's so rewarding to actually *see* something you made in the game.

groovilicious
26th Jan 2009, 07:22 PM
I beg your patience while I ask a stupid question (or two)... :D

1. Am I correct in assuming higher mipmap level = higher quality/detail of the texture?

2. What's the max number of mipmap levels? (~thinking Spinal Tap - can we crank it to 11?) :giggler: Or 12 since it has to be divisible by 2?

eletrodj
26th Jan 2009, 08:36 PM
I beg your patience while I ask a stupid question (or two)... :D

1. Am I correct in assuming higher mipmap level = higher quality/detail of the texture?

I think, but not at all. In my objects I generally use 512x512, in the large ones. In small I use 512x512 too just for "texture work" (i prefer work in large files), but I can use 256, 128... Depends of the mesh. If your mesh is big, the big textures will be better. In small mesh, small textures will be perfect, using large textures in them will be *almost* no difference

2. What's the max number of mipmap levels? (~thinking Spinal Tap - can we crank it to 11?) :giggler: Or 12 since it has to be divisible by 2?

I've never work with more than 10. But I don't think it's necessary.

Pixelhate
26th Jan 2009, 09:22 PM
The texture size determines the mip map level : 512x512 =10, 1024X1024=11, 2048x2048= 12 etc.
Level of Mipmap is a consequence of the texture size. The bigger texture, the higher mipmap will be. (As explained by JWoods in post #5 & #7)
More Mipmap doesn't improve texture quality.

groovilicious
27th Jan 2009, 03:06 AM
Ok, thank you for the replies! Um, I'm working on a mirror with a stained glass decor overlay, and while I employed the DXT builder to make my texture for the decor/overlay 512 x 512, the mipmap level was at 7 until I manually changed it to 10 following the instructions above.

I assume that the 7 existed from the previous (the cloned object's) texture, which was originally 128 x 128 (I think). So, what I'm trying to say (and terrible at explaining myself at times) is that the DXT Builder did *not* change my mipmap level automatically in this case (if that's what you meant Pixelhate by 'consequence'?). So now I'm wondering what changed when I changed the mipmap level from 7 to 10? The number of smaller zooms? And if I want a higher quality texture from my 512 x 512 .png, should I increase the DXT from 3 to 5? Will increasing the DXT level affect the transparency of the decor? Do I need to ask the last 2 questions somewhere else? :D

Thanks again for your time!

Pixelhate
27th Jan 2009, 08:30 AM
Let's pretend you have a 512 texture with mip map level 1. What will happen ?
If you zoom out very far and even if you don't noticed any detail of your texture, you object is still calling the big texture, putting useless strain on the computer for no visible result.

If you have a 512 texture with correct mip map, the computer will choose the appropriate size to render at the appropriate distance ( like 1x1 for extreme far distance). Performances of the computer will be kept at best.

If you change the size of the texture to larger, you'll have to adjust the mip map level manually, just like you did. When building with smaller size than original, the level will be adapted automatically.

Dxt1 is perfect for most textures if they don't need transparency to be shown.
Dxt3 is needed if you want to have an Alpha Channel (transparency). But final file will be bigger.
Dxt5 may increase the visual of the texture (especially when dealing with subtle transparency) BUT it will considerably increase your file size too.

When building dxt, setting the sharpen filter to none will help for neater texture.

Of course, the starting texture will influence everything. You can't hope to improve the quality of a poor texture with the dxt features.

Numenor
27th Jan 2009, 09:04 AM
A trick to be sure to have the right number of mipmaps:

when you are importing the texture using the "Build DXT" function, and the DDS Utilities window is open, set the number of mipmaps to a high value such as 15; then import the texture. The DDS utilities will automatically reduce the mipmaps to the right value.

Note: the DDS utilities can't increase a low value: they can only cut down a high value.

Pixelhate
27th Jan 2009, 09:13 AM
ModFather, while you are there... a question. The tut says to update all sizes, but I was thinking this step isn't necessary when using Build function. Can you confirm ?
And what about the fix integrity thinggy ?

Numenor
27th Jan 2009, 02:40 PM
You're right: the "Update all sizes" must NOT be performed when using the DDS utilities; updating would actually ruin the good work of the DDS utilities.
And also clicking the "Build" button (so to rebuild the mipmaps) must be skipped, when using the Build DXT function.

As for fixing integrity, in general it doesn't harm; but frankly I'd skip that passage, too :P If you are creating an object that uses a Maxis repository, the Fix Integrity may break some links, putting an unwanted ##0x1c050000! prefix where it is NOT supposed to be...

groovilicious
27th Jan 2009, 02:55 PM
Ah! Some interesting info there pixelhate and Numenor!

I do my best to make my textures as clean and clear as I can, and I'm ok with the file size with the DXT builder at 3. I may have been fuzzying my smaller zooms because it's become a habit to 'update all sizes', so I'll try to practice *not* doing that when I'm using the DXT builder... I may experiment and see how horrendous the file size gets with the DXT set at 5, just for kicks... Great to know I can plug in the mipmap level when using the Builder as well!

But I honestly and mistakenly thought that the mipmap had something to do with texture detail until I read this thread and asked questions! (maybe my brain equated to something like bump map? - who knows! :giggler: )

Thank so much for everyone's time! Interesting and informative discussion! :beer:

Pixelhate
27th Jan 2009, 08:21 PM
Not wanting to confuse people, I feel the need to precise something.

There're two ways of briging a texture (and/or changing its size) in SimPE.

One is, as described here by JWoods:
Using Build function to adjust the Mipmap level
Then import new texture via Import button.
Then update all sizes.
Commit & save.
This method works and is, of course, correctly described in the tutorial.

The second way is:
Right clicking on the texture, choosing Build DXT option.
In pop up window, adjusting the Mipmap level, choosing the Sharpen filter setting, selecting DXT type (1,3,5) and opening the new texture.
Commit & save.
No need to update all sizes.

The second way offers often better results for texture distinctness, in my opinion.

It's describred in step 3 of this tutorial. (http://www.modthesims2.com/showthread.php?t=102356)

groovilicious
28th Jan 2009, 03:30 PM
Well done on the clarification pixelhate! :up: Thank you!

Aside: Just in case someone is interested - with the mirror I'm working on, increasing the DXT from 3 to 5 didn't increase my file size at all - dunno why... :blink: I had to use DXT3 because I'm working with transparency - the original file size with DXT3 was 556k and that's where it stayed when I upped it to 5! Additionally, the increase from 3 to 5 didn't make any apparent-to-my-eye improvements in the quality of texture either...

Thanks again to everyone for all the good info!

Numenor
28th Jan 2009, 09:00 PM
As far as I know, the DXT5 is *always* bigger than the DXT3. Is it possible that you didn't click Commit, after changing the format to DXT5?

And I agree that often there are no visual improvements using the DXT5: it should be used only if - for whatever reason - the DXT3 doesn't compress the image correctly, and creates artefacts, pixelization and colour bleeding.

groovilicious
29th Jan 2009, 12:55 AM
Um, I'm pretty sure Numenor, the recolors I did also came up as DXT5 when I created them. I have the files, I name them differently as I go along, so I always have my steps backwards (if that makes sense); if you're *really* curious about peaking between the two, I can send them... :D They're not the finished product, as I'm continuing to tweak and rename, but you're welcome to see them...

I was planning to send you some pictures of my finished product, just in case you might enjoy seeing what your good work helps create... So, check your PMs tomorrow! ;)

EDIT TO ADD: I went looking back through my last 3 days files, and the packages where I cranked the reflection up on the decor have a significant (I think) file size increase (and isn't in my final version)... that's the only place I see a noticeably different file size...

SimoneliuS
9th Nov 2009, 08:15 PM
I'm looking for answers on how fits a 5x5 tiles texture, should it be 1280x1280 image? how many levels it needs? Sorry if the answer is already there, but I'm reading so many things that maybe I am missing something.

What I'm trying to design is a diagonal rail track, it needs to be in a 2x2 tile plus the turning connection which maybe should be in 5x5 and is giving me too many troubles to get it working.

Pixelhate
9th Nov 2009, 10:37 PM
1280x 1280 is not an acceptable size (not a power of 2), should be 512x512, 1024x1024, 2048x2048, 4096x4096, etc.

When building your new texture via DDS, to have the correct level of mipmap, just follow the advice given by Numenor in post #16, which is :
"when you are importing the texture using the "Build DXT" function, and the DDS Utilities window is open, set the number of mipmaps to a high value such as 15; then import the texture. The DDS utilities will automatically reduce the mipmaps to the right value."

To have a 2x2 tile matching with a 5x5 tile will require some calculation.
But supposing we're talking about floor or terrain, aren't you working with HomeCrafter?

SimoneliuS
10th Nov 2009, 01:57 PM
Yes, I get it is just that I was working with 9 mipmap levels, then I tried with 12 but now I should try with 15 levels on a 1024 texture then? if I use a high-reso pic it wouldn't affect the speed of the game as same as with objects, right?

...yes I'm working with HCP+SimPE, was just a try to make a diagonal rail track for a rollercoaster, it needs to be transparent to see throug the rail intersections, but as far as I know the 5x5 and 2x2 tiles places the texture image fixed on the floor without allowing to move it, so I think if I draw the rail doing a loop around a 5x5 tiles space I could place it first and then make the 1x1 tile match with it, but I couldn't rotate it so maybe I need a set of 4 or more tiles to have the diagonal fully functionally on all directions and the surrounding tiles to fill the draw

bluetexasbonnie
10th Nov 2009, 02:59 PM
It is my understanding that texture size DOES affect game speed. Ideally, you want the smallest texture that still looks good. Also, use of non-standard texture sizes (i.e. NOT 256x256) makes them unuseable by Mac players. If you are going the floor tile route, you could have multiple floor tiles that you can put together to make the patterns.

Wouldn't a rug-like object be a better choice for rails? That would be a very easy mesh. So easy, that I'll even volunteer to a straight and curve piece for you if you give me some dimensional info. It would be an excellent "2nd Object" creation project. (The first being exactly as outlined by the tutorial.)

SimoneliuS
11th Nov 2009, 09:30 PM
yes, you have a good idea on making objects for the rail track, let me test if the rollercoaster can drive out of the grid, I should try to place some "directional-tiles" out of the grid and see what happens. I guess maybe it could turn a bit buggy, not sure....

bluetexasbonnie
12th Nov 2009, 10:56 AM
Are you using Echo's roller coaster from the carnival series? She has a set of floor 'tracks'.

Hinoemasim
31st Dec 2010, 11:38 AM
Late to the party, that's me!

I'm just now learning about creating mipmaps; I just wanted to throw in a quick note. There's a free program called 'DDS Converter' (now on v. 2.1) that is useful for people like me who simply *like* Paint Shop Pro. It converts the common image files (.jpg, .png, etc) into .dds files. I've done a couple of test conversions and imported the .dds files into SimPE by right clicking the image and choosing 'import .dds'- so far it looks good. It also works with Vista x64, which is always a relief.

Thanks for all of you for the great information, btw.