Page 12 of 19
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 1:42 pm
by wagtunes
Okay, I watched the first couple of minutes of the video you linked to and it starts to talk about UV unwrapping. And then it goes on to say that we don't have to do this step for our mesh because when choosing torus, Blender UV unwraps it for us.
So there is absolutely no reason this shouldn't work. I will watch the rest of the video to see how he applies the texture. Maybe I'm doing something wrong there. Maybe I'm skipping a step. I will follow the video step by step and see if I'm missing something and then try creating the model again from scratch. I will then come back to this thread to report my results, success or failure.
See you soon.
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 2:21 pm
by Isaac
In the asset pack, in the scripts folder, there is a script called materials.lua. In this are the game's defined materials.
In each new mod there is a blank script called materials.lua; place custom defined materials here.
http://www.grimrock.net/modding_log1/as ... =Materials
Example:
Code: Select all
defineMaterial{
name = "iron_porticullis",
diffuseMap = "assets/textures/env/dungeon_porticullis_dif.tga", -- This image gives the raw color values of the material
specularMap = "assets/textures/env/dungeon_porticullis_spec.tga", -- This image indicates the material's level of reflectivity
normalMap = "assets/textures/env/dungeon_porticullis_normal.tga", -- This (usually software generated) image indicates the direction of each face on the model; it is used for additional faked surface detail
doubleSided = false,
lighting = true, -- false == full bright with no shadows
alphaTest = false, -- true == test for 1-bit alpha mask
blendMode = "Opaque", -- blending modes
textureAddressMode = "Wrap",
glossiness = 100,
depthBias = 0, -- usually zero
}
Examine the image texture files in the asset pack. In the case of the 'normalMap', Blender can generate this from the [high detail] model via the Baking feature. Alternatively, Nvidia has a Photoshop plugin that will create a fake normal map from any image. Other software offers this too; Xnormal, Crazy Bump ...etc
*
https://www.topbestalternatives.com/crazybump/
Example of Normal Mapping used for additional faked detail on the final game asset model:

This trim is not something one would want to have in the model as real geometry.
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 2:40 pm
by wagtunes
Isaac wrote: ↑Tue May 18, 2021 2:21 pm
In the asset pack, in the scripts folder, there is a script called materials.lua. In this are the game's defined materials.
In each new mod there is a blank script called materials.lua; place custom defined materials here.
http://www.grimrock.net/modding_log1/as ... =Materials
Example:
Code: Select all
defineMaterial{
name = "iron_porticullis",
diffuseMap = "assets/textures/env/dungeon_porticullis_dif.tga", -- This image gives the raw color values of the material
specularMap = "assets/textures/env/dungeon_porticullis_spec.tga", -- This image indicates the material's level of reflectivity
normalMap = "assets/textures/env/dungeon_porticullis_normal.tga", -- This (usually software generated) image indicates the direction of each face on the model; it is used for additional faked surface detail
doubleSided = false,
lighting = true, -- false == full bright with no shadows
alphaTest = false, -- true == test for 1-bit alpha mask
blendMode = "Opaque", -- blending modes
textureAddressMode = "Wrap",
glossiness = 100,
depthBias = 0, -- usually zero
}
Examine the image texture files in the asset pack. In the case of the 'normalMap', Blender can generate this from the model via the Baking feature.
Example of Normal Mapping used for additional faked detail on the final game asset model:

