One thing I have always wanted to know
All  1-10  11-14

Previous
Next
 From:  olio
2541.11 In reply to 2541.10 
Another Q, I have always wanted to know, maybe a bit OT, but whenever I see a tutorial on texturing, people always make the texture size 512 px or 1024 or 2048... Now I know this has something to do with bytes, but does this way of working really do anything special, is this just habit from old way of working when this really meant something?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  WillBellJr
2541.12 In reply to 2541.11 
Most graphics cards work faster when the image size is a power of 2 (128, 256, 512 etc.)

Imagine the low level code require for accessing images that were exactly 497 x 363!

Even though that may be all you need out of your texture, it's faster for the processor if it was working with 512 x 512 blocks with some wasted space in them.

Power of 2 multiplication or division is a simple shift left or shift right (respectively):

256 << 1 == 512
512 >> 1 == 256

Instead of having to call a (typically CPU costly) divide or multiply opcode, you can get away with a simple bit shift which typically only takes a single CPU cycle.


The choice between using say 256 x 256 or 1024 x 1024 is arbitrary and usually depends on how close the camera may get to the textured surface (we've all seen the 3D games where the walls get blocky when you move too close to them...)

OR

If the same texture map is being used by more than one object - you'll want to have more "space" to work with using a larger image map - it all boils down to image quality vs available texture memory - the larger the image, the better it will look...

-Will
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2541.13 In reply to 2541.11 
Hi olio, that has to do with the way that video cards work.

If you were going to use that texture for a "full render" calculation like a ray-trace render or something like that, then it would not really make any difference.

But if the texture is to be displayed by your video card in real time, there are some optimizations that it can do for textures that are a power of 2 like Will mentions. I'm not sure that this is very significant anymore with more modern cards though.

Originally it used to be that 3D video cards would actually only support textures that had a size of a power of 2 (like one of: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048) and nothing else, so especially things that were oriented towards producing textures to be used inside of games would be really focused on that.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  olio
2541.14 In reply to 2541.13 
Thanks guys, for very unselfish sharing of knowledge. thanks.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-10  11-14