Home Technical Talk

tf2 lighting and import problem

Victariand
polycounter lvl 7
Offline / Send Message
Victariand polycounter lvl 7
Hi! I'm trying to track down a lighting issue I ran into when importing a hat into team fortress 2. Essentially the hat is always illuminated from the underside rather than in a manner consistent with the character or level. A picture of the kepi and lighting issue -

kepiWIP01.jpg

I suspect there is something simple I am missing, but for the life of me I can't find anything. There are some entries one can insert into the .qc file ($illumposition, $upaxis, etc) which should help - but from my experimentation they don't appear to do anything.

Here is the .qc file I used -
$cd "C:\Commander's Log\kepi"
$modelname "engineer_bill.mdl"
$model "body" "kepiSMD.smd"
$upaxis Y
$sequence idle "idle" loop fps 30.00
$cdmaterials "models/player/items/engineer"
$illumposition 0 20 0 
$ambientboost
$hboxset "default"
$hbox 0 "bip_head" -4.281  -8.838  -7.748  4.281  0.000  4.496
$collisionmodel "phymodel.smd" {

	$mass 5.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
}

I modeled the hat in Maya and ran it through milkshape to export it into .smd format.

Anyway, thank you for any insight yall can provide!

Replies

  • Mark Dygert
    Options
    Offline / Send Message
    It's probably coming from the VMT file which controls the shader instructions for the material. Can you post the vmt file?
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    of course, I basically borrowed the code from some of the other hats and filled in a few blanks. I can't remember which one this is from - but I've tried a few different ones with the same result.
    "VertexlitGeneric"
    {
    	"$baseTexture" "models\player\items\engineer/kepi"
    	"$bumpmap" "models\effects\flat_normal" 
    	"$detail" "effects/tiledfire/fireLayeredSlowTiled512.vtf"	
    	"$detailscale" "5"
    	"$detailblendfactor" .01
    	"$detailblendmode" 6
    	"$yellow" "0"
    
    	"$phong" "1"
    	"$phongexponent" "25"
    	"$phongboost" "1"
    	"$lightwarptexture" "models\lightwarps\weapon_lightwarp"	
    	"$lightwarptexture" "models/player/pyro/pyro_lightwarp"
    	"$phongfresnelranges"	"[.25 1 4]"
    	"$basemapalphaphongmask" "1"
    
    	"$rimlight" "1"
    	"$rimlightexponent" "4"
    	"$rimlightboost" ".65"
    	// Cloaking
    	"$cloakPassEnabled" "1"
    	"Proxies"
    	{
    		"weapon_invis"
    		{
    		}
    		"AnimatedTexture"
    		{
    			"animatedtexturevar" "$detail"
    			"animatedtextureframenumvar" "$detailframe"
    			"animatedtextureframerate" 30
    		}
    		"BurnLevel"
    		{
    			"resultVar" "$detailblendfactor"
    		}
    		"YellowLevel"
    		{
    			"resultVar" "$yellow"
    		}
    		"Equals"
    		{
    			"srcVar1"  "$yellow"
    			"resultVar" "$color2"
    		}
    
    	}
    }
    
  • Zipfinator
    Options
    Offline / Send Message
    Zipfinator polycounter lvl 9
    Try removing the two $lightwarptexture lines.
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    Thanks for the response! I gave that a try and pulled the extra lines, it didn't help.
  • Mark Dygert
    Options
    Offline / Send Message
    Try this:
    "VertexlitGeneric"
    {
        "$baseTexture" "models\player\items\engineer/kepi"
        "$selfillum" "1"
      
      // Cloaking
        "$cloakPassEnabled" "1"
        "Proxies"
        {
            "weapon_invis"
            {
            }
    
        }
    }
    
    Its one of the most basic VMT files you can do. You can start adding to it and see where it goes wrong. Or comment out (add // at the start of the line) all the lines but these and test it out each section by removing the comment preface. I added SelfIllum 1 which will set your model to full bright, because the default vertex shading will look too weird.

    I suspect you might want to try hacking out the detail map and the instructions that correspond to it.
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    Thanks! I plugged in the basic shader you provided - and played around a bit.

    While it is less pronounced due to the lack of specular highlights it is still obvious the hat is being illuminated from the bottom rather than the top side regardless of the settings that I've plugged in.

    I am of the belief this is likely an issue with the model itself or the .qc file.
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    Did you reset Xform your model ? Do the normals look correct in your 3d software ?
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    Forgive me, I'm not sure precisely what you mean by xform - but of course I deleted history and froze/reset transforms for the object before export. I also have double checked the normal facing on the mesh - and i am sure it is correct.

    It is worth noting that the hat displays fine when viewed from the hl2 model viewer. http://jrosenkranz.com/misc/kepi02.jpg

    One weird thing I ran into is that I had to rotate the hat 180 degrees because of a conflict of orientation between Maya and half life - I wonder if that could have anything to do with this?
  • Mark Dygert
    Options
    Offline / Send Message
    Well if you froze transforms that is pretty much the same as reset Xform in 3dsmax. Still you might want to export the mesh as obj and import it into a new scene then export it to .smd just to make sure its not a transform issue.

    Going back to the .qc file you might want to try it with these changes:
    $cd "C:\Commander's Log\kepi"
    $modelname "engineer_bill.mdl"
    $model "body" "kepiSMD.smd"
    $upaxis Y [COLOR=Red]//Might try commenting out this also?[/COLOR]
    $sequence idle "idle" loop fps 30.00
    $cdmaterials "models/player/items/engineer"
    [COLOR=Red]//$illumposition 0 20 0 //commented out
    //$ambientboost //commented out[/COLOR]
    $hboxset "default"
    $hbox 0 "bip_head" -4.281  -8.838  -7.748  4.281  0.000  4.496
    $collisionmodel "phymodel.smd" {
    
        $mass 5.0
        $inertia 1.00
        $damping 0.00
        $rotdamping 0.00
    }
    
    The $illumposition is a command to rotate the orientation of the illumination in your case 20 degrees on Y, which could be causing it.

    The $ambientboost should wash out the shadows but it shouldn't effect the highlights, but its not really necessary so might as well try it with out it and see how it goes.

    $upaxis Y might be causing a problem too, if you remove it, the orientation of the hat will probably not match, but if you rotate and reset the hat to match the new reality it might shade correctly.
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    actually, I added those lines ($upaxis, $illumposition), in to try to correct the problem. However, those lines don't appear to do anything regardless of whether they are in or not.

    Am I, by chance, using them wrongly or is there a syntax error?
  • Mark Dygert
    Options
    Offline / Send Message
    Have you tried it with both the simple vmt and the simpler .qc file? I think you might of been running into two problems and if you only remove one but not the other it would still look wonky.

    Other than that I'm out of ideas. If you post the mesh and texture files I could probably try a few things when I get some time.
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    I confess I feel I have tried everything. I've kind of shopped around this problem for a couple weeks, now, with a lot of spent effort to no avail.
    Anyway, I would be much in your dept if you could have a look and root out where I went wrong. the source files and mdls can be gotten at here. Thanks!
  • Victariand
    Options
    Offline / Send Message
    Victariand polycounter lvl 7
    Forgive me for the bump, I am still actively looking for a solution to the problem.
  • Scruples
    Options
    Offline / Send Message
    Scruples polycounter lvl 10
    The normals of your hat are bent. (I only checked the .SMD)
    It probably came from your exporter, so check your settings.

    [Edit] I had a similar problem with a .smd exporter (wunderboy's but it works fine now), it looks like the normals have all been inverted on one of its Axis's.

    deleteyu.jpg

    Uploaded with ImageShack.us
Sign In or Register to comment.