[tutorial] plant altar - from idea to model to game object

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

5. UV Mapping / Unwrapping the Stems & Leaves

When I left off I had a model consisting of a base, dirt, 4 stems with some leaves and a top plate. For the most part the "building" phase is finished and I began the unwrapping process. I got through the 3 easy pieces (base, top and dirt) and now it is time to go onto the more difficult objects, the 4 stems with leaves.

Earlier when I was going through connecting the leaves to the stalks I mentioned that I regretted joining the leaves to the stems. Besides the time it took to go through and delete faces, connect the leave vertices with the stem vertices and make new faces, now it will add one more level of difficulty in unwrapping the stems. In addition the leaf UV will be a part of the stem UV and will make it more difficult to make a texture that will give a good level of visual separation between the leaves and the stems. Oh Well, live and learn.

To start I will select layer 4, the one with the stems, and select one of the stems by right clicking on it. (I am still in the default window mode). Press tab to get into edit mode, then choose the edge select option and go through and mark the seams as mentioned earlier.

The way I marked the seams was to mark around the base of the leaf to separate it from the stalk, then marked the upper outer edge of the leaf which separated the upper part from the lower part. I then put a couple single marks on the edge at the tip and the two fat sides of the leaf to make the UV less distorted. Once I got the leaves done I marked a seam right down the length of the vine from tip to base. I then marked the edge of the base and about every third "ring" trying to make the mark near the most radical direction changes. A good key shortcut here is alt - right click and it will select all the edges in the ring.

So my stalk seams look like this
SpoilerShow
Image
Once marked I go to the UV Editing option (top header menu where it says default, select UV edit from the menu). Then I will select unwrap from the mesh menu (remember to select all edges using A key)
and the UV map should show up on the grid to the left. From the UV's menu select export if you wish to save the UV as a PNG file. If everything looks ok then save the work, go back to default window, press tab to get back into object mode, select another vine and repeat the process.

One of the UV maps
SpoilerShow
Image


At this point I save my work. I have my model constructed and I have my UV maps generated. I'm going to put blender aside and work on creating some texture in paint.net next.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:34 am, edited 2 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

6. Making the Textures in Paint.net

Before I go onto making the texture I wanted to mention that UV wrapping is a skill unto itself and I am just in the beginning stages of learning it, so these UV maps are probably not optimal, but they are functional.

Onto the textures. If making the UV maps is a skill then making textures is a fine art.

I am not going to spend much time on the making of the textures because, quite frankly, I couldn't tell you what I did to make them. I was just randomly clicking on colors and effects and sliders in a manner that can best be described as a blind folded monkey throwing darts at a moving target. The main part of the texture portion will be how to apply them to the model.

For this model there is 7 objects that can have textures applied, the base, top, dirt and four stems. I am going to make 3 textures one for the base & top, one for the dirt and one for the stalks.

I started with the dirt texture first. I wanted a texture that would look like clumpy dirt with some moss in it and ended up with some that sort of looks like peat moss so I'm going to use this texture for the dirt,
SpoilerShow
Image
I am going to save this as a .DDS file into my blender/plant altar folder. I use the default DDS options from paint.net and I save it as moss.dds

The default settings are
DXT1(opaque/ 1 bit alpha)
Clusterfit (slow/HQ)
Perceptual
Generate MipMaps
Bilenear

I currently do not know what any of that means however. Some more stuff to learn, yaaay.

I then made the texture for the base and top, saved it as base.DDS with the default settings. Again I don't really know what I did to make it, just played around.
You may notice I tried to put some writing on the texture. I thought it would be neat to have some strange symbol like letters on it, but it turned out looking pretty weird on the model so I worked around it as I will explain later.
SpoilerShow
Image
And my texture for my stalks and leaves, saved to my plant altar folder as stalk.DDS using default settings.
SpoilerShow
Image
I wish I could tell you more about how I made the textures but I can't . Perhaps in a future topic once I learn more. There is plenty of tutorials at the paint.net forums, though those forums don't seem near as friendly as the Grimrock forums.

That's about all I can say in the texture making area, the main point being I could use up to seven different ones for this model (choosing to use only three), save as .DDS and if you don't know what all the settings do then at least know the default setting appears to work ok.

