defining material

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

defining material

Post by LordGarth »

Hello,

What does defining a material actually do?

Thx,

LG
Dungeon Master and DOOM will live forever.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: defining material

Post by JohnWordsworth »

Each 3d model file in Grimrock (.model) makes reference to one or more materials for the parts that make it up (segments). When the game loads the model, the model only has a reference to the names of the materials it expects and then the engine links the model to a given material so the it can render its texture on screen.

I guess there are 2 major implications:

1. It might be possible to redefine a material to reskin all instances of one type of bad guy / item in the game. I have not tested this, so don't know it's possible - but the theory is if you can redefine 'long_sword' to link to a different texture, all long swords in the game would look different.

2. Unless I'm missing something, Re-skinning a model then becomes a case of cloning that model and modifying the file slightly so that it links to a diffent named material. That would then allow you to make variants of assets - such as a red sword for instance.

Hope this explanation makes some sense!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: defining material

Post by petri »

Yep, you can use defineMaterial() to redefine existing materials and create new ones.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: defining material

Post by LordGarth »

That is what I was hoping for and I have tried it but it does not work.

I am not sure what part of the puzzle i am missing.

LG
Dungeon Master and DOOM will live forever.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: defining material

Post by LordGarth »

cloneObject{

name = "redgoromorg",

baseObject = "goromorg",

meshName = "redgoromorg_mesh",

}
defineMaterial{
name = "redgoromorg_mesh",
diffuseMap = "mod_assets/textures/redgoromorg_dif.tga",
specularMap = "mod_assets/textures/redgoromorg_spec.tga",
normalMap = "mod_assets/textures/redgoromorg_normal.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Opaque",
textureAddressMode = "Clamp",
glossiness = 20,
depthBias = 0,
}

When I place the monster I get this error and I have the cloneobject above and definematerial aswell.

LG

[string "Map.lua"]:0: table index is nil
stack traceback:
[string "Map.lua"]: in function 'registerNode'
[string "Monster.lua"]: in function 'entityAddedToMap'
[string "Map.lua"]: in function 'addEntity'
[string "Monster.lua"]: in function 'spawn'
[string "Arch.lua"]: in function 'spawn'
[string "DungeonEditor.lua"]: in function 'addObjectTool'
[string "DungeonEditor.lua"]: in function 'mapView'
[string "DungeonEditor.lua"]: in function 'update'
[string "Grimrock.lua"]: in main chunk

OS Version 6.1

OEM ID: 0
Number of processors: 2
Page size: 4096
Processor type: 586

Total memory: 3037 MB
Free memory: 809 MB

Display device 0:
Device name: \\.\DISPLAY1
Device string: Intel(R) G41 Express Chipset
State flags: 08000005

Display device 1:
Device name: \\.\DISPLAY2
Device string: Intel(R) G41 Express Chipset
State flags: 08000000

Display device 2:
Device name: \\.\DISPLAYV1
Device string: RDPDD Chained DD
State flags: 00000008

Display device 3:
Device name: \\.\DISPLAYV2
Device string: RDP Encoder Mirror Driver
State flags: 00200008

Display device 4:
Device name: \\.\DISPLAYV3
Device string: RDP Reflector Display Driver
State flags: 00200008
Dungeon Master and DOOM will live forever.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: defining material

Post by LordGarth »

As far as I can tell the mesh name is not in the model file itself so it wont work.

LG
Dungeon Master and DOOM will live forever.
Post Reply