Tutorial How to Make "Power of 2" Work for Any Texture (Image) on Future Pinball

GeorgeH

Flippered Out
Site Supporters
Joined
May 3, 2016
Messages
2,601
Solutions
6
Reaction score
2,051
Points
145
Favorite Pinball Machine
Attack From Mars
Future Pinball (FP) and any program that uses graphics uses less memory if the dimensions (width and height) use a power of two (i.e., 64, 128, 256, 512, 1024, 2048, 4096) though they don't necessarily have to be the same. For example, a size of 1024x2048 is okay. The why of it has to do with the binary nature of PCs. I don't really understand it beyond that.

If the texture you want to add to a table is not of a power of two, then FP will automatically re-scale the image to its nearest power of 2 dimension when the game is run. Complying with the rule makes the loading of textures into the video card much faster if it doesn't have to rescale the image first. I have found that it is more important to make larger textures comply with the rule than smaller textures. You can get by with not making some of the textures on a table comply but if none of the textures comply, you will have many people that won't be able to play your table.

I used to think that the texture on the table loading screen could not be made to comply with power of two because there is no combination of the numbers 64, 128, 256, 512, 1024, 2048 or 4096 that matches a 16x9 shape that fits a monitor. However, FP has the ability to stretch or squeeze any shape to fit the screen (or object). You just have to figure out how to distort the image so it looks correct on the screen which is what I will show you how to do.

You can perform this same process for video where each frame is uploaded to the FP texture manager. There are many bulk image resizers on the internet where you can resize many frames at one time. I have used this one that does it online:


"FastStone Photo Resizer" is freeware that does it also:


"IrfanView" is another freeware package:


Step 1

You start out by using a texture on the table loading screen or applied to objects on the table that does not comply with power of two. On "Space Shuttle", I just added textures as needed without thinking about power of two. When I was done, I deleted all unused textures and exported all that did not comply with power of two. Then I performed Step 2 and imported the textures back into the table.

You can expand this if you want to learn more about making images fit objects or move on to Step 2.

For a table loading screen, you can use many images that can be found on the internet; however, the texture needs to be a 16x9 shape and you may need to crop the image so it fits. You can use this formula to do the math:

Height of image Height of screen
------------------ = ------------------
Width of image Width of screen

You need 3 of the variables and solve for the fourth. So you can solve for either the "Height of image" or " Width of image". On the "Space Shuttle" table, I found an image that I liked that had the dimensions 1600x900 (width = 1600 and height = 900).

Height of image /1600 = 9/16

Multiply both sides of the equation by 1600 and you get

Height of image = 9/16 x 1600

Height of image = 900

So I got lucky and happened to find a texture that is already 16x9.

I found another texture to use for a portrait use on a pinball cabinet that was 2137x3000 (width = 2137 and height = 3000). I didn't get so lucky and had to crop some of the image. Since pinball cabinet users rotate their screen, they end up using a 9x16 (9 wide, 16 high). These are the calculations:

Height of image / 2137 = 16/9
Height of image = 16/9 x 2137
Height of image = 3799

or this works also:

3000 / Width of image = 16/9
3000 = 16/9 x Width of image
3000 x 9/16 = Width of image
1,687.5 = Width of image

So, my calculations have 2 options. Option 1 would be 2137x3799 or option 2 would be 1,688x3000. I decided to use option 2 and crop the 2137x3000 down to 1,688x3000. Using 2137x3799 would require adding content to the top and/or bottom of the image which I have done on some tables but wasn't necessary on this table.

You can use the same math for determining the size of overlays. Instead of using the height and width of the screen, you would use the height and width of the overlay.

If you have an irregularly shaped surface, I have found I can just take a screenshot of a surface in the FP editor and paste the screenshot in an image editor. Then I cut away all the area around the surface, resize it, and then paint it the way I want it to look.

If you have a rectangular surface, you can use an overlay to measure each side by matching the height and width.

If you plan on reducing the size of the image, don't do it until you perform Step 2.

Step 2