Next I will go over applying the texture to the model using the UV editing mode. This portion will be pretty in depth with lots of information. I am not going to do it tonight as it is already getting late.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:35 am, edited 3 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

7. Setting up the "Moss" texture to be applied

(Edit - I only saved pictures of the project during the making of the plant altar. Since I think it is important to show the Blender interface during the next few sections I will be making a new simple project to apply the textures to. The process is exactly the same as applying texture to the altar model.)

I now have a model, UV maps and 3 textures. It's time to go back into Blender and attempt to apply the textures to the model.

In the default window, on the right hand side you will see the properties window header. It has a menu with horizontal icons. Click on the materials icon which is the one that looks like a circle, or ball, to bring up the materials window (see image)
SpoilerShow
Image
Once in the materials window there is a materials list containing all the materials for the model. A model can have multiple materials, and a material can have multiple textures. By default the list starts off with one material named, appropriately, "material". At this point I am going to rename the material "moss" because I am going to apply the moss texture first (it's official it's now moss instead of dirt). To rename the material I will click on the name in the tool bar right below the list, rename it and hit enter and the name highlighted in blue on the list should change to "moss". (This name will transfer to GMT) I am going to leave all the other options at default for now.

With Moss highlighted I am going to click on the textures icon which is the red / white checkered icon next to the materials. In this window there is already one default texture listed, named tex. Just like in the materials window this can be renamed the same way. I am going to call this moss_dif because it is going to be a diffuse map, which determines the coloration of the material (it's like the paint color). Later I am going to do a simple specular texture which determines the shineyness of the texture (like the sheen of the paint).

Just below the name bar is a menu "type". From the menu select image or movie, and below that a selection to open the DDS file for the texture, in this case it is moss.dds in my blender/plant altar folder.
Open the file and you will see a picture of the file in the preview window. A bit further down you will see an option for coordinates. Select "UV" from the menu. The rest of the settings will stay default. You may notice further down a section called "influence" this will determine what type of effect the texture has on the material. In this case (default) it is set for diffuse, which is the color scheme of the material.
SpoilerShow
Image
At this point I have my first material set up and ready to be applied. I will do that next.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:35 am, edited 4 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

8. Applying the "Moss" texture to the model

Now I am going to go into the UV editing mode (top of screen change default to UV editing as in the unwrapping section).

Make sure to be in the edit mode for the moss (dirt) object. Press "A" to select all of the vertices and the UV map should appear on the left window (edges or faces also work, as long as all are selected. Using vertices gives the clearest view of the texture once applied).
SpoilerShow
Image
In the bottom header of the UV window is a menu list of all the textures for this material. Select the moss_dif texture and it will show up on the UV map. Change the display setting in the 3D window from solid to texture and it should also show on the model in the 3d edit window (right window).
Select the island tool and you can individually select the pieces of the uv map and move them ("G" key), rotate them ("R" key) and scale them ("S" key). if you have display texture selected the texture will change on the object as you maneuver the pieces of the UV map.
SpoilerShow
Image
Once happy with the texture just go back to the default window setting, tab out of edit mode and back into object mode, select texture for the display and view your texture on the object. No need to save the texture before exiting, but I will save my work here.
SpoilerShow
Image
Here is the plant altar with the moss texture applied.
SpoilerShow
Image
Notice a couple things, 1) it's a bit dark 2) It's nice and shiny and 3) the edges show up really well. In the next post I will apply texture to the base and top, make a specular map for the 3 textures and smooth out the edges.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:35 am, edited 2 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

9. Applying Texture to the Base

I have a texture applied to the moss (dirt) and next I am going to apply texture to the base and top.

I am going to use my simple cube as an example and I went and added a cross to the top of it.

Currently I have the cube textured (which would be the moss in the altar)
SpoilerShow
Image
Now I am going to (from the default window) select the base object. Keep in mind I connected the base, top, dirt and stems through the parent child relationship so I can still individually select the objects. Had I joined the objects I could no longer select them individually as is the case with the stems and leaves.

In the properties window there is no materials listed yet for this object, so I am going to select new and then give it a name. For the altar I am going to name it base (this is the name that will transfer to GMT). For my example I will name it cross.

