Home Technical Talk

Source Engine Model compilation

polycounter lvl 19
Offline / Send Message
MikeF polycounter lvl 19
Alright, been at this since 11am and i've had it. Cannot for the life of me figure out what i'm doing wrong here.

I've all my exported files, my model compiles fine using studiomdl.exe, I have a .mdl .vtf and a .vmt file, i can open up the .mdl fine in the viewer, but i have just a pink checkerboard texture

Here's the folder structure of where each file resides

C: \games\steam\steamapps\username\half-life 2\hl2\Models\pillar\pillar.mdl
C: \games\steam\steamapps\username\half-life 2\hl2\materials\pillar.vtf
C: \games\steam\steamapps\username\half-life 2\hl2\materials\Models\Pillar\pillar.vmt

Here is the .qc file i used to compile the model:

$modelname pillar\pillar.mdl
$cdmaterials models\pillar
$surfaceprop "Wood"
$staticprop
$scale 1
$body studio "Pillar.smd"
$sequence idle "Pillar_idle" fps 1
$collisionmodel "Pillar_phy.smd"
{
$Mass 1
$concave
}

$upaxis Y


and here is the .vmt file:

"VertexLitGeneric"
{
"$basetexture" "Pillar"
"model" 1
"$envmapmode" 1

}



everything i've read says it has to do with $cdmaterials line in the .qc file, but i just cant figure out what's wrong
Any help would be greatly appreciated, i love source engine, but this is rediculous