Once you create the image that is not a power of two, you multiply the width times the height to get the total number of pixels in the image. Find the closest match in the left column below. In the first example above, I ended up with an image 1600x900. Multiplying 1600 by 900 equals 1,440,000. Find the closest value to 1,440,000 in the column named area below. The number is in between 1,048,576 and 2,092,032 and I ended up using 2,092,032. There are 4 choices and I used 2048x1024 because it resulted in the least distortion of the image. I ended up adding some pixels to the image which is usually not very desirable but I didn't want to reduce the resolution. It would have been better to find a larger image but I couldn't find one.

For the 1,688x3000 in the example from Step 1, I decided to reduce the size of the texture and make it comply with power of two in one step. I resized it to 1024x2048.

Area Width Height
4,096 64 64
8,192 64 128
8,192 128 64
16,384 64 256
16,384 128 128
16,384 256 64
32,768 64 512
32,768 128 256
32,768 256 128
32,768 512 64
65,536 64 1024
65,536 128 512
65,536 256 256
65,536 512 128
65,536 1024 64
131,072 64 2048
131,072 128 1024
131,072 256 512
131,072 512 256
131,072 1024 128
131,072 2048 64
261,504 64 4086
261,504 4086 64
262,144 128 2048
262,144 256 1024
262,144 512 512
262,144 1024 256
262,144 2048 128
523,008 128 4086
523,008 4086 128
524,288 256 2048
524,288 512 1024
524,288 1024 512
524,288 2048 256
1,046,016 256 4086
1,046,016 4086 256
1,048,576 512 2048
1,048,576 1024 1024
1,048,576 2048 512
2,092,032 512 4086
2,092,032 4086 512
2,097,152 1024 2048
2,097,152 2048 1024
4,184,064 1024 4086
4,184,064 4086 1024
4,194,304 2048 2048
8,368,128 2048 4086
8,368,128 4086 2048
16,695,396 4086 4086

Here is an example of a texture as it is saved to FP and used in the menu of "Space Shuttle" which looks squeezed together:
Menu_05-NightGlow.jpg

This is the way the texture looks when you open the menu in the game where it is stretched back out :
Space Shuttle 1.2.png
The texture that I used to create the overlay on the table was originally 2256x186 which is not power of two. I resized it to 2048x256.
 
Nice stuff George.

With most modern PCs having so much vram now... this isn't usually an issue to worry about, or one that not everyone thinks of. That doesn't mean its still not good practice if it benefits with less vram usage and more efficiency.

With how I'm using lots of animated textures in RetroFlair 2... saving vram can certainly be a benefit.

I "think" for the most part I have been using power of 2 textures... but I'm sure there are some I didn't.

The bigger question is... does anyone know how to export / delete FP textures from the table more than 1 at a time? When a table has 1000s of textures... that makes trying to convert them all to a power of 2 less appealing. :)
 
Great question !
 
The bigger question is... does anyone know how to export / delete FP textures from the table more than 1 at a time? When a table has 1000s of textures... that makes trying to convert them all to a power of 2 less appealing.
yes there is a way, I didn't think you didn't know.....but you have to start from the beginning to have this possibility

let me explain....
1) create your library with the textures you want to use
2) then import your textures into "texture manager" with the "import from library" function
3)then do a short test, with 20 textures

so you have your library with 20 textures inside ....

then delete the library, yes I know fp will tell you that it does not find the library ... it doesn't matter ..... but in "texture manager" it will tell you or rather you will see that you have 20 unused textures .... ok ... now it is simple to click on "delede unused" ... and you will see that it will delete all the textures imported from that library ... everything clear?
 
Nice stuff George.

With most modern PCs having so much vram now... this isn't usually an issue to worry about, or one that not everyone thinks of. That doesn't mean its still not good practice if it benefits with less vram usage and more efficiency.

With how I'm using lots of animated textures in RetroFlair 2... saving vram can certainly be a benefit.

I "think" for the most part I have been using power of 2 textures... but I'm sure there are some I didn't.

The bigger question is... does anyone know how to export / delete FP textures from the table more than 1 at a time? When a table has 1000s of textures... that makes trying to convert them all to a power of 2 less appealing. :)

Both of us modify existing tables and the old tables tend to comply with power of 2 for the most part. You're probably in compliance with power of 2 more than you think. It is not as critical to make smaller images comply. I made every texture on "Space Shuttle" comply with power of 2 as an experiment to see if I could do it. It was actually fairly easy to do. It is not as critical to make textures comply with power of 2 on "Space Shuttle" because it doesn't use many resources but it is nice that Paolo can play it without any problem.

