PERFORMANCE gain with using one texture for multiple items

Post Reply
User avatar
maikerumine
Member
Posts: 1366
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

PERFORMANCE gain with using one texture for multiple items

by maikerumine » Post

Hello!

I have been working on merging textures from other mods to point to default mods to have less media for the server, and then it hit me: what id we were to simplify the default textures too? Maybe use one texture for multiple textures by adding colour...

So This is what I have been working on, and it works.
Image
Example of using 5 textures for ALL the tools in MT:

Code: Select all

minetest.register_tool("default:pick_diamond", {
	description = "Diamond Pickaxe",
	inventory_image = "default_handle_long.png^(default_steelpick.png^[colorize:#33FFFF:152)",
	tool_capabilities = {
		full_punch_interval = 0.9,
		max_drop_level=3,
		groupcaps={
			cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
		},
		damage_groups = {fleshy=5},
	},
})
We us only the top part of steel pick for All picks by adding colour. :-)
The tools use a handle image and a tool image overlaid to get this effect.
This means one handle can be used with ALL tools.

BLOCKS:

Code: Select all

minetest.register_node("default:sandstonebrick", {
	description = "Sandstone Brick",
	--tiles = {"default_sandstone_brick.png"},
	tiles = {"default_stone_brick.png^[colorize:#CCCC99:152"},
	is_ground_content = false,
	groups = {cracky = 2},
	sounds = default.node_sound_stone_defaults(),
})

By using one texture for generic stone brick pattern, we colourise it to make more, therefore we can remove more textures from folder.

Ingots and lumps:
[code]
minetest.register_craftitem("default:iron_lump", {
	description = "Iron Lump",
	--inventory_image = "default_iron_lump.png",
	inventory_image = "default_clay_lump.png^[colorize:#9C0503:152",
})

minetest.register_craftitem("default:copper_ingot", {
	description = "Copper Ingot",
	--inventory_image = "default_copper_ingot.png",
	inventory_image = "default_steel_ingot.png^[colorize:#FF6600:152",
	
})
You get the idea, this frees up space on textures for less of an upload / download for public servers, thus speeds things up just a teeny bit.

Reference to a decent color picker is here:
https://www.colorcodehex.com/online-color-mixer.html

You may need to tune colours just right if colourising an already coloured texture, this is why I chose the steel textures as my base texture to modify.

You can visit the ESM City server to see this in action.


NOTE:

you MUST change the corresponding stairs to match too:

Code: Select all

stairs.register_stair_and_slab("bronzeblock", "default:bronzeblock",
		{cracky = 1, level = 2},
		{"default_steel_block.png^[colorize:#996600:152"},
		"Bronze Block Stair",
		"Bronze Block Slab",
		default.node_sound_stone_defaults())
Moreblocks also if you need.

Happy coding!!!
Attachments
screenshot_20160127_095750.png
(241.32 KiB) Not downloaded yet
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
jp
Member
Posts: 796
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: PERFORMANCE gain with using one texture for multiple ite

by jp » Post

Using texture modifiers does not free up space. The resulting images are stored on your RAM instead of your HDD.

And it has nothing to do with performances. I'd say it's even slower since the engine have to generate these combined images at start-up time.

User avatar
maikerumine
Member
Posts: 1366
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: PERFORMANCE gain with using one texture for multiple ite

by maikerumine » Post

jp wrote:Using texture modifiers does not free up space. The resulting images are stored on your RAM instead of your HDD.

And it has nothing to do with performances. I'd say it's even slower since the engine have to generate these combined images at start-up time.
Oh no! Really?

What about server and client download / upload, wouldn't this save clients from loading textures?
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
jp
Member
Posts: 796
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: PERFORMANCE gain with using one texture for multiple ite

by jp » Post

No idea.

Dragonop
Member
Posts: 1178
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop
Location: Argentina

Re: PERFORMANCE gain with using one texture for multiple ite

by Dragonop » Post

I don't think so, since you still need to download the new texture.

User avatar
rubenwardy
Moderator
Posts: 6197
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: PERFORMANCE gain with using one texture for multiple ite

by rubenwardy » Post

Using remote media servers speeds media loading up greatly.

User avatar
maikerumine
Member
Posts: 1366
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: PERFORMANCE gain with using one texture for multiple ite

by maikerumine » Post

rubenwardy wrote:Using remote media servers speeds media loading up greatly.
I would like tutorial on how to do this with minetest. Are there any specifically for this purpose?

is this correct?
http://minetest.wjake.com/wiki/dev:remote-media

https://gist.github.com/sfan5/6351560 <--code looks like linux, can this work with windows?
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
Calinou
Moderator
Posts: 3162
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: PERFORMANCE gain with using one texture for multiple ite

by Calinou » Post

1. Set up an Apache or nginx server accessible from the Web.
2. Run this script at the root of a Minetest installation.
3. Move the generated "media" folder to your Apache/nginx installation, and rename it to "minetest" (the name can be anything, it's just for convenience purposes).
4. Stop your Minetest server before editing minetest.conf.
5. Modify your minetest.conf and add a like like this (it must have a trailing slash):

Code: Select all

remote_media = http://my-domain.com/minetest/
6. Restart the Minetest server.
7. It should work now. You can try it by deleting the cache/ folder on your client Minetest installation then joining the server.

User avatar
maikerumine
Member
Posts: 1366
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: PERFORMANCE gain with using one texture for multiple ite

by maikerumine » Post

Calinou wrote:1. Set up an Apache or nginx server accessible from the Web.
2. Run this script at the root of a Minetest installation.
3. Move the generated "media" folder to your Apache/nginx installation, and rename it to "minetest" (the name can be anything, it's just for convenience purposes).
4. Stop your Minetest server before editing minetest.conf.
5. Modify your minetest.conf and add a like like this (it must have a trailing slash):

Code: Select all

remote_media = http://my-domain.com/minetest/
6. Restart the Minetest server.
7. It should work now. You can try it by deleting the cache/ folder on your client Minetest installation then joining the server.
Thank you!

I'll see if I can get this to work on windows.
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
Calinou
Moderator
Posts: 3162
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: PERFORMANCE gain with using one texture for multiple ite

by Calinou » Post

maikerumine wrote:Thank you!

I'll see if I can get this to work on windows.
You will need Cygwin to run collectstatic.sh. I recommend Babun to get it working quickly on Windows (along with nice zsh goodies). Note that some additional packages may be required; if they aren't present, you can use the "pact install" command to install them.

WampServer should be fine for using Apache on Windows.

You may also benefit from a domain or a subdomain (rather than pointing to an IP address) as well. Check out nsupdate.info for free subdomains.

KCoombes
Member
Posts: 412
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

Re: PERFORMANCE gain with using one texture for multiple ite

by KCoombes » Post

+1000

Just imagine... diamond fences... gold item frames... the possibilities are staggering!

Post Reply

Who is online

Users browsing this forum: reflipd and 3 guests