Replies

  • OpethRockr55
    Options
    Offline / Send Message
    Your .vmt looks good, so I'd suggest you double check where it's looking for your .vmt using the MDLTextureInfo tool from wunderboy.org. Just drag your .mdl onto it and it'll tell you where it's looking for your texture information.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    Thanks a lot for the suggestion, i was looking for something like that.
    Still no luck tho, as far as i can tell the vmt is where it should be, but i'm unsure about the "texture name" section, is that speficied somewhere else that i'm missing.

    Here's a printscreen

    mdltextureinfo.jpg

    I'm assuming the "modfolder" prefix is dependant on what engine version and current game you have selected in the source SDK, but correct me if i'm wrong
  • Snipergen
    Options
    Offline / Send Message
    Before you export your .smd make sure there is a texture applied that has the exact same name as your .vmt!

    Also use studiocompiler, great tool.
    http://www.chaosincarnate.net/cannonfodder/cftools.htm

    With your .qc, you need to smack your .vmt and .vtf in materials/models/pillar

    Your .vmt is wrong, it should be (if you named the texture pillar_diffuse)

    "VertexLitGeneric"
    {
    "$basetexture" "models\Pillar\pillar_diffuse"
    "model" 1
    "$envmapmode" 1

    }
  • Mark Dygert
    Options
    Offline / Send Message
    Check the name of the file you have applied in your 3D app that gets included in the smd and the name it is looking for.

    If that checks out try:

    Try putting both the VMT and VTF files in:
    C: \games\steam\steamapps\username\half-life 2\hl2\materials\Models\Pillar\

    Then change your

    "VertexLitGeneric"
    {
    "$basetexture" "model\Pillar"
    "model" 1
    "$envmapmode" 1
    }
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    tried everything to no avail.
    Starting to think its the maya exporter.... using 2008
    What would you guys recommend, i've tried it with both pralls and valves

    this is what i get in my output window using pralls

    "
    exporting vmt files:

    phongE1SG


    exporting shader
    phongE1


    *** The following shaders did not export correctly:

    phongE1SG
    "

    Not sure if that has anything to do with my problem but its about the only thing i've got to go on rite now
  • HAL
    Options
    Offline / Send Message
    HAL polycounter lvl 13
    Just use a basic material with a texture with the exact name of the vmt like the others suggested.

    sounds to me like maya is building up a vmt?

    Also your .qc has the correct setup for the material folder. It must be definitely something wrong with the setup prior to exporting/during export.

    The vmt looks good to me aswell.

    Also take a look here:

    http://developer.valvesoftware.com/wiki/Main_Page
  • rollin
    Options
    Offline / Send Message
    rollin polycounter
    open your smd in a texteditor and look if the texture name is correct.. thats also a simple way to change the texture name after export with "search and replace with"


    but be sure.. I had numerous times overseen a very simple miss match in texture names .. :poly142:
  • gamedev
    Options
    Offline / Send Message
    gamedev polycounter lvl 12
    Man, I love Valve, but the tools can be such $hit!
  • CrazyMatt
    Options
    Offline / Send Message
    A hem.... Valve has the worst tools in existince!
    Fun games, but the worst fucking toolset the planet has to offer in video game development for artists.:thumbdown:
  • gamedev
    Options
    Offline / Send Message
    gamedev polycounter lvl 12
    Haha, alright, glad I'm not alone. Maybe this model compiling shit is why we have yet to see Episode 3? Ha.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    rollin wrote: »
    open your smd in a texteditor and look if the texture name is correct.. thats also a simple way to change the texture name after export with "search and replace with"


    but be sure.. I had numerous times overseen a very simple miss match in texture names .. :poly142:

    that was it man, thanks so much! what a headache....
    Turns out in the .smd my texture name was replaced with debug/debugempty for every vert. I manually replaced it this time, but i'm thinking this will only work for a simple model with straight diffuse. I'm certain now that its prall's exporter, guess it doesnt like anything newer than maya 8.... If anyone has a way of making it work with 2008, or a better exporter (valve's is just as messed up in its own ways i'm finding) speak up!

    Thanks again for all the help everyone, those valve guys could really learn something from the unity pipeline hehe
  • Mark Dygert
    Options
    Offline / Send Message
    Yep source & hammer are due for a pretty big overhaul.

    I was talking to someone about it and they thought Valve might have some specific tools that help them get around these little things, stuff they haven't released. Which I guess could be the case, after all the community has come up with a lot of helper apps and stuff to smooth over some of these bumps. It's hard to think they wouldn't do the same thing. I sure would like to have some of those tools...
  • Szark
    Options
    Offline / Send Message
    Szark polycounter lvl 12
    MikeF wrote: »
    I manually replaced it this time, but i'm thinking this will only work for a simple model with straight diffuse.

    Well, yes. All models are exported with only a diffuse applied to them, any additional maps are defined in the vmt :poly121:
    MikeF wrote: »
    If anyone has a way of making it work with 2008, or a better exporter (valve's is just as messed up in its own ways i'm finding) speak up!

    What is it exactly that you find so messed up with valve's exporter? The one time I used it I found it exceptionally easy to work with.
  • Peris
    Options
    Offline / Send Message
    Peris polycounter lvl 17
    Vig wrote: »
    Yep source & hammer are due for a pretty big overhaul.

    I was talking to someone about it and they thought Valve might have some specific tools that help them get around these little things, stuff they haven't released. Which I guess could be the case, after all the community has come up with a lot of helper apps and stuff to smooth over some of these bumps. It's hard to think they wouldn't do the same thing. I sure would like to have some of those tools...

    I heard they actually use these community tools at valve as well :D
  • CheeseOnToast
    Options
    Offline / Send Message
    CheeseOnToast greentooth
    Maybe so, but there's a load of stuff that the public doesn't have access to yet. The export process has been streamlined a fair bit, with loads of mel scripts that run in Maya to validate your files, auto check-out from Perforce etc. It's been a while since I've worked with Source though. Most of the new goodies came just after TF2.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    alright, here's a quickie. Can prop_static's be scaled inside of hammer or is that something that has to be set up before export?
  • Mark Dygert
    Options
    Offline / Send Message
    I don't think you can scale any props inside of hammer like you can in unreal. I think there could be some scale parameters inside the .qc files?
    But I've never played with them, but that would mean compiling a new prop wouldn't it?

    If you can scale props I would love to know how.
  • Snipergen
    Options
    Offline / Send Message
    MikeF wrote: »
    alright, here's a quickie. Can prop_static's be scaled inside of hammer or is that something that has to be set up before export?

    Indeed, you can't. You need to recompile your .qc with the $ scale 1.0 parameter, and change that.
    On the other hand I feel better when my model is scaled right in max and I export it correctly. But yea you should be able to scale it in hammer tbh.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    tried messing around with the scale parameter but the results are too trial and error for my taste.
    Solution: import full scale human from source and adjust manually for reference, oh well.

    after all this crap i'm starting to feel like a genius, i havnt done this much text edditing since highschool programming
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    valve's export process seems so hilariously 1990s now
  • Disco Stu
    Options
    Offline / Send Message
    Still their games are timeless!
    Next source engine will be epic i hope.
    And hopefully also decent tools :D
  • Mark Dygert
    Options
    Offline / Send Message
    MoP wrote: »
    valve's export process seems so hilariously 1990s now
    Agreed. You should take a look at their displacement tools. It so evil I think it actually kills a kitten each time someone changes the push/pull axis from the drop down menu. I would check on that but it locks the viewport window...

    Don't get me started on the material browser.

    I can not wait for the next source update if it includes tool upgrades.
  • CheeseOnToast
    Options
    Offline / Send Message
    CheeseOnToast greentooth
    I have a feeling that the next big update from Valve will make the mod community very happy. Especially machinima fans. *kof, kof*

    As per usual though, don't hold your breath.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    alright, got another little question
    Trying to get specular to work properly
    Here is the vtm i'm using to have spec, bump and diffuse. From what i've read to have bump and spec together, you must use the tag "$normalmapalphaenvmapmask" 1

    "VertexLitGeneric"
    {
    "$basetexture" "PillarDiffuse"
    "$bumpmap" "pillarNormals2"
    "$envmap" "env_cubemap"
    "$normalmapalphaenvmapmask" 1
    "$bumpscale" 5
    "$model" 1
    "$nocull" 1

    }

    The Results i get with that when specular is turned on are seen in image B below, just a nasty cube map, even tho i've swaped the $envmap with several different images, it is still applied as a cube map

    shaderAB.jpg

    I've tried using a phong shader:

    "VertexLitGeneric"
    {
    "$basetexture" "PillarDiffuse"
    "$bumpmap" "pillarNormals2"
    "$bumpscale" 5
    "$model" 1
    "$nocull" 1

    "$phong" "1"
    // "$phongexponent" 33
    "$phongexponenttexture" "pillarNormals2"
    "$phongboost" "6"
    "$phongfresnelranges" "[0.05 0.5 1]"

    }


    And that results in no specular value, as seen in image A

    As it is now, the specular is stored in the alpha channel of the normal map and it is clearly working as a mask (note the concrete below the missing tiles having no shine), however it still emmits the cubemap


    EDIT: From the more i read, it seems as tho source doesnt actually support spec just fakes it with cube maps? if this is the case, then what is the phong shader used for and is there a better way to control the intensity of the cubemap?
  • Mark Dygert
    Options
    Offline / Send Message
    I would have to look it up but I think phong is a replacement for VertexLitGeneric. So you have two shaders going where there should be one. Try commenting out the top paragraph or at least the vertexlitgeneric line and see what happens.

    About the cubemap you probably need to place a env_cubemap in the environment and then in the console type buildcubemap then reload the map. Maps that are just newly built don't have cubemaps created automatically.
  • CheeseOnToast
    Options
    Offline / Send Message
    CheeseOnToast greentooth
    Vig, if you've still got that page from the SourceDev Wiki I sent you ages ago, it might be worth posting it here, or just PMing it. I don't have access to it any more (different studio). It's from the Valve internal wiki that explains exactly what commands to use with phong and what they do. I don't think the public wiki has been updated with all this stuff yet.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    that would be most appreciated, this one has me stumped. I can get a reasonable effect using cubemaps, but its just so overpowering.
    http://developer.valvesoftware.com/wiki/Phong
    from what i can understand after having read this over and over it is possible, but i cannot figure out a proper vmt
  • HAL
    Options
    Offline / Send Message
    HAL polycounter lvl 13
    Phong and cubemaps only work together for the orange box engine meaning ep2/tf2 etc

    a way to control the enviroment map strength would be $envmaptint which adjusts the cubemaps color and thus by turning it more dark you get a less prominent environment texture.

    In addition, $Enviromentfresnel is effective, too

    Keep in mind, that if you own episode2 you can bring up the games inbuilt material editor by adding -tools to the launchparamters. With that tool you can load up a vmt and directly change it ingame and see the results. Comes in quite handy.
    For dynamicaly lit stuff this vmt I created worked kinda well and gives readable details even in areas that are too dark for dynamical stuff in source normally.
    "VertexLitGeneric"
    {
    	"" "modelsweaponssmg_mn23diffuse"
          	"" "models/weaponssmg_mn23seburo_normals"
    	"" 1
    	"" "1"
    	"" "1"
    	
    	
    	"" "env_cubemap"
    	"" "1"	
    	"" "[0.3 0.3 0.3]"
    	"" "0.2"
    	
    	
    	"" "1"
    	"" "modelsweaponssmg_mn23specular"
    	""	"[12 3 8]"
    	"" "1"
    	"" "[1.2 0.8 0.6]"
    	
    	"" "1"
    	"" "2000"
    	"" "1"
    	
    	
    	
    }
    

    $phongtint does the same for for the phong and enables you to add a little bit of color to the phong lighting. I also suggest to control the phong intesity buy adjusting that parameter instead of phongboost.
    Note: Phongboost is required to be set to "1", without that paramter there wont be any phong at all.

    The enviroment texture has to be declared BEFORE declaring the phong.

    Environment and phong share the same spec mask.
    I didnt figure out a workaround for that, as the given examples in the source dev wiki all rendered my phong ineffective.

    This should get you the following look ingame:
    source.jpg

    I hope this helps a little bit.
  • MikeF
    Options
    Offline / Send Message
    MikeF polycounter lvl 19
    wow, this is a huge help. Gonna try this out in a few minutes. Thanks a lot.

    I've got all my assets set up in hl2 using the hl2ep1 engine, would this screw with me if i were to just start things up using the OB engine?

    Unfortunately all i have for the ob engine is tf2, no ep2 so do all the original hl2 assets still work fine?
  • Mark Dygert
    Options
    Offline / Send Message
    Vig, if you've still got that page from the SourceDev Wiki I sent you ages ago, it might be worth posting it here, or just PMing it. I don't have access to it any more (different studio). It's from the Valve internal wiki that explains exactly what commands to use with phong and what they do. I don't think the public wiki has been updated with all this stuff yet.
    That was a great page it explained a lot, even if it was missing the images it covered so much more than the community wiki.

    I know I saved it somewhere but its probably been backed up by now I'll have to go digging through my archives and see if I can find it.
  • HAL
    Options
    Offline / Send Message
    HAL polycounter lvl 13
    MikeF wrote: »
    wow, this is a huge help. Gonna try this out in a few minutes. Thanks a lot.

    I've got all my assets set up in hl2 using the hl2ep1 engine, would this screw with me if i were to just start things up using the OB engine?

    Unfortunately all i have for the ob engine is tf2, no ep2 so do all the original hl2 assets still work fine?

    Just recompile them for the orange box engine. The only thing you'd miss with ep1 would be enviromentmapping while using phong.
Sign In or Register to comment.