Next go to the textures menu for the new material. Again there is no texture so you will need to select new and give it a name. Go through and do the same as for the moss part, select type image or movie, open the file, in this case plant altar base.dds and select coordinates to UV.
SpoilerShow
Image

Image
Note: The screen looks a bit different because in the first example I used the preset UV editing window layout. In this case I added a third window to the preset view and changed it to properties and selected textures menu.

Now I will just go into edit mode, select all vertices, edges or faces as desired, which will bring up the UV map of the cross (didn't put that in the tutorial, same as the other unwrapping I did earlier).
Down on the UV window header there is now two textures listed, the moss texture on the base (which should still be showing), and the plant altar base material that I just added. Select the plant altar base material and in the 3D view select textures on the display and you should see the base texture applied to the cross (which would be the base in the altar.) Just like before I will select the island tool to move(G), scale(S) and rotate(R) the individual parts of the UV map. I am going to try to put some of the writing on the cross, so I want to watch the texture in the 3D view as I move the UV map so I can get the design in a good spot.

Once finished I can just go back to the default window layout and check the view. Remember to select display texture in the 3D header. (blender saves the individually settings for each window, so if I change the settings in the 3D view in the UV edit mode, it will not affect the settings in the 3D view of the default mode. Fun, isn't it)
SpoilerShow
Image


Here is the cube / cross with two textures applied.
SpoilerShow
Image
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:36 am, edited 2 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

10. Apply texture to Top, Smooth Edges and make Specular Maps

At this point I am going to repeat the above process for the altar top, which will now make the base, top and moss(dirt) with texture applied.

But I also mentioned two other things besides the base and top and that was the texture was too dark and shiny and the edges were too distinct. Now I will work on those before moving onto the vines.

The edges being to sharp is a simple fix. In the 3D window, select the moss(dirt) object, go into edit mode and on the left side is the mesh tool menu. Scroll down a bit and you will see the shading selection. Choose smooth shading and it will, for lack of a better term, take the edge off. Go through and change the setting to smooth for all the objects in the altar.

I choose to address this first for two reasons, one, it's easy and two, when you select smooth shading it seems to have a definite effect on the specular aspect of the texture and will make the object noticeably shinier.

Compare the two images of the cube / cross. first without smooth shading(flat shading) and the second with smooth shading.
SpoilerShow
Image

Image
Now that the smooth shading is applied it gives even more reason to make a specular map to tone down the reflectivity.

Once again a big thank you and credit goes out to germanny who helped me through this the first time. What I am going to do is the most basic of all specular maps, and that is just a black and white version of the diffuse map. So I will go into paint.net, open up the moss.dds, go into the adjustments menu, select black and white which will change the picture to a grey scale, then use the brightness control to darken the image. I just guessed about how much to darken it, but the rule is dark = no reflectiveness, light = high reflectiveness. It is also possible to go through and use the select tool to make certain areas shinier than others but I will not be doing that here. When I am done adjusting I select save_as to make a new file and name it moss_spec.dds using the default settings, same as when the diffuse map was made. By placing _spec in the file name I know it is a specular map and not the diffuse map named moss.dds. If I was smart I would have named the moss file moss_dif.dds to make it clear it is a diffuse map, and I will rename it when I transfer to the Grimrock Model Toolkit (coming soon, I promise).

I will now go and do the same thing to the other two texture files so I have a diffuse and specular map for all three. A third type of common map is called a normal map which is used to transfer a high polygon image onto a low polygon object. I will not be doing one of those, as I have not learned how yet, but that is next on my list to work on. In the next post I will add the spec map to the object.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:36 am, edited 2 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

11. Applying the Specular Maps to the Base, Top and Moss objects

One last one for tonight. This tutorial stuff is taking longer than making the item :lol:

Now that I have the specular maps made I need to apply them to the model. We will start with the moss(dirt) which corresponds the the cube in the sample.

In the default window select the moss and go into edit mode. In the materials definition make sure the moss material is selected (should be only one anyways). The only thing you need to do here is under the specular section. Slide the intensity slider all the way left to 0.00. As you slide it watch the preview window and you will see the reflectivity change.
SpoilerShow
Image
Next go to the texture menu and select new and give it a name. Be sure to include _spec to help remind you it is a specular map, select type image or movie and then open the file. Make sure to open the specular file and not the diffuse (which is already open for the other texture). Change the coordinates to UV as before.
SpoilerShow
Image
Here I will need to make a few more selections. Scroll down and find the section titled influence. Under diffuse uncheck the box that is there by default. If it stays checked it will affect the color of the texture. Under specular check the Intensity and hardness boxes and just below check the RGB to intensity box.
SpoilerShow
Image
That is all that is need for a basic specular map. No need to go in and do the uv editing again. Just go back to the default window and check the work and save the file.

I only applied the specular to the base cube. Compare the two images and see how the specular map changed how shiny the moss is.

Here are the two pictures
SpoilerShow
Image


Image
And finally to get back to the plant altar, here is the altar with the base, top and moss textured and with specular maps applied.
SpoilerShow
Image
Next I will apply texture and specular to the stems. The procedure is the same so I won't go into as much detail, but I want to point a couple things out.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:36 am, edited 2 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

12. Apply Texture to Stems, Repair messed up faces, Export Object for use by GMT

Back for one quick post tonight and that should get me to the point of moving stuff over to Grimrock Model Toolkit.

All that is left to do now is to apply the diffuse and specular textures to the stems. The procedure is exactly the same as with the other parts I've done so far, so I won't cover that here.

One thing I wanted to show is what happens when I mess up. It's my firm belief that a person can not claim to know something well until they can mess it up beyond all recognition and still pull it back from the brink of destruction. Not saying I did that bad, but one of my stems had a problem when the texture was applied.
SpoilerShow
Image
If you look close you will see there is a hole in the texture where one of the leaves joins the stem. The first thing I did to try to fix it was to see if any normals were flipped. In the edit mode with all vertices selected I selected the recalculate normals. (Normals are basically what direction the faces are facing) That did not do anything so I went to each offending face and tried to manually flip the normals and that didn't work, so I figured I probably have some vertices not connected or something. At this point I went and deleted all the faces, edges and vertices in the area until I got to some clean edges, then rebuilt the connecting faces. I had to remark my seams for that area and then unwrap and make a new UV map. I got everything back to where it should have been at first but there was no texture applied to the new area. The only way I could get the texture to take effect in the reworked area was to apply one of the other textures to the map and then reapply the stem texture back over that. There may be a more effective and professional way to do it, and if one the more experienced modders wants to chime in that would be awesome.

The other thing I wanted to point out is the way the texture makes the leaves indistinguishable from the stalks. Since I used the join function to connect them I can no longer select them individually. Looking back I would have done the parent child connection like with the other objects. Or using the method germanny suggested about UV mapping and texturing before joining. I still need to play wit that to figure out for sure how it works. The other option is to make a part of the texture different and move the leaves to that area. ARdTru sent me a link to a nice wood texture that will probably look good on the stalks. Once I get the tutorial finished I'm going to play with the textures and try to improve them.

Once the stems are textured I will save the file and then export it. To export just select the file menu, export then Wavefront(.obj)

The check the following, (thanks to Mr. Wordsworth for this info)
Apply Modifiers
Include Edges
Include Normals
Include UV's
Write Materials
Triangulate Faces
Objects as OBJ groups (uncheck OBJ objects)

This will save the file as an .OBJ file and will also create a materials file. All I need to worry about for GMT is the .OBJ file. (Don't lose the materials file in case you need to rework something about the object in blender.) If all went well I am now ready to Import the object to GMT and then Grimrock.

The finished product in blender
SpoilerShow
Image
That's all for now, next is GMT.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:37 am, edited 2 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

13. Starting and Setting up Grimrock Model Toolkit

Now that the model is ready it is time to switch to the wonderful Grimrock Model Toolkit. And once again I give a big thank you to John Wordsworth for making this tool.

If you have not used GMT yet here is the link to the forum post on it.
viewtopic.php?f=14&t=3325

Also make sure to have downloaded the Grimrock Asset pack. The asset pack contains the model & texture files and the LUA definition scripts that the game uses. The asset pack can be found here
http://www.grimrock.net/modding/asset-pack/

Once the GMT is up and running (use the link above to get it running if needed) the first thing to do is point the GMT to the asset pack. Do this by going to the tools menu (top of screen) and choosing the settings option which will bring up a menu where you can enter the path to the asset pack. In my case it's Almost Human\Legend of Grimrock\Dungeons\Downloaded Custom Assets\Asset Pack\Asset_Pack_v2\Assets. As always when working with file paths spelling, punctuation and capitalization is vital to success.
In the setting there is also a spot to set a filepath to a grimrock dungeon file. This is where the GMT will save the .model file when save as is selected (don't see a plain save function).

To see if your file path is correct go to Tools > Reload Materials and then on the right hand side tool bar, under the Nodes header at the very bottom, next to a "set material" button is a pull down menu that should have all the default materials from the asset pack. If the list is empty then recheck your filepath. Also in the file menu at top you can select "open" to open a game model. Note that here you will need to fine tune your file path to get to the model files you want. (Make sure the filepath in settings stops at "assets" because it will need to look for models, textures and scripts. If you go past that point the GMT will usually give an error notice when you try to do something. A common error is "Filepath should include a scripts folder" or something like that.)

Once you have the GMT up to the point of being able to open game model and textures from the asset pack it is now time to start getting the custom stuff into a place where the GMT can find it.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 9:04 am, edited 5 times in total.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: [tutorial] plant altar - from idea to game object

Post by Ryeath_Greystalk »

14. Copy Texture files to Asset Folder, Introduce Material Definitions

Now that GMT is functional I am going to make copies of my six .DDS files and place the files into the assets\textures folder along with all the default game materials. Note that the textures folder is divided into sub folders by category such as monsters, environment, items etc. If you can put your file in the appropriate subfolder it will help you find it later when you make up the materials definition script.

If you recall earlier I named my diffuse files moss.dds, plant altar base.dds and stalk.dds. I am going to take the opportunity here and rename them to fit with the rest of the Grimrock material files by adding the underscores between words and making sure each is indentified with either dif or spec. Make sure not to change the name of the files in the blender folder because blender will still look for those files if you open the model in blender. So at this point I have the six files, named

moss_dif.dds
moss_spec.dds
plant_altar_base_dif.dds
plant_altar_base_spec.dds
stalk_dif.dds
stalk_spec.dds

in the assets\textures\items folder.

Now that the textures files are in place it is time to make up the material definitions. These are the LUA scripts that tell the game where to look for the .dds files and what to do with them when it finds them.

Here is a list of the standard game definitions
http://www.grimrock.net/modding/predefi ... finitions/

You will notice that all the definitions have pretty much the same options. They are as follows

name = "brick_wall01", (material name)
diffuseMap = "assets/textures/env/brickwall_stone_root_dif.tga", (filepath to diffuse map)
specularMap = "assets/textures/env/brickwall_stone_root_spec.tga", (filepath to specular map)
normalMap = "assets/textures/env/brickwall_stone_root_normal.tga", (filepath to normal map, not being used in my model)
doubleSided = false, (determine if the texture should show on both sides of the mesh as germanny pointed out earlier in the tutorial)
lighting = true, (Don't know what this does)
alphaTest = false, (Don't know about this but I think has to do with transparent areas of the texture)
blendMode = "Opaque", (I believe this makes it so it is solid and not see through)
textureAddressMode = "Wrap", (No clue here)
glossiness = 15, (not sure but may have to do with how shiny the item is)
depthBias = 0, (no clue here either)

As I said at the beginning I am just starting to learn this and feel woefully inadequate to do this tutorial, but I am going to keep at it. Eventually I will learn what these options all mean, but for now I just pick a item similar to the one I am making and use the material definition for that item, modifying it as needed.

Next open up the materials LUA file in a text editor program (Notepad or some other) and you will see a gigantoid wall of text that would make even the most seasoned forum troll cringe. It is here that I will put my custom materials definitions. The easiest way I have found to do this is locate a material definition from a similar item, highlight the entire material definition, ctrl_c to copy it, go to the end of the file and then ctrl_v to paste it in place. Then just go through and edit as needed. When finished save the file. I will give the material definitions in the next post.
Last edited by Ryeath_Greystalk on Sat Aug 17, 2013 7:38 am, edited 2 times in total.
Post Reply