• Material Help
    13 replies, posted
I'm having a problem where the model works fine, but the material won't show in-game. I'm trying to make a gin bottle in Blender. These are the steps I took to apply the material/texture in this order. 1. Go into edit mode. 2. Select all vertices. 3. Create a new image in the UV editor. 4. Unwrap the model. 5. Bake it on full render. 6. Pack the texture into the blend using Pack as PNG. 7. Export the texture in the UV editor using Save As Image. 8. Open VTFEdit and import the saved image. 9. Export the VTF and create a VMF. I dragged the VTF and VMF into the appropriate folder (materials/models/alcoholmod) and named them both "ginbottle" without the quotes. All of the files are below. They include the BLENDs, SMDs, and VTF/VMFs. Any help is appreciated. Files: [URL="https://mega.nz/#F!MBNlkYra!kUeSMMvrJG57k5IAI_R2cg"]https://mega.nz/#F!MBNlkYra!kUeSMMvrJG57k5IAI_R2cg[/URL]
i guess you were drunk when you did that? i mean... it's an alcoholmod. :v: j/k you gotta rename the material in blender. the vmt file gotta have the same name. you also used the wrong shader. use vertexlitgeneric. btw... the texture map is aweful. that plain light bake looks weird. i got no problem with those weird subd surfaces but you gotta create proper seams before you unwrap. you should have those all those subd bits in one piece
[QUOTE=episoder;51250372]i guess you were drunk when you did that? i mean... it's an alcoholmod. :v: j/k you gotta rename the material in blender. the vmt file gotta have the same name. you also used the wrong shader. use vertexlitgeneric. btw... the texture map is aweful. that plain light bake looks weird. i got no problem with those weird subd surfaces but you gotta create proper seams before you unwrap. you should have those all those subd bits in one piece[/QUOTE] Wow looks like I was drunk lol. Anyway, I used Blender to generate those seams using "Create Seams". I'll be sure to rename that material and change the shader when I have time. Thanks for the help! [editline]23rd October 2016[/editline] [QUOTE=episoder;51250372]i guess you were drunk when you did that? i mean... it's an alcoholmod. :v: j/k you gotta rename the material in blender. the vmt file gotta have the same name. you also used the wrong shader. use vertexlitgeneric. btw... the texture map is aweful. that plain light bake looks weird. i got no problem with those weird subd surfaces but you gotta create proper seams before you unwrap. you should have those all those subd bits in one piece[/QUOTE] I have two materials in the BLEND. What should I name them?
Anyone?
They need to have the same name as your other material files.
[QUOTE=Midkey;51253019]They need to have the same name as your other material files.[/QUOTE] I only have one material file, but I have two materials in one object inside of blender.
You probably should merge them into one.
[QUOTE=Midkey;51253643]You probably should merge them into one.[/QUOTE] Sorry if this is a dumb question, but how do I merge it exactly?
You can have as many materials as you like. I had a problem with one big texture on a big model and it looked terrible. Especially when bump mapping and adding phong shading. The solution was to use 3 textures on one of my models. This is useful for cases where you want to tile a material somewhere, but have another material for a non-tiled area of the model. To use multiple textures on one model: 1) In Edit mode, in the model view area, select the vertices that you want to be mapped to the texture. 2) With the UV editor open in another pane, move the mouse over the model area, near the selected vertices and then press "u", and in the menu that pops up, click on "Unwrap". 3) In the UV editor, along the bottom, you can see a file box that lets you select a texture file. What I do here is choose a file that is in [b]tga[/b] format. This will be your material name. 4) Once you see the texture in the window, you can move the vertices around over that texture and scale it however you want. If you want the texture to be repeated all over the model, select all the vertices in the UV editor (using "a") and then press "s" (to scale) and drag out with the mouse. The vertices can be spread way out from the texture area and then it will tile. 5) To add more textures to your model, repeat the process, but for the other vertices that you want to apply to the next material. Select them first in the model view, then use "u", "unwrap", etc as per above. 5a) Now in the UV editor, select a different TGA file to use as the texture for [i]those[/i] vertices. 6) When you eventually export the model, every set of vertices will be mapped to a specific set of coordinates on the texture that you chose for those vertices. It puts the [b]name[/b] of the texture and its location of the coordinate into the SMD file. It does that for every texture on your model. You don't need to use the "materials" thing in blender (well, I don't) since you can create normal maps yourself and set them in the VMT file. 7) Open the TGA file in the VTFEdit program, then save it as a vtf file 8) Make sure your vmt file has VertexLitGeneric as the shader name [code] VertexLitGeneric { $basetexture "file_name_here" $model 1 } [/code] 9) Important: If you look inside the exported SMD file with a text editor, you can see the name of the texture listed multiple times in the file. This is your clue that you can use multiple textures inside that SMD file. The only thing blender is doing (for your case) is to create that SMD file. If there is a file extension on the texture names inside the SMD file, [b]it doesn't matter[/b] because when you compile the model with studiomdl, it will look for the [b].vtf[/b] of that file instead. I know I rambled a lot there but I hope that helps
[QUOTE=ph:lxyz;51255526]You can have as many textures as you like. I used 3 textures on one of my models. It's useful if you want to tile one of them (for example). 1) In Edit mode, select the vertices that you want to be mapped to the texture. 2) With the UV editor open in another pane, move the mouse over the model area, near the selected vertices and then press "u", and in the menu that pops up, click on "Unwrap". 3) In the UV editor, along the bottom, you can see a thing that lets you select a texture file. What I do here is choose a file that is in [b]tga[/b] format. 4) Once you see the texture in the window, you can move the vertices around over the texture to scale it however you want. If you want the texture to be repeated all over the model, select all the vertices in the UV editor (using "a") and then press "s" (to scale) and drag out with the mouse. The vertices can be spread way out from the texture area and then it will tile. 5) Repeat the process for other vertices. Select them first in the model view, then use "u", "unwrap", etc as per above. 6) When you export the model, every set of vertices will be mapped to a specific set of coordinates on the texture. It only uses the [b]name[/b] of the texture, though. (this is fine!) 7) Open the TGA file in the VTFEdit program, then save it as a vtf file 8) Make sure your vmt file has VertexLitGeneric as the shader name [code] VertexLitGeneric { $basetexture "file_name_here" $model 1 } [/code] 9) Important: If you look inside the exported SMD file with a text editor, you can see the name of the texture listed multiple times in the file. This is your clue that you can use multiple textures inside that SMD file. The only thing blender is doing (for your case) is to create that SMD file. If there is a file extension on the texture names inside the SMD file, [b]it doesn't matter[/b] because when you compile the model with studiomdl, it will look for the [b].vtf[/b] of that file instead. I know I rambled a lot there but I hope that helps[/QUOTE] Thanks for the reply! Do I need to mark seams before unwrapping? I'm hearing from some places that you do need to.
[QUOTE=brianm109;51255545]Thanks for the reply! Do I need to mark seams before unwrapping? I'm hearing from some places that you do need to.[/QUOTE] Think of it like this: Imagine you are cutting open a box. Marking the seams is like making a cut down the edges of the box. By marking the seam, you are telling blender where to cut open the mesh so that it can fold out onto the texture area. If you unwrap a cube without marking some cut points (seams), it will end up as a mess and your texture won't nicely map to it. If you mark them properly, you can unfold 4 sides in a line, with 1 on each side, then each side is a proper square and you can draw your texture over it well. You can also export the UV layout to a PNG file that you can use as a layer in your image editing program so that you can see where you're drawing. I edited my reply above with more detail about multiple textures, btw.
[QUOTE=ph:lxyz;51255551]Think of it like this: Imagine you are cutting open a box. Marking the seams is like making a cut down the edges of the box. By marking the seam, you are telling blender where to cut open the mesh so that it can fold out onto the texture area. I edited my reply above with more detail about multiple textures, btw.[/QUOTE] So, thats a yes right?
If your model is all one color, it doesn't matter. If you want to put images onto certain areas, you should probably mark the edges of those areas so that you can cut a single piece into a texture-able area on your UV map. [img]http://archive.wceruw.org/mims/Parent_Newsletters/The_Shape_of_Space-Nets/Unfold_Box.gif[/img] See how this box is unfolded? Imagine that rolled up into a cube. Now imagine that the cube is your model. The "seams" are the parts where you have to cut so that you can unroll the box in the way shown above. You can do that with any mesh that you want to texture.
[QUOTE=ph:lxyz;51255568]If your model is all one color, it doesn't matter. If you want to put images onto certain areas, you should probably mark the edges of those areas so that you can cut a single piece into a texture-able area on your UV map.[/QUOTE] Okay, thanks for the reply.
Sorry, you need to Log In to post a reply to this thread.