Figuring width and height of textures

Place to get help with not working mods / modding interface.
Post Reply
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Figuring width and height of textures

Post by darkshadow1809 »

Hi there,

Simple question. I've recently gotten some custom graphics from Yuokitani he has done an fantastic job but how would I go about figuring out the following things?

Width
Height
Shift
Scale

http://johnsmith.ktec.de/factorio/mods/ ... _sheet.png
http://johnsmith.ktec.de/factorio/mods/ ... _sheet.png

^
ShadowsModpackDevelopment

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Figuring width and height of textures

Post by keyboardhack »

width = (sprites along x axis) / (texture width)
height = (sprites along y axis) / (texture height)
shift i have no idea but YuokiTani made a tool to calculate it viewtopic.php?f=135&t=12171&p=82661&hil ... ift#p81858
scale depends on what size you want the building to have in game. a 32x32 image of a chest with scale = 1 will have the size 1x1 tile. with scale = 2 the size will be 2x2. the formula is: scale(tileSize, imageSize) = tileSize / (imageSize / 32)

s33_sheet:
  • width = 4 / 1024 = 256
  • height = 4 / 1024 = 256
  • scale with a tile size of 4x4 the scale should be scale(4, 256) = 0.5, with tile size 3 scale(3, 256) = 0.375
s44_sheet
  • width = 4 / 1280 = 320
  • height = 4 / 1280 = 320
  • scale with tile size 4 scale(4, 320) = 0.4, with tile size 3 scale(3, 320) = 0.3
Waste of bytes : P

User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: Figuring width and height of textures

Post by darkshadow1809 »

keyboardhack wrote:width = (sprites along x axis) / (texture width)
height = (sprites along y axis) / (texture height)
shift i have no idea but YuokiTani made a tool to calculate it viewtopic.php?f=135&t=12171&p=82661&hil ... ift#p81858
scale depends on what size you want the building to have in game. a 32x32 image of a chest with scale = 1 will have the size 1x1 tile. with scale = 2 the size will be 2x2. the formula is: scale(tileSize, imageSize) = tileSize / (imageSize / 32)

s33_sheet:
  • width = 4 / 1024 = 256
  • height = 4 / 1024 = 256
  • scale with a tile size of 4x4 the scale should be scale(4, 256) = 0.5, with tile size 3 scale(3, 256) = 0.375
s44_sheet
  • width = 4 / 1280 = 320
  • height = 4 / 1280 = 320
  • scale with tile size 4 scale(4, 320) = 0.4, with tile size 3 scale(3, 320) = 0.3
Ohh that makes a lot more sense. Lol thanks a lot man!
ShadowsModpackDevelopment

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Figuring width and height of textures

Post by darkfrei »

And some method for cropping empty space by sprites for sprite sheet?

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Figuring width and height of textures

Post by keyboardhack »

darkfrei wrote:And some method for cropping empty space by sprites for sprite sheet?
If you mean going from this
Image
to this
Image

Then the game already does that for you when it loads the mod. With a zipped mod it probably only takes a dozen bytes extra per texture so it's probably not worth doing yourself.
Waste of bytes : P

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Figuring width and height of textures

Post by darkfrei »

keyboardhack wrote: Then the game already does that for you when it loads the mod. With a zipped mod it probably only takes a dozen bytes extra per texture so it's probably not worth doing yourself.
Also, I can render 512x512 pixels sprites with 128x128 pixels entities, for example, 64 frames pro sprite sheet without problem with memory?

I think nobody need too much free space on the sprite.

Post Reply

Return to “Modding help”