Model textures

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Model textures

Post by Gradunk »

I'm adding a few items of my own to my dungeon. i've got the models and everything else working but before you pick the item up it looks like a grey blank model on the floor. i can't find anywhere how to fill the model with anything. any help?
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Model textures

Post by Isaac »

There are three ways that I know of:

First, in your 3D modeler you simply name the assigned material(s) to match your defined materials in the game.

Second, you can use Dr. John's 'Grimrock Model Toolkit' to assign the material names; (if the model has only one material).

Edit:
SpoilerShow
Third, (and only for Grimrock 2), you can assign [defined] materials at runtime in the game via script. [Use this as last resort]

Code: Select all

yourCustomModel.model:setMaterial("mod_assets/texture/custom_material.tga")  << note that in the script it must say .TGA, but it must actually BE a .DDS file.
Alternatively you can also use:

Code: Select all

yourCustomModel.model:setMaterialOverrides { [first material name] = "mod_assets/texture/first_material.tga",  [second material name] = "mod_assets/texture/second_material.tga", }  


This allows you to assign more than one material by overriding the preexisting material names ~that the model must already have.
* This option has side effects. The frozen monster effect will not respect an overridden material, and will restore the default one listed in the model when done.
Last edited by Isaac on Wed Jan 25, 2017 9:55 am, edited 1 time in total.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Model textures

Post by minmay »

Isaac wrote:Third, and lastly, you can assign [defined] materials at runtime in the game via script. [Use this as last resort]

Code: Select all

yourCustomModel.model:setMaterial("mod_assets/texture/custom_material.tga")  << note that in the script it must say .TGA, but it must actually BE a .DDS file.
Alternatively you can also use:

Code: Select all

yourCustomModel.model:setMaterialOverrides { [first material name] = "mod_assets/texture/first_material.tga",  [second material name] = "mod_assets/texture/second_material.tga", }  


This allows you to assign more than one material by overriding the preexisting material names ~that the model must already have.
* This option has side effects. The frozen monster effect will not respect an overridden material, and will restore the default one listed in the model when done.
Grimrock 1 subforum, brah
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Model textures

Post by Isaac »

minmay wrote:Grimrock 1 subforum, brah
Image
*A simple theme change between the two would end this problem.

@Gradunk
You can only use options #1 & #2.
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Model textures

Post by Gradunk »

Thanks guys. i can find all the mats on johns model toolkit but it won't actually attach to the item. i must be doing something wrong here. :?
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Model textures

Post by Isaac »

Gradunk wrote:Thanks guys. i can find all the mats on johns model toolkit but it won't actually attach to the item. i must be doing something wrong here. :?
The materials need to be defined in the game, or in the mod's scripts folder. All that's required (beyond that) is that the model have the correct name of its texture.

In GMT, you must select the mesh node for the model [it highlights the figure in red], and choose/assign the material name, and press the Set Material button; then save a copy of the the model.
*This can be done from the Tools menu as well.
Image
As example:

Code: Select all

defineMaterial{
	name = "tunnel_ogre",
	diffuseMap = "mod_assets/textures/monsters/ogre_clown_dif.tga",
	specularMap = "assets/textures/monsters/ogre_spec.tga",
	normalMap = "assets/textures/monsters/ogre_normal.tga",
	doubleSided = true,
	lighting = true,
	alphaTest = true,
	blendMode = "Opaque",
	textureAddressMode = "Wrap",
	glossiness = 0,
	depthBias = 0,
}
Image

Image
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Model textures

Post by Zo Kath Ra »

Isaac wrote:Image
best weapon ever
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Model textures

Post by Gradunk »

I'm kicking myself for forgetting all this... I've gotten all the scripting done for my items now but i don't have specular or normal maps of the items to reference. what do i save those files from?
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Model textures

Post by Isaac »

Gradunk wrote:I'm kicking myself for forgetting all this... I've gotten all the scripting done for my items now but i don't have specular or normal maps of the items to reference. what do i save those files from?
Most of the game's assets are available in the asset pack. http://www.grimrock.net/modding_log1/asset-pack/
Zo Kath Ra wrote:best weapon ever
They squeak when they walk.
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Model textures

Post by Gradunk »

ok so ive gotten everything except 2 working properly now. and i don't know why they wont work cause they aren't any different.

Code: Select all

defineMaterial{
   name = "damned_helmet",
   diffuseMap = "mod_assets/textures/damned_skull_dif.tga",
   doubleSided = true,
   lighting = true,
   alphaTest = true,
   blendMode = "Opaque",
   textureAddressMode = "Wrap",
   glossiness = 50000000,
   depthBias = 0,
}

defineMaterial{
   name = "damned_shield",
   diffuseMap = "mod_assets/textures/shield_damned_dif.tga",
   doubleSided = true,
   lighting = true,
   alphaTest = true,
   blendMode = "Opaque",
   textureAddressMode = "Wrap",
   glossiness = 50000000,
   depthBias = 0,
}
Those 2 dont work... but

Code: Select all

defineMaterial{
   name = "damned_sword",
   diffuseMap = "mod_assets/textures/damned_sword_dif.tga",
   doubleSided = true,
   lighting = true,
   alphaTest = true,
   blendMode = "Opaque",
   textureAddressMode = "Wrap",
   glossiness = 50000000,
   depthBias = 0,
}
this one does... whats the difference. i have the diffuse map in the same file i can look at them with gimp etc...
i'm not getting error messages upon testing so i know it's finding the files etc...

I've also noticed how this is a Grimrock 1 forum... but i'm transferring my items to grimrock 2... trying to at least
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
Post Reply