STATE_polygon_use_mipmap

 

 




   Function level of importance = Medium.
  
   The function turns OFF or ON the mipmap filtering (also known as trilinear filtering) for the given polygon.
   Try switching it off and see how it effect your world (example: STATE_polygon_use_mipmap(my_polygon, OFF); )
   Read the rest for your general knowledge
  
   What are mipmaps
   -----------------
   Mipmaps are used for getting better looking textures. 
   The 3D engine creates several lower detailed bitmaps in decreasing order from each bitmap that is used
   for example: If you use a 64x64 bitmap then the engine will create 6 additional bitmaps:
   32x32, 16x16, 8x8, 4x4, 2x2, 1x1. Using mipmaps use 33% more texture memory.
   
   Why do we need mipmaps
   -----------------------
   Imagine that you have a 3D world and in this 3D world you have a house that uses
   a 256x256 bitmap size image for the house front wall. Now imagine that you are looking
   at your house from a very long distance. so far away that the house appear very small on your screen
   Now when the house is very far a way the front of the house is represented by only a few pixels (for 
   example 2x2=4 pixels). And now comes the big questions, which 4 lucky pixels of the bitmap should be selected ?
   You original bitmap has 256x256=65536 pixels. Your 3D card has to select only 4 pixels !
   The problem is that when the location of the camera (the player) is moved a little, the 4 chosen pixels will alos change
   In one frame a pixel from the door will be selected, in another frame a pixel from the window curtain etc ...
   The result will be 4 pixels that are flickering in random colors. In real life when we look at something from a distance
   we see only the main\big features of the object. We spot only the average color. This is exactly what mipmaps can achieve.
   When mipmaps are on (considering our example) the 3D card will use the 2x2 version of our original bitmaps.
  
   Inside the 3D card
   ------------------
   When calculating the color of a pixel the 3D card is actually able (most of them) to use two mipmap levels
   The pixel is calculated twice one for each bitmap that is used, then the 3D card makes an average (according
   to how fit is each of the mipmap level). If bilinear filtering is used then 3D card calculates for each mipmap level 
   a bilinear filtered pixel. Then when making a weighted average of the two pixels it is said that the result pixel
   is trilinear filtered. In sort: Bilinear filtering + mipmaps == Trilinear filtering

   Reasons for using Mipmaps
   -------------------------
   1) In most cases the graphics will look better
   2) The fact that far away polygons can be rendered using a very small bitmap can
      improve rendering speed.
  
  
   Reasons for not using mipmaps
   -----------------------------
   1) Take 33 percent more texture memory
   2) In some rare cases the graphics will look better with no mipmaps
   3) The extra caclulations might slow down the rendering.

   To set the default for all the polygons, use STATE_3D_card_use_mipmaps()
   Note that STATE_polygon_use_mipmap() will overide any setting made by STATE_3D_card_use_mipmaps() 
  
   parameters:
  		mipmap_mode:
  			ON  -		The default. Use mipmaps (for both the primary texture and the secondary texture)
  			OFF -		Mipmaps are not used
  			MIPMAP_FOR_PRIMARY_TEXTURE_ONLY -		Use mipmaps only for the primary texture (each polygon could have two textures, the primary and the secondary)
  			MIPMAP_FOR_PRIMARY_SECONDARY_ONLY -    Use mipmaps only for the secondary texture (each polygon could have two textures, the primary and the secondary)
  
   Example:
  		STATE_polygon_use_mipmap(my_polygon, OFF);
   
   See also:
  		STATE_3D_card_use_mipmaps(OFF);
  

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com