I think that it would have helped everyone if we made "Masters of the Universe" comply. Most of the video frames on MOTU are 656x480. I think more people would have fewer problems playing it if we changed the frames to 512x512. Maybe one of these days I will fix it but it would be a time consuming task.

Unfortunately, FP can't export / delete more than 1 texture at a time. You can upload more than one. The only approach that helps is what you suggested on other postings is to save a copy of the table before adding video. That way you can just start over again if needed. The only option is to see if @ravarcade can change it so we can add more than one texture at a time.
 
Unfortunately, FP can't export / delete more than 1 texture at a time.
you haven't read .. my explanation?

G....I didn't understand almost anything, you could simplify the concept, too many words to translate

EDIT:
it must also be said that using libraries, it is easier to load textures, and of course delete them
 
you haven't read .. my explanation?

G....I didn't understand almost anything, you could simplify the concept, too many words to translate
I posted my reply before I saw your response. I will have to try your approach. Too bad that MOTU has all the video frames uploaded directly to the table and doesn't use libraries.
 
you haven't read .. my explanation?

G....I didn't understand almost anything, you could simplify the concept, too many words to translate

EDIT:
it must also be said that using libraries, it is easier to load textures, and of course delete them
The main point of my previous posting is that it is not as critical to make textures comply with power of 2 that are light on resources. It becomes much more important when the table is resource heavy like "Masters of the Universe".
 
I posted my reply before I saw your response.
no problem.....
The main point of my previous posting is that it is not as critical to make textures comply with power of 2 that are light on resources. It becomes much more important when the table is resource heavy like "Masters of the Universe".
ahhhhh....yes of course, I knew, in many of my tables there are texture no in p2 ... when they are few .... and when you have video clips, you have to use them .... in p2 .... think about 2000 texture without p2 ..... or reduced in weight ...fp freezes .... 80%.....and the loading also takes a few minutes ..... but here also comes into play what kind of pc one has ....
 
obviously if you do the test, you have to use those 20 textures first .... put them in an overlay .... or "fp" will not know you used them .... and therefore will not delete them

good dinner to me and good lunch to you
 
sorry for the confusion ... I haven't used it for a long time ..... the function is "link to library",,not "import from library"
 
the concept seems to be unclear .... or it is not what you all, expected, but if I don't get any response, I can't be clearer.

the method works if you need to create a sequence of images, (frame) via hologram or overlay .... to be used at first, also because many textures are used all together in this way .... then, if you decide not to use plus that sequence, because you don't like it or just because you should improve it, you can eliminate it the way I said before,and create a new
 
I get it. I'll have to try it.
 
I get it. I'll have to try it.
 
Paolo (@wild ),

I was hoping you might try the attacked version of "Space Shuttle". This is before I changed all the textures to use power of 2. There are 42 textures that do not comply with power of 2. This list includes the playfield and several other large textures. I am asking because I know you have a lower end PC and know that you can play the table I posted. It would help everyone to see if it is worth doing this.

George
 

