question about memory usage

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: question about memory usage

Post by bongobeat »

JohnWordsworth wrote:The textures are only loaded into the game engine once, so sharing textures (especially with those packaged with the game) is a very good idea where it looks good.

Edit: Obviously, you should only actually provide the texture once. If you bundle a copy of a game texture in your mod and load it in your own material, the engine won't know that it's the same texture - it only knows it's the same texture if the path is the same.
thanks for your help

I'm not sure I understand all but if I understand what you say: whatever is the number of custom material which use log2 textures, if the texture are loaded from the asset pack, they wouldn't be loaded again?

e.g:
SpoilerShow

Code: Select all

defineMaterial{
	name = "firezebra",
	diffuseMap = "assets/textures/monsters/stone_elemental_emissive.tga",
	specularMap = "assets/textures/env/mine_rock_tile_spec.tga",
	normalMap = "assets/textures/env/mine_rock_tile_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 30,
	depthBias = 0,
}
on the contrary, if I copy the log2 textures in my mod_asset:
this is loaded twice?
SpoilerShow

Code: Select all

defineMaterial{
	name = "firezebra",
	diffuseMap = "mod_assets/textures/stone_elemental_emissive.tga",
	specularMap = "mod_assets/textures/mine_rock_tile_spec.tga",
	normalMap = "mod_assets/textures/mine_rock_tile_normal.tga",
	doubleSided = false,
	lighting = true,
	alphaTest = false,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 30,
	depthBias = 0,
I got the same question about the models: are they loaded again in this case?

Code: Select all

		{
			class = "Model",
			model = "assets/models/env/mine_elevation_edge.fbx",
			offset = vec(0, 3, 0),
			material = "firezebra",
			staticShadow = true,
		},
You can set a material to a model in the object definition, without creating a new model. A very interesting and fast way to make new textured model without copying them in the mod_asset/...

e.g:
SpoilerShow
[codedefineObject{
name = "grotto_elevation_edge",
baseObject = "base_floor_decoration",
components = {
{
class = "Model",
model = "assets/models/env/mine_elevation_edge.fbx",
offset = vec(0, 3, 0),
material = "firezebra",
staticShadow = true,
},
{
class = "Occluder",
model = "assets/models/env/mine_elevation_edge_occluder.fbx",
},
},
minimalSaveState = true,
}
[/code]
So, is this model loaded twice or just once?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply