1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Like RaceDepartment on Facebook.

Texture blurring DDS.

Discussion in 'Bob's Track Builder' started by Alex Kyriak, Apr 25, 2010.

  1. Hi all, I have made a texture, as a DDS file. When in RFactor, the texture appears quite blurry, not too far in front of the car. Is it something to do with the texture mapping of the DDS file? How do I control this so that it's sharper?

    Thanks alot, Alex
     
  2. Oh right worked it out. It's the MIP Bias setting in XPacker under the 'Materials' tab. A value of -4 sorted it out.
     
  3. You have to save these MIP maps in the .dds file of course.
    Just simple question - what means value (+) 4? More blurred texture?
     
  4. "You have to save these MIP maps in the .dds file of course."

    Can you tell me a bit more about how that works?

    -4 gave me a less blurry texture.
     
  5. MIP maps are something like small textures inside the main image (when saving to .dds). It's a sequence of textures, each of which is a progressively lower resolution representation of the same image. (I googled "mipmaps" and the last words are taken from Microsoft pages).
    Shortly, they allow to render details in some distance. That's the shortest explanation :) Maybe still mysterious.
    What program you use to save dds files? In dds plugin for Photoshop you can click "2D Preview" and you will see, how they look like. Every next mipmap is smaller by the power of 2.
    Most of dds textures are written with 9-10 mipmaps, sometime you can save dds file with just 2 - watch the file size. I mean if you really don't need mipmaps in your textures, you can resignate, saving some of the file size.
    Example: I used some road, had a texture with 9 mipmaps, then I used also "bump" texture to add some shiny detail. Then I did not have to use any mipmaps (the xpack setting was "0") and it looked quite fine. So, the texture without mipmaps could be smaller (hipothetically).
    Using mipmaps makes your computer to carry of them of course (bump and specular effects too!), so,if you want too many mipmaps to be rendered, you can expect some performance loss. Then, setting "-4" is usually enough.
    I'm not a specialist still, maybe you can also read this (on NVidia dds plugin) - this is also about mipmaps:
    http://developer.nvidia.com/object/photoshop_dds_plugins.html
    I hope this explains something. Good luck :)
     
  6. Note: Besides the mipmaps, the texture size is also important - if you have a textures like 128x128, you rather can't expect them sharp when using for the roads or terrain. I think they should be at least 512x512 or 1024x1024. Bigger textures cause bigger calculations for the machine anyway...
    And if you don't use alpha channels (transparency), remember to save them as DTX1 to obtain smaller files.
     
  7. you don't have to save the mipmaps, directx will generate the them automatically if they are not already present in the dds file - this ofcourse will increase loading time but the difference is usually negligible.

    directx chooses the texture LOD (or mipmap level) automatically based on the distance from camera and on the sampling parameters; there are plenty of better explanations on web but the best way to figure out the mipmaps is to use a "special" texture like the one attached - is basically just a normal dds with the mipmaps manually altered.
     

    Attached Files:

  8. Martinez, jharro, thanks for your explanations. jharro, those pictures speak a thousand words! I have the dds plugin for photoshop, and it shows me the different levels of detail automatically as you say. I was unaware that you could edit each level manually also. The texture I am using is a 1024 x 1024 texture which comes out pretty well.

    So, when setting the -4 Mip bias value in XPacker, does this effectively say to the program "use the most detailed texture further into the distance"? Ie, in jharro's diagram the green colour would extend further down the track?
     
  9. yes, -4 bias means a 4 level shift so instead of 0,1,2,3,4,5.. you'll get 0,0,0,0,0,1,2,3... (0 meaning the first level, full texture and so on).
    and another thing, when you deal with road textures the ANISOTROPIC fitering changes the process alot because you almost always see the road at quite an acute angle so you better test with that before go all extreme on mipmap bias.

    1024x1024 is quite extreme if you ask me, in example DIRT uses 512x512 iirc but it cames down to "pixel per meter" in the end; imho it would be better if you tile a 512x512 2 times instead of having a 1024x1024... the difference in terms of gfx ram is huge.

    you can also do some simple texel/pixel coverage calculations just by taking a screenshot and analise it, in example if the screen is 1280x1024 and the road covers %75 of screen you'll end up with less than 1000 pixels for the whole road, from side to side, so is kinda pointless to use 1024x1024... if such large texture is also tilled across then things became much worse, alot of GPU ram and computation would be wasted on details which will probably never be visible on screen.

    also, giving the mipmapping and the fact the road is almost always seen at an angle having square textures may not be the best option; ie, 1024x256 would do the same job as 1024x1024 assuming the texture's wide side is aligned across road.
     
  10. Thanks, jharro, that gives me much bigger picture! :)
    In my "you have to save mpimaps.." I meant there's a possibility to save dds without mipmaps, which ends with smaller file size (or to specify how many levels you want to have there). I think maybe in bump or specular textures these mipmaps are not needed too much, so that was the point (I was not precise, sorry).
    But still, what about setting the positive numbers (like 4 instead of -4)? What is the difference afterwards?
     
  11. the documentation says the lod bias can be set in [-16,16] range; i don't really see the point in using a positive shift; even the default - 0, is quite high these days.
    because the mipmap levels are always positive with 0 being the best level(ie. your original texture) adding any positive value to that would hide atleast one lod level in which case you may very well use 0 with a smaller texture instead.
     
  12. ... That means - better use negatives, as I guess. I was just curious, thanks again, jharro :)