Retexture objects

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!
Post Reply
Marsmyra
Posts: 4
Joined: Wed Nov 05, 2014 11:28 pm

Retexture objects

Post by Marsmyra »

Hello

I have created some diffusemaps for a new level Im working on. (walls and floor) but i cant get them to load. Tried to follow the retexturing-guide on wiki posted here but it mostly focused on retexturing one of the monsters.

I have:

1. created the textures
2. copied the "dungeon_wall_01" model from the log1 assets dir to my dungeons assets dir, and renamed it dungeon_wall_02
3. created a new material in the materials.lua:

defineMaterial{
name = "dungeon_wall_02",
diffuseMap = "mod_assets/textures/dungeon_wall_02_dif.tga",
specularMap = "assets/textures/monsters/brickwall_stone_root_spec.tga",
normalMap = "assets/textures/monsters/brickwall_stone_root_normal.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 65,
depthBias = 0,
}

4. Used the toolkit to assign this material to my "dungeon_wall_02" model (copy of dungeon_wall_01) and saved it

5. Edited the "tiles.lua" with this:

cloneObject{
name = "dungeon_wall_02",
baseObject = "dungeon_wall_01",
model = "mod_assets/models/dungeon_wall_02.fbx",

}

When I start up the dungeon editor I get the following error and I cant load my dungeon:

"Attempt to call global ´cloneObject´ (a nil value)"

Im new to this and if anyone would guide me it would be much appreciated. Spent 6 hours on this now so.. I suspect step 5 is the problem but I cant find any guides on this
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Retexture objects

Post by Batty »

Switch cloneObject to defineObject and it should work. :)

You also need:

Code: Select all

material = "dungeon_wall_02"
in the object definiton and a Model component added as well.

So, the definiton should look like:

Code: Select all

defineObject{
   name = "dungeon_wall_02",
   baseObject = "dungeon_wall_01",
   components = {
		{
			class = "Model",
			model = "mod_assets/models/dungeon_wall_02.fbx",
			material = "dungeon_wall_02"
		}
   }
}
Marsmyra
Posts: 4
Joined: Wed Nov 05, 2014 11:28 pm

Re: Retexture objects

Post by Marsmyra »

Thanks! It works, the walls became very dark though. I even tried with a complete white diffuse map but that becomes medium to dark grey, the normalmap looks fine though. Maybe there are some other setting I should add in the material.lua or tile.lua?

Thanks again for helping
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Retexture objects

Post by Batty »

Marsmyra wrote:Thanks! It works, the walls became very dark though.
Open the normal map in GIMP or PS and export as .dds with BC3nm/DXT5nm compression, that should fix it.

If that doesn't work, open the model in the GMT and in the menu select Model -> Recalculate Normals -> Yes and that might work. After that, I'm lost. :)
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Retexture objects

Post by petri »

Note that you don't need to create a new model if you want to change the material. You can use material property in Model component to override the material. For multi material objects there's even materialOverrides which takes a table for mapping from old material -> new material.
User avatar
Leki
Posts: 550
Joined: Wed Sep 12, 2012 3:49 pm

Re: Retexture objects

Post by Leki »

Remember, normalmap standard is a little bit different in LoG2 (purple --> green) + there is not update on Ctrl+R. For more info, read this:
viewtopic.php?f=22&t=8080
I'm the Gate I'm the Key.
Dawn of Lore
Post Reply