Attachments

  • ```SpaceShuttle1.2BeforePowerOf2fpt.fpt
    29.3 MB · Views: 81
I have a laptop with a intel 630 dedicated gpu and 1 gig memory for graphics. you go over the available memory available, the game will actually crash (white texture error). Power of 2 helps, but in this case, you need to downsize some of the images as that is far more important. A reminder about high quality textures, they are unnecessary for most desktop use in widescreen mode. A pf image may be 2048 height, but in most computer monitors, even 1080p, there are only so many lines drawn on the monitor. Some views only display about 600 lines for the table in straight desktop mode. Only a cabinet view will give you close to the image resolution of 2048x1024, and even then the image is really only around 1800 lines max of resolution as fp draws other things like aprons and backboxes in a F8 view.
As standard practice, I have 2048x1024 main images, and others downscaled and saved at a lower quality image that are not as important and I include a zipped file of my master images for 4k/8k monitors.
You can save a lot of memory using a tileable image as the white wood, and images as decals overlapping them or on top (a very old vp trick I used as vp had problems like fp in the early days) but alas, our object count limit makes that pretty tough. It's a great option for authors that have basic graphics tables though.
 
As possibly the only guy here with a 4K playfield TV in a cabinet (43 inch), I can tell you... 4K textures for playfield and plastics make all the difference in the world.

RetroFlair 2 will end up being pretty demanding with all the animated textures I'm using....and it's currently at 200 MB... with much more to be added if I can.
 
True, but how many people can afford the cost of that?
 
True, but how many people can afford the cost of that?

No, I wasn't intending that everyone should be using 4K (though it is worth it if you are considering it and your PC can handle it).

I guess what I should have said is that it's always worth creating your art / textures in a higher 4K+ resolution as a master (like you said).... but unfortunately many authors never include this 4K+ resolution artwork for their playfield and plastic images on their table.

Rom for example on some tables has not included the better version of his playfield image. Retroflair being one of them. :(

The 4K+ textures don't need to be the default used for the playfield and plastics. Just include them with the table. The user can choose to change it easily in the editor.

The tragic part is some authors may have intended on releasing a 4K+ version of their table "down the road" when they thought hardware would keep up. Today, hardware has more than caught up... it zoomed by with cards using more than 8GB of DDR5+ vram.

Sadly though... some of those authors are no longer in the scene and we will never see their original 4K+ artwork for their tables.
 
I have a 27 inch monitor on my PC and I can tell a big improvement on a 2048x4096 playfield texture over 1024x2048. My monitor does have high resolution though. I always try to find a 2048x4096 playfield texture when I can on a table mod.
 
I was hoping you might try the attacked version of "Space Shuttle". This is before I changed all the textures to use power of 2. There are 42 textures that do not comply with power of 2. This list includes the playfield and several other large textures. I am asking because I know you have a lower end PC and know that you can play the table I posted. It would help everyone to see if it is worth doing thi
ok, yes I can play your published version, and about this one, I have some slowdown ..... it takes a few seconds to open the table...

instead of what you sent me before, did you forget to insert the shadow-maps in tga? because he didn't load me the shadows in automatic ie via tga ..... but he was doing the reading, in the third light I crashed

i can't prove it .... cause i can't create the SM myself ... in tga, if it crashes....however I noticed a slight increase in fp loading .... but I couldn't play......question ... the models have not been reduced have they? you have kept their originality, from the initial table
 
I am sorry. I forgot to add the tga for the shadow maps. I have added it now (see below). It should be interesting to see how much slower the table loads without the power of 2 textures.
 

Attachments

  • ```SpaceShuttle1.2BeforePowerOf2fpt.fpt
    30.9 MB · Views: 75
It should be interesting to see how much slower the table loads without the power of 2 textures.
no ... maybe explained wrong ..... I noticed a slight increase in loading, in the sense of more time to open the table

ok..I did the test....I also timed them both

version 1.2 the one you published

33 second for the open the table.....some slowdown, I can play 70%

SpaceShuttle1.2BeforePowerOf2(last)

50 second to open the table,totally slowed down, can't play

my pc
sochet 775 12 mb of cache
intel core 2quad q9550 2.83 ghz
6 gb ram corsair( ddr2) 1333 mhz
n-videa gt 220
chinese keyboard/mouse:bonk:

EDIT:
it must be said that it also loses a few seconds when loading the models
 
no ... maybe explained wrong ..... I noticed a slight increase in loading, in the sense of more time to open the table

ok..I did the test....I also timed them both

version 1.2 the one you published

33 second for the open the table.....some slowdown, I can play 70%

SpaceShuttle1.2BeforePowerOf2(last)

50 second to open the table,totally slowed down, can't play

my pc
sochet 775 12 mb of cache
intel core 2quad q9550 2.83 ghz
6 gb ram corsair( ddr2) 1333 mhz
n-videa gt 220
chinese keyboard/mouse:bonk:

EDIT:
it must be said that it also loses a few seconds when loading the models

Actually "SpaceShuttle1.2BeforePowerOf2" is the version that had 42 textures that did not use power of two and you were unable to play it. All the textures on version 1.2 that I published used power of two and you could play it at least some.

There you have it. It really helps to use power of two.
 
Forum activity
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Chat Bot Mibs Chat Bot Mibs: blackspatular is our newest member. Welcome!
      Back
      Top