This trim is not something one would want to have in the model as real geometry.
Okay, here is where I am. After watching the video. I discovered the one step I skipped that essentially left my model without a texture. It's the step where you go to shading and link up the boxes.
After doing that, and saving the texture (it's just a solid blue file that I saved in both png and dds format because I didn't know which one I needed) I then went to the model toolkit and went to new material because the material I created (ring_of_ra) was not showing in the drop down list. When creating the new material and giving it a name, ring_of_ra now showed in the drop down list. I brought it up and assigned it to the node. However, when bringing it up in the game, it's still white.
I then went back to the model toolkit and chose a built in texture, just to make sure I created the textures properly. I then went back to the game and that texture shows up fine.
So, for whatever reason, the material I created in model toolkit from a solid blue (tried both png and dds) file does not work.
Is it because I have to put that material in the materials.lua script? If so, I have no clue how to define these. I looked at the example you gave me and it's all Greek to me. What info do I have to give for just a solid blue image file?
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 2:48 pm
by Isaac
wagtunes wrote: ↑Tue May 18, 2021 2:40 pmSo, for whatever reason, the material I created in model toolkit from a solid blue (tried both png and dds) file does not work.
Alas... The GMT's material [preview] feature is (or at least seems) intended only for internal display on the loaded model. The material always needs to be defined in the game; there is no way to append that to the model.
Is it because I have to put that material in the materials.lua script?
Yes.
If so, I have no clue how to define these. I looked at the example you gave me and it's all Greek to me. What info do I have to give for just a solid blue image file?
http://www.grimrock.net/modding_log1/as ... =Materials
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 3:12 pm
by wagtunes
Isaac wrote: ↑Tue May 18, 2021 2:48 pm
wagtunes wrote: ↑Tue May 18, 2021 2:40 pmSo, for whatever reason, the material I created in model toolkit from a solid blue (tried both png and dds) file does not work.
Alas... The GMT's material [preview] feature is (or at least seems) intended only for internal display on the loaded model. The material always needs to be defined in the game; there is no way to append that to the model.
Is it because I have to put that material in the materials.lua script?
Yes.
If so, I have no clue how to define these. I looked at the example you gave me and it's all Greek to me. What info do I have to give for just a solid blue image file?
http://www.grimrock.net/modding_log1/as ... =Materials
Ah, so basically I was expecting model toolkit to do something that it can't do. It would really be nice if that was documented somewhere.
Still, it doesn't explain why when I assign textures in Blender and give them colors it doesn't display those colors in the game. Is it because the only thing LoG recognizes when you do a Blender export is that there are materials assigned but ignores the colors of those materials and only uses colors defined in the game?
If that's the case, then I assume what I have to do is create the tga files in blender (they are dds files, right?) and then define those files as textures in my materials.lua script and make sure those dds files are in the location I tell it in the script?
Is that pretty much it?
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 3:31 pm
by Isaac
wagtunes wrote: ↑Tue May 18, 2021 3:12 pmAh, so basically I was expecting model toolkit to do something that it can't do. It would really be nice if that was documented somewhere.
Still, it doesn't explain why when I assign textures in Blender and give them colors it doesn't display those colors in the game. Is it because the only thing LoG recognizes when you do a Blender export is that there are materials assigned but ignores the colors of those materials and only uses colors defined in the game?
Yes.
If that's the case, then I assume what I have to do is create the tga files in blender (they are dds files, right?) and then define those files as textures in my materials.lua script and make sure those dds files are in the location I tell it in the script?
Is that pretty much it?
Yes.
Base minimum is to define a material in the mod, assign the material use (on the model) either in Blender, or GMT.
In the case of GMT, highlight/select the mesh node; selected is shown in RED. Use Tools>>Material Find and Replace, assign your material to the node.
Example:
Code: Select all
defineMaterial{
name = "flat_blue",
diffuseMap = "mod_assets/textures/blue.tga",
specularMap = "assets/textures/common/black.dds", --omit for shiny surface; customize image for custom reflectivity.
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Opaque",
textureAddressMode = "Wrap",
glossiness = 100,
depthBias = 0,
}

Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 3:48 pm
by wagtunes
Yep, that did it.
Okay, now, getting fancy.
Say I want my ring to be 3 colors. The left side, red, the middle, white, and the right side, blue.
Obviously, I have to define each material in Blender so I would have 3 materials assigned to the entire object. Call them...
ring_left
ring_center
ring_right
I would then have to go into my materials.lua file and instead of just setting up 1 texture, I would have to set up 3, one for each color file. And then I go into model toolkit and assign each texture to each node. I would then have a ring that is red, white and blue.
Correct?
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 4:16 pm
by Isaac
It is certainly possible to do it that way, but it is easier (arguably better) to either use Blender to 'bake' the material to an image and use that in your single material in the game, or export your model's UV map and color it in Photoshop.
Blender Texture Baking:
https://www.youtube.com/watch?v=c2ut0Trcdi0
Blender UV Export:
Normal Maps [optional]:
https://www.youtube.com/watch?v=0r-cGjVKvGw
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 4:24 pm
by wagtunes
So in other words, just make one material but color it red, white and blue.
Re: Wagtunes' Modding Questions
Posted: Tue May 18, 2021 4:26 pm
by Isaac
...In the correct areas for where you want those colors to render on the model, yes. Colored by hand, or baked